-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
cmakeBuild system in general and CMake in particularBuild system in general and CMake in particular
Description
I am trying a cross compilation (-DLLVM_HOST_TRIPLE=x86_64-linux-musl). It seems that shared object links (e.g. lib/LLVMHello.so, unittests/Support/DynamicLibrary/PipSqueak.so) do not respect CMAKE_SHARED_LINKER_FLAGS.
If I use LLVM_USE_SPLIT_DWARF=on, a DSO link does not pick up -fuse-ld=lld and will fail due to GNU ld not supporting --gdb-index
MUSL=$HOME/Dev/musl-cross-make
cmake -GNinja -Sllvm -B/tmp/out/musl -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_SPLIT_DWARF=on -DCMAKE_C_COMPILER=~/Stable/bin/clang -DCMAKE_CXX_COMPILER=~/Stable/bin/clang++ -DCMAKE_{C,CXX}_FLAGS="--target=x86_64-linux-musl --sysroot=$MUSL/output/x86_64-linux-musl --gcc-install-dir=$MUSL/output/lib/gcc/x86_64-linux-musl/9.4.0" -DCMAKE_{EXE,SHARED}_LINKER_FLAGS="-fuse-ld=lld -Wl,--dynamic-linker=$MUSL/output/x86_64-linux-musl/lib/libc.so -Wl,-rpath=$MUSL/output/x86_64-linux-musl/lib" -DLLVM_NATIVE_TOOL_DIR=/tmp/Rel/bin -DLLVM_HOST_TRIPLE=x86_64-linux-musl -DLLVM_TARGETS_TO_BUILD=host -DLLVM_ENABLE_PROJECTS='clang;lld'
ninja -C /tmp/out/musl lib/LLVMHello.so # musl-cross-make/output/lib/gcc/x86_64-linux-musl/9.4.0/../../../../x86_64-linux-musl/bin/ld: unrecognized option '--gdb-index'As a workaround, I can add -fuse-ld=lld -w to CFLAGS instead.
Metadata
Metadata
Assignees
Labels
cmakeBuild system in general and CMake in particularBuild system in general and CMake in particular