bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51088: clang-toolchain > 6 refers to /lib on foreign distros


From: Ludovic Courtès
Subject: bug#51088: clang-toolchain > 6 refers to /lib on foreign distros
Date: Sat, 09 Oct 2021 10:51:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

Ludovic Courtès <ludovic.courtes@inria.fr> skribis:

> clang-toolchain > 6 picks crt*.o from /lib or /lib64 on foreign
> distros.  Here are runs on a CentOS machine:
>
> $ guix environment --pure --ad-hoc clang-toolchain@6 -- c++  hello.cpp
> $ echo $?
> 0
> $ guix environment --pure --ad-hoc clang-toolchain@7 -- c++  hello.cpp
> ld: 
> /gnu/store/f0ca0lf64bw08srv1bj7gkg6ag0sbdb2-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../libstdc++.so:
>  undefined reference to `__cxa_thread_atexit_impl@GLIBC_2.18'
> clang-7: error: linker command failed with exit code 1 (use -v to see 
> invocation)

This is fixed by these commits:

  b37fe44b7d gnu: clang@11, clang@12: Do not refer to /lib on foreign distros.
  f1b4f46f0a gnu: clang@10: Do not refer to /lib on foreign distros.
  46141bd372 gnu: clang@9: Do not refer to /lib on foreign distros.
  66caab54b9 gnu: clang@7, clang@8: Do not refer to /lib on foreign distros.

The only remaining FHS thing that shows up in ‘strace c++ hello.cpp’ is:

  stat("/lib/x86_64-linux-gnu", 0x7ffc3a4fc6d0) = -1 ENOENT (No such file or 
directory)

It’s harmless, coming from the somewhat comical ‘getMultiarchTriple’
function¹; excerpt:

  case llvm::Triple::x86_64:
    if (IsAndroid)
      return "x86_64-linux-android";
    // We don't want this for x32, otherwise it will match x86_64 libs
    if (TargetEnvironment != llvm::Triple::GNUX32 &&
        D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
      return "x86_64-linux-gnu";
    break;

:-)

Thanks,
Ludo’.

¹ 
https://github.com/llvm/llvm-project/blob/release/12.x/clang/lib/Driver/ToolChains/Linux.cpp#L40





reply via email to

[Prev in Thread] Current Thread [Next in Thread]