This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Redo adding support for building and testing with an ABI library not along linker paths
ClosedPublic

Authored by EricWF on Oct 18 2014, 5:11 PM.

Details

Summary

This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used CMAKE_LIBRARY_PATH and find_library to select which ABI library should be used. There were a number of problems with this approach:

  • find_library didn't work with cmake targets (ie in-tree libcxxabi build)
  • It wasn't always possible to determine where find_library actually found your library.
  • target_link_libraries inserted the path of the ABI library into libc++'s RPATH when find_library was used.
  • Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple.

After discussion with @cbergstrum a new approach was decided upon.
This patch achieve the same ends by simply using LIBCXX_CXX_ABI_LIBRARY_PATH to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 15124.Oct 18 2014, 5:11 PM
EricWF retitled this revision from to [libcxx] Redo adding support for building and testing with an ABI library not along linker paths.
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added a subscriber: Unknown Object (MLST).
chandlerc accepted this revision.Oct 18 2014, 5:33 PM
chandlerc added a reviewer: chandlerc.
chandlerc added a subscriber: chandlerc.

LGTM (I'm familiar with the CMake side of things, so happy to provide the review)

I think the real advantage of this is the improvement for an in-tree build. We could make find_library work for other cases even though its hard. But this is much nicer with the in-tree stuff.

This revision is now accepted and ready to land.Oct 18 2014, 5:33 PM
danalbert accepted this revision.Oct 18 2014, 5:51 PM
danalbert edited edge metadata.

LGTM.

EricWF closed this revision.Oct 18 2014, 5:53 PM