Ensure lld is used for external cmake with clang#44075
Ensure lld is used for external cmake with clang#44075mathetake wants to merge 1 commit intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
|
I ran into a similar issue when building envoy with compiler-rt + libunwind enabled. Looks like if we also configure This worked for me: diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl
index c3d0995330..81a4690bcb 100644
--- a/bazel/envoy_build_system.bzl
+++ b/bazel/envoy_build_system.bzl
@@ -143,18 +143,25 @@ def envoy_cmake(
"//conditions:default": {},
})
+ _compiler_rt_entries = select({
+ "@toolchains_llvm//toolchain/config:use_compiler_rt": {
+ "CMAKE_C_FLAGS": "-rtlib=compiler-rt -l:libunwind.a",
+ },
+ "//conditions:default": {},
+ })
+
# If cache_entries is a dict, merge defaults and wrap for debug builds.
# If it's a select(), pass it through directly.
if hasattr(cache_entries, "update"):
cache_entries.update(default_cache_entries)
cache_entries_debug = dict(cache_entries)
cache_entries_debug.update(debug_cache_entries)
- final_cache_entries = _lld_linker_entries | select({
+ final_cache_entries = _lld_linker_entries | _compiler_rt_entries | select({
"@envoy//bazel:dbg_build": cache_entries_debug,
"//conditions:default": cache_entries,
})
else:
- final_cache_entries = _lld_linker_entries | cache_entries
+ final_cache_entries = _lld_linker_entries | _compiler_rt_entries | cache_entries
pf = ""
if copy_pdb:There is a separate |
|
@kralicky cool - would it be possible to verify this works for your case? that would be very helpful |
|
@kralicky you can use |
|
It works for normal builds but I think there are still issues when cross-compiling and for sanitizer builds. Maybe this is getting too off-topic but heres what I am seeing currently. As far as I can tell, when cmake runs its compiler tests it will use If If
If
|
Resolves a comment #42397 (comment)