[PATCH] D110663: [Driver] Support Debian multiarch style lib/clang/14.0.0/x86_64-linux-gnu runtime path and include/x86_64-linux-gnu/c++/v1 libc++ path

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 28 17:59:59 PDT 2021


MaskRay added a comment.

In D110663#3029088 <https://reviews.llvm.org/D110663#3029088>, @phosek wrote:

> The reason I removed this behavior in D101194 <https://reviews.llvm.org/D101194>, aside from extra overhead introduced by the extra checks,  is that we've seen cases where people would have both paths on their system which lead to difficult to diagnose issues where Clang would pick up a library different from the one they expected. I'd therefore prefer supporting only a single spelling of the triple that could be configured, and making sure that Clang build on Debian uses the right configuration.

The problem is that when LLVM_DEFAULT_TARGET_TRIPLE is "x86_64-linux-gnu" (no vendor part), CMake respects it (instead of adding `unknown`) and installs files to `lib/clang/14.0.0/x86_64-linux-gnu/`.
Currently clang driver only inspects the normalized `lib/clang/14.0.0/x86_64-unknown-linux-gnu/` and cannot find it.

I think D101194 <https://reviews.llvm.org/D101194> caused the workaround used by @sylvestre.ledru: symlink `/usr/lib/llvm-14/lib/x86_64-linux-gnu` -> `x86_64-pc-linux-gnu`
(I am quite confused by the pc part. That looks like a Debian configuration issue.)

> A potential solution would be to reintroduce the portion D101194 <https://reviews.llvm.org/D101194> which would let each driver control the triple spelling (by overriding getMultiarchTriple. On Linux, including Debian, that logic is already implemented in https://github.com/llvm/llvm-project/blob/7255ce30e48feb07e4e82613f518683fbc247c1c/clang/lib/Driver/ToolChains/Linux.cpp#L40, and on all other platforms this could simply return TargetTriple.str() as was done in D101194 <https://reviews.llvm.org/D101194>.

On many Debian/Ubuntu derivatives, `Distro.IsDebian() || Distro.IsUbuntu()` is false but they use the Debian multiarch hierarchy. How to make these distributions work?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110663



More information about the cfe-commits mailing list