mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +00:00
c70dca8249
LLVM's build system creates NATIVE/bin/llvm-config by reexecuting cmake with entirely new flags. Problematically, the `CMAKE_INSTALL_*` flags are not inherited, causing llvm-config-native to return wrong installation paths, e. g. CMAKE_INSTALL_LIBDIR would default to `lib64` on x86_64-linux. Previously this was masked by outputs.patch which replaced ActiveLibDir with a string passed in from Nix, however `--cmakedir` for example would turn out to be wrong always, breaking cross-compilation of e. g. lld. Additionally LLVM_ENABLE_RTTI needs to be repassed, as it is used to determine if RTTI is available. Passing LLVM_LINK_LLVM_DYLIB is crucial if we are building LLVM non-statically: It influences the --shared-mode flag (which should indicate that -lLLVM is enough to link all components) and makes --link-shared work in the first place, i. e. llvm-config-native believes the built shared libs don't exist unless we repass this flag. Passing LLVM_LINK_LLVM_DYLIB=ON, however, makes the native build produce a full libLLVM.so which is something we don't want, so we introduce a patch which forces llvm-config to link statically against the LLVM components it needs.
13 lines
470 B
Diff
13 lines
470 B
Diff
diff --git llvm/tools/llvm-config/CMakeLists.txt llvm/tools/llvm-config/CMakeLists.txt
|
|
index 16ba54c0cf2f..20b017195e84 100644
|
|
--- llvm/tools/llvm-config/CMakeLists.txt
|
|
+++ llvm/tools/llvm-config/CMakeLists.txt
|
|
@@ -6,6 +6,7 @@ set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc)
|
|
# Add the llvm-config tool.
|
|
add_llvm_tool(llvm-config
|
|
llvm-config.cpp
|
|
+ DISABLE_LLVM_LINK_LLVM_DYLIB
|
|
)
|
|
|
|
# Compute the substitution values for various items.
|