This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] PR26777 Fix tests when built with CXX="ccache clang++"
AbandonedPublic

Authored by hintonda on Feb 29 2016, 1:46 PM.

Details

Summary

If you use ccache to build libcxx by setting CXX="ccache
clang++", check-libcxx will fail since LIBCXX_COMPILER will be set to
"ccache".

We can't just include CMAKE_CXX_COMPILER_ARG1 because of a python
parsing issue, so the best we can do right now is to use
CMAKE_CXX_COMPILER_ARG1 if it exists, and CMAKE_CXX_COMPILER if it
doesn't.

Diff Detail

Event Timeline

hintonda updated this revision to Diff 49415.Feb 29 2016, 1:46 PM
hintonda retitled this revision from to [libcxx] PR26777 Fix tests when built with CXX="ccache clang++".
hintonda updated this object.
hintonda added a reviewer: mclow.lists.
hintonda added a subscriber: cfe-commits.
EricWF requested changes to this revision.Apr 15 2016, 6:16 PM
EricWF edited edge metadata.

I appreciate the patch, handling 'ccache' is a good thing to have. I'll look at this again once the inline comment is addressed.

CMakeLists.txt
225

What if somebody uses CXX='clang++ --foo'. It seems incorrect to handle ccache in this way. Instead I would rather we

  1. Check if 'ARG1' is present.
  2. If so attempt to find the string 'ccache' within 'CMAKE_CXX_COMPILER'
  3. Only if we manage to match it do we use 'CMAKE_CXX_COMPILER_ARG1' as 'LIBCXX_COMPILER'.
This revision now requires changes to proceed.Apr 15 2016, 6:16 PM
hintonda abandoned this revision.Apr 17 2016, 12:03 PM

If *_COMPILER_ARG1 is set, then it shall be the compiler, and the value for CMAKE_<LANG>_COMPILER may be ccache, but could also be something else, e.g., distcc, etc. Therefore, I don't see a clean way to check it.

However, newer versions of cmake have abandoned the *_COMPILER_ARG1 solutions and set CMAKE_<LANG>_COMPILER to the real compiler and use a new variable, CMAKE_<LANG>_COMPILER_LAUNCHER for ccache, distcc, etc..

So the solution is just to upgrade to the newest version of cmake if you want to use ccache, etc...

OK. Thanks for the update. Sorry we couldn't land this.