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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 16:04:04 PDT 2021


lebedev.ri added a comment.

In D107799#3028862 <https://reviews.llvm.org/D107799#3028862>, @MaskRay wrote:

> In D107799#3028818 <https://reviews.llvm.org/D107799#3028818>, @lebedev.ri wrote:
>
>> TLDR: it reproduces if there is some runtime library installed (e.g. `libc++-14-dev`),
>> then there is `/usr/lib/llvm-14/lib/x86_64-pc-linux-gnu/`,
>> which is i guess picked by cmake as the triple to use.
>>
>> `mv /usr/lib/llvm-14/lib/x86_64-pc-linux-gnu /usr/lib/llvm-14/lib/x86_64-linux-gnu` hides the issue,
>> which highlights that the fix is as simple as understanding why clang is using `x86_64-pc-linux-gnu` triple on debian.
>> Please do not reland, the bug is real.
>>
>> Thanks.
>
> I am 95% confident that the bug lies on Debian side:

I'm 99.99995% sure that things were working before this change, so it is to blame, not distro.

> it configures something special so that the triple shifts from the normal `x86_64-linux-gnu` (Debian multiarch, `gcc -dumpmachine` output) or `x86_64-unknown-linux-gnu` (many other Linux distros; vanilla gcc built on Debian/Ubuntu) to `x86_64-pc-linux-gnu`.

Does it? As far as i can tell gcc's triple is correct, and in llvm's cmake *_TRIPLE are all `x86_64-unknown-linux-gnu`

  $ gcc -dumpmachine
  x86_64-linux-gnu

So i have no idea why clang says it is targeting `x86_64-pc-linux-gnu`.

> I may have a hard time making debootstrap work to reproduce your environment:
>
>   % sudo debootstrap --arch amd64 unstable . http://deb.debian.org/debian
>   ...
>   I: Unpacking the base system...
>   W: Failure trying to run: chroot "/tmp/chroot/." dpkg --force-overwrite --force-confold --skip-same-version --install /var/cache/apt/archives/libapparmor1_3.0.3-2_amd64.deb /var/cache/apt/archives/libargon2-1_0~20171227-0.2_amd64.deb /var/cache/apt/archives/libcryptsetup12_2%3a2.4.0-1_amd64.deb /var/cache/apt/archives/libip4tc2_1.8.7-1_amd64.deb /var/cache/apt/archives/libjson-c5_0.15-2_amd64.deb /var/cache/apt/archives/libkmod2_29-1_amd64.deb /var/cache/apt/archives/dmsetup_2%3a1.02.175-2.1_amd64.deb /var/cache/apt/archives/libdevmapper1.02.1_2%3a1.02.175-2.1_amd64.deb /var/cache/apt/archives/systemd_247.9-3_amd64.deb
>   W: See /tmp/chroot/./debootstrap/debootstrap.log for details (possibly the package systemd is at fault)

It works for me, 
Basically, create fresh debian unstable chroot, install clang + libc++-dev from https://apt.llvm.org/ (NOT THE ONES FROM DEBIAN ITSELF!),
install cmake + zlib1g-dev, and see my initial comment for the actual reproduction.

> Advice to the next Clang version on Debian, consider `-DLLVM_HOST_TRIPLE=x86_64-linux-gnu` instead of `pc` if D110663 <https://reviews.llvm.org/D110663> is accepted.

I would very much like for LLVM to work on debian, of all things, out of the box :S

> ---
>
> During investigation, I find one possible source of `pc`:
>
>   sh llvm/cmake/config.guess => x86_64-unknown-linux-gnu
>   linux32 sh llvm/cmake/config.guess => i686-pc-linux-gnu
>
> But I cannot find anything else in llvm-project which may lead to `pc`.

Yeah, i'm not sure why that is happening yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107799



More information about the llvm-commits mailing list