This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Allow tests to link with static libc++abi/libc++ even if the shared version is present
ClosedPublic

Authored by broadwaylamb on Jan 14 2020, 2:10 AM.

Details

Summary

This is essentially D71894, but for libc++.

This is needed for running libc++ tests over SSH.

Diff Detail

Event Timeline

broadwaylamb created this revision.Jan 14 2020, 2:10 AM
phosek added inline comments.Jan 14 2020, 4:57 PM
libcxx/CMakeLists.txt
80 ↗(On Diff #237892)

Have you considered using cmake_dependent_option? That way you don't need to do the validation below yourself.

broadwaylamb planned changes to this revision.Jan 30 2020, 4:30 AM

I'm going to update this to be consistent with D71894.

Update to match D71894.

Tested with:

  • native macOS toolchain, linking against the system libc++abi and just-built libc++.
  • cross-toolchain (Windows -> ARM Linux), linking against the just-built libc++abi and libc++.
Herald added a reviewer: Restricted Project. · View Herald TranscriptMar 13 2020, 10:00 AM
phosek accepted this revision.Mar 16 2020, 8:21 PM

LGTM

@ldionne can I get your LGTM as well?

ldionne accepted this revision.Mar 23 2020, 2:13 PM

FWIW, I'm working on a refactoring of the way we configure lit that should get rid of pretty much all testing logic inside libc++ and libc++abi's CMake files. So I'm OK with this change if it helps you right now, however if what I'm working on works well, we'll get rid of it.

This revision is now accepted and ready to land.Mar 23 2020, 2:13 PM
This revision was automatically updated to reflect the committed changes.

This broke CMake configuration with the following set of arguments: -DLLVM_ENABLE_PROJECTS=libcxx -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC=OFF -DLIBCXX_INCLUDE_TESTS=OFF. Fixed in:

commit b58902bc72c2b479b5ed27ec0d3422ba9782edbb
Author: Louis Dionne <ldionne@apple.com>
Date:   Wed Mar 25 16:50:19 2020 -0400

    [libc++] Fix CMake configuration breakage when libc++ is built neither static nor dynamic

    Introduced by https://reviews.llvm.org/D72687. This condition can happen
    when the tests are not being run at all, and we're only trying to generate
    the libc++ headers.