This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Support -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on in CI
ClosedPublic

Authored by MaskRay on Aug 27 2021, 12:30 PM.

Details

Summary

This fixes -isystem/-L/-Wl,-rpath paths when -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on
is used (https://reviews.llvm.org/D107799#2969650).

  • -isystem path/to/build/generic-cxx17/include/c++/v1. build/generic-cxx17/include/x86_64-unknown-linux-gnu/c++/v1 (__config_site) is missing.
  • -L path/to/build/generic-cxx17/lib. Should be build/generic-cxx17/lib/x86_64-unknown-linux-gnu instead

Diff Detail

Event Timeline

MaskRay created this revision.Aug 27 2021, 12:30 PM
MaskRay requested review of this revision.Aug 27 2021, 12:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2021, 12:30 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
MaskRay updated this revision to Diff 369161.Aug 27 2021, 12:32 PM

drop unrelated libcxx/utils/ci/run-buildbot change

phosek accepted this revision.Aug 27 2021, 2:42 PM

LGTM

ldionne requested changes to this revision.Aug 30 2021, 10:52 AM

I'm somewhat concerned that we need to include two directories to properly handle libc++ here. I would prefer if we only needed to add build/generic-cxx17/include/x86_64-unknown-linux-gnu/c++/v1, i.e. the target-specific directory. Adding two directories is a change from how we've always done things in libc++. @phosek Was it intended that folks wouldn't be able to use libc++ without providing two include paths going forward?

Apart from that concern, the patch LGTM. Marking as "request changes" until we've resolved that.

This revision now requires changes to proceed.Aug 30 2021, 10:52 AM
MaskRay added a comment.EditedAug 30 2021, 11:02 AM

I'm somewhat concerned that we need to include two directories to properly handle libc++ here. I would prefer if we only needed to add build/generic-cxx17/include/x86_64-unknown-linux-gnu/c++/v1, i.e. the target-specific directory. Adding two directories is a change from how we've always done things in libc++. @phosek Was it intended that folks wouldn't be able to use libc++ without providing two include paths going forward?

Apart from that concern, the patch LGTM. Marking as "request changes" until we've resolved that.

I am not the designer, but I think two trees make sense to me.

Most headers are generic and sharable by all targets, therefore they are under include/c++/v1.
__config_site is target dependent and therefore under include/x86_64-unknown-linux-gnu/c++/v1.

Say we want to support -m32 in the same build (multiarch), we can use: include/i386-unknown-linux-gnu/c++/v1

FWIW this hierarchy also resembles libstdc++, though it places x86_64-glibc-linux-gnu in the last path component:

#include <...> search starts here:
 /tmp/glibc-many/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/10.2.1/../../../../x86_64-glibc-linux-gnu/include/c++/10.2.1
 /tmp/glibc-many/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/10.2.1/../../../../x86_64-glibc-linux-gnu/include/c++/10.2.1/x86_64-glibc-linux-gnu
 /tmp/glibc-many/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/10.2.1/../../../../x86_64-glibc-linux-gnu/include/c++/10.2.1/backward

@ldionne having to use two directories is not great from the usability perspective, but it is the most efficient solution because you can separate target-independent and target-specific headers and avoid any duplication. In practice, this should be handled by the compiler driver and so most developers shouldn't notice any difference, it's only the scripts and build systems that manage headers manually which should be uncommon.

ldionne accepted this revision.Aug 30 2021, 12:54 PM
This revision is now accepted and ready to land.Aug 30 2021, 12:54 PM