[libcxx-commits] [PATCH] D101194: [Driver] Push multiarch path setup to individual drivers

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 27 13:34:44 PDT 2021


phosek added a comment.

In D101194#2720761 <https://reviews.llvm.org/D101194#2720761>, @bjope wrote:

> Got some problems with my builds after this commit.
>
> My cmake commands looks like this (well, this is after having tried to fix the problem by replacing `x86_64-unknown-linux-gnu` by `x86_64-linux-gnu` as I figured that might be needed after looking at the changes in this patch):
>
>   cmake /repo/uabbpet/llvm-upstream/llvm --debug-trycompile -G Ninja -DCMAKE_MAKE_PROGRAM=/app/ninja/1.8.2/SLED11-64/bin/ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/compiler-clang -DLLVM_APPEND_VC_REV=OFF  -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld' -DLLVM_BUILTIN_TARGETS=default -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_ENABLE_RUNTIMES='compiler-rt;libcxx;libcxxabi;libunwind' -DRUNTIMES_x86_64-linux-gnu_SANITIZER_USE_STATIC_LLVM_UNWINDER=ON -DRUNTIMES_x86_64-linux-gnu_SANITIZER_USE_STATIC_CXX_ABI=ON -DRUNTIMES_x86_64-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY=ON -DRUNTIMES_x86_64-linux-gnu_COMPILER_RT_CAN_EXECUTE_TESTS=OFF -DRUNTIMES_x86_64-linux-gnu_LIBCXX_HAS_ATOMIC_LIB=0 -DRUNTIMES_x86_64-linux-gnu_COMPILER_RT_BUILD_XRAY=OFF -DLLVM_RUNTIME_TARGETS='x86_64-linux-gnu' -DLLVM_ENABLE_LIBPFM=OFF -DCLANG_TOOLING_BUILD_AST_INTROSPECTION=OFF -DCLANG_ROUND_TRIP_CC1_ARGS=OFF
>
> But my build fails, and it seems to be related to the message `-- Failed to find compiler-rt builtins library for x86_64-linux-gnu`, and later I get
>
>   -- Compiler-RT supported architectures: x86_64
>   CMake Error at /repo/uabbpet/llvm-upstream/compiler-rt/cmake/Modules/AddCompilerRT.cmake:258 (message):
>     Cannot find builtins library for the target architecture
>   Call Stack (most recent call first):
>     /repo/uabbpet/llvm-upstream/compiler-rt/lib/stats/CMakeLists.txt:23 (add_compiler_rt_runtime)
>
> It tries to find libclang using a path like this `my_build_dir/lib/clang/13.0.0/lib/linux/libclang_rt.builtins-x86_64.a` (which is what I get if manually run `my_build_dir/bin/clang --rtlib=compiler-rt -print-libgcc-file-name` as well). But what I get when building is `my_build_dir/lib/clang/13.0.0/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a` and `my_build_dir/lib/clang/13.0.0/lib/i386-unknown-linux-gnu/libclang_rt.builtins.a.
>
> Not sure exactly what I'm doing wrong here. Looks like some kind of mismatch. I assume the layout with separate dirs for the libs is due to `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`, but the just built clang does not seem to know about that. Should it know about that? Is it no longer allowed to use `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` in combination with `COMPILER_RT_USE_BUILTINS_LIBRARY=ON`?
>
> Or maybe the problem is that we use `-DLLVM_BUILTIN_TARGETS=default`?

The use of `default` is the issue, the problem is that the target triple "guessed" by `config.guess` doesn't necessarily match the multiarch triple used by Clang. I think that ideally we would stop relying on `LLVM_DEFAULT_TARGET_TRIPLE` and instead we would get the path directly from Clang. I can look into it but that might take a while to implement so we should probably revert the change for now?

I'm a bit surprised that you're using `-DLLVM_BUILTIN_TARGETS=default` but `-DLLVM_RUNTIME_TARGETS='x86_64-linux-gnu'`, usually I'd expect these to match.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101194



More information about the libcxx-commits mailing list