This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Make libcxx(abi) a dependency when building in-tree clang for macOS
ClosedPublic

Authored by JDevlieghere on Dec 18 2018, 9:59 AM.

Details

Summary

As discussed on IRC this morning, when building an in-tree clang for testing we have to have libcxx and libcxxabi checked out. This is a common pitfall that manifests that is non-obvious and manifests itself only after building when running the test suite.

Diff Detail

Event Timeline

JDevlieghere created this revision.Dec 18 2018, 9:59 AM

How does this affect platforms that use other ABI library than libcxxabi? How does this affect platforms that use libstdc++ as default C++ backend?

How does this affect platforms that use other ABI library than libcxxabi? How does this affect platforms that use libstdc++ as default C++ backend?

I'm not familiar with that use case myself, so I might be able to give a better answer if I understand how that works today. I think it wouldn't change anything other than that the target has to be present.

labath added a subscriber: labath.Dec 18 2018, 10:21 AM

On linux libc++ is not a hard dependency for running tests (in fact, clang will not use it even if it is checked out). I guess that has something to do with the fact that libc++ is not the default c++ implementation on that platform. I think this will need to be darwin-only or something like that.

JDevlieghere retitled this revision from [cmake] Make libcxx(abi) a dependency when building in-tree clang to [cmake] Make libcxx(abi) a dependency when building in-tree clang for macOS.

Only do this for macOS

On linux libc++ is not a hard dependency for running tests (in fact, clang will not use it even if it is checked out). I guess that has something to do with the fact that libc++ is not the default c++ implementation on that platform. I think this will need to be darwin-only or something like that.

I didn't know, cool, then that solves both issues.

aprantl accepted this revision.Dec 18 2018, 11:50 AM
This revision is now accepted and ready to land.Dec 18 2018, 11:50 AM
This revision was automatically updated to reflect the committed changes.
clayborg added inline comments.Dec 18 2018, 1:05 PM
CMakeLists.txt
160

What if the user wants to use a different compiler for tests? cmake has LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER which can supposedly be set.

JDevlieghere marked 2 inline comments as done.Dec 18 2018, 1:08 PM
JDevlieghere added inline comments.
CMakeLists.txt
160

That still works. The change says that *if* you are going to build the in-tree clang, it has to build libcxx(abi) too. That should always make sense, because clang (on Darwin) won't be able to find the standard library otherwise.