summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0032-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch
blob: d89f10849b08bddb67f3dee763fad9d0d98ad18c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From ab07bcf103432f49aeff486e2898110c879e8bc0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 12 Aug 2022 11:50:57 -0700
Subject: [PATCH] llvm: Do not use cmake infra to detect libzstd

OE's version is build using plain make not cmake as a result we do not
have the cmake support files and this probing method can get this info
from build host and force linking with libzstd from /usr/lib which is
not what we want when cross building.

Fixes errors building llvm-config like
/usr/lib/libzstd.so.1.5.2: error adding symbols: file in wrong
format
| clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
| ninja: build stopped: subcommand failed.

Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 llvm/lib/Support/CMakeLists.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 8fbb2ca4c164..a6daa7c9f20f 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -22,7 +22,7 @@ if (HAS_WERROR_GLOBAL_CTORS)
 endif()
 
 if(LLVM_ENABLE_ZLIB)
-  list(APPEND imported_libs ZLIB::ZLIB)
+  list(APPEND imported_libs z)
 endif()
 
 if(LLVM_ENABLE_ZSTD)
@@ -34,7 +34,7 @@ if(LLVM_ENABLE_ZSTD)
 endif()
 
 if(LLVM_ENABLE_ZSTD)
-  list(APPEND imported_libs ${zstd_target})
+  list(APPEND imported_libs zstd)
 endif()
 
 if( MSVC OR MINGW )
@@ -291,7 +291,7 @@ if(LLVM_ENABLE_ZLIB)
     get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
   endif()
   get_library_name(${zlib_library} zlib_library)
-  set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
+  set(llvm_system_libs ${llvm_system_libs} z)
 endif()
 
 if(LLVM_ENABLE_ZSTD)
@@ -304,7 +304,7 @@ if(LLVM_ENABLE_ZSTD)
     get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
   endif()
   get_library_name(${zstd_library} zstd_library)
-  set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
+  set(llvm_system_libs ${llvm_system_libs} zstd)
 endif()
 
 if(LLVM_ENABLE_TERMINFO)