[libcxx-commits] [PATCH] D107799: [CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux

Fangrui Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 8 00:29:53 PDT 2022


MaskRay added a comment.

In D107799#3565520 <https://reviews.llvm.org/D107799#3565520>, @glandium wrote:

> This is causing problems finding system zlib when compiling clang with clang, because when using the target directories for runtimes, cmake determines the target name to match that, and then proceeds to try to find zlib.h in /usr/include/$target, which doesn't work when $target doesn't match the system multi-arch triple, which it doesn't on Debian systems because the runtime directory and the cmake target is e.g. x86_64-unknown-linux-gnu, and the system multiarch triple is x86_64-linux-gnu...

Please give a reproduce instruction.

I am using Debian testing x86-64 and `cmake -GNinja -Sllvm -B/tmp/RelA -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;flang;lldb;lld;compiler-rt;openmp;mlir;polly;cross-project-tests' -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' -DCMAKE_CXX_COMPILER=$HOME/Stable/bin/clang++ -DCMAKE_C_COMPILER=$HOME/Stable/bin/clang` works fine. The upstream debian build bots looks happy.
`lld/test/ELF/compress-debug-sections.s` is a zlib test and it works fine.

Here is another build at `/tmp/out/custom1`. `-L/usr/lib/x86_64-linux-gnu` is there.

  % /tmp/out/custom1/bin/clang a.c '-###' |& sed -E 's/ "?-[iIL]/\n&/g' 
  clang version 15.0.0
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: /tmp/out/custom1/bin
   "/tmp/out/custom1/bin/clang-15" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "a.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/tmp/c" "-resource-dir" "/tmp/out/custom1/lib/clang/15.0.0"
   "-internal-isystem" "/tmp/out/custom1/lib/clang/15.0.0/include"
   "-internal-isystem" "/usr/local/include"
   "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
   "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
   "-internal-externc-isystem" "/include"
   "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir=/tmp/c" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/tmp/a-59cd08.o" "-x" "c" "a.c"
   "/usr/local/bin/ld" "-pie" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "a.out" "/lib/x86_64-linux-gnu/Scrt1.o" "/lib/x86_64-linux-gnu/crti.o" "/usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o"
   "-L/usr/lib/gcc/x86_64-linux-gnu/12"
   "-L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib64"
   "-L/lib/x86_64-linux-gnu"
   "-L/lib/../lib64"
   "-L/usr/lib/x86_64-linux-gnu"
   "-L/usr/lib/../lib64"
   "-L/lib"
   "-L/usr/lib" "/tmp/a-59cd08.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o" "/lib/x86_64-linux-gnu/crtn.o"

If you have some builds which now have problems, you will need to specify `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=off` now and figure out a long-term sustainable solution.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107799/new/

https://reviews.llvm.org/D107799



More information about the libcxx-commits mailing list