This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Install C++ ABI headers into the right location
ClosedPublic

Authored by phosek on Jul 19 2018, 6:38 PM.

Details

Summary

This is a follow-up to r335809 and r337118. While libc++ headers are now installed into the right location in both standard as well as multiarch runtimes layout, turned out C++ ABI headers are still installed into the old location in the latter case. This change addresses that.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Jul 19 2018, 6:38 PM

This change LGTM. However, I do have a question about the overall change (including r335809 and r337118). Why is it that we're not simply relying on the CMAKE_INSTALL_PREFIX being set to the path where we should install instead of using all these custom variables like LIBCXX_INSTALL_HEADER_PREFIX? I'm curious to understand what's special about your use case, since it does seem like we're doing things differently in a few places for Fuchsia.

phosek added a subscriber: beanz.Jul 20 2018, 12:21 PM

We currently support two different layouts:

  1. The standard layout (for a lack of a better name) which is used when libc++ is built standalone as well as being built as part of LLVM without any other options which is $DESTDIR/include/c++/v1 for headers and $DESTDIR/lib for libraries. Clang driver knows where to find those headers and libraries when libc++ is selected, the problem is that this only works for the default target since there's going to be just a single copy of $DESTDIR/lib/libc++.so, etc.
  2. The mutliarch runtime layout where headers are installed to $DESTDIR/lib/clang/$CLANG_VERSION/include/c++/v1 and libraries to $DESTDIR/lib/clang/$CLANG_VERSION/$TARGET/lib where $TARGET is the target passed to Clang, e.g. --target=x86-linux-gnu. This layout supports distributing libc++ (and other runtimes) for multiple different targets with your toolchain. The reason we cannot use the same prefix for both headers and libraries is the multiarch runtime layout since headers and libraries are installed to different paths.

Fuchsia is currently the first toolchain that AFAIK uses the new layout for its toolchain, but @beanz is working on using this layout also for Darwin. Android team also expressed interest in using the new layout since they need to support multiple targets in their toolchain.

This revision was not accepted when it landed; it landed in state Needs Review.Jul 20 2018, 3:51 PM
This revision was automatically updated to reflect the committed changes.