This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Fix running tests on macOS when XCode is not installed
ClosedPublic

Authored by arichardson on Jul 26 2019, 1:35 AM.

Details

Summary

If XCode is not installed, xcodebuild -version -sdk macosx Path will give
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
In this case the variable OSX_SYSROOT will be empty and
OSX_SYSROOT_FLAG is set to "-isysroot" (without a path).
This then causes the CompilerRTUnitTestCheckCxx target failed to for me
because "${COMPILER_RT_TEST_COMPILER} ${OSX_SYSROOT_FLAG} -E" expanded to
"clang -isysroot -E". This results in a warning "sysroot -E does not exist"
and the target fails to run because the C++ headers cannot be found.

Diff Detail

Repository
rL LLVM

Event Timeline

arichardson created this revision.Jul 26 2019, 1:35 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 26 2019, 1:35 AM
Herald added subscribers: llvm-commits, Restricted Project, mgorny. · View Herald Transcript
arichardson edited the summary of this revision. (Show Details)Jul 26 2019, 1:51 AM
beanz added inline comments.Jul 26 2019, 9:21 AM
compiler-rt/cmake/base-config-ix.cmake
104 ↗(On Diff #211893)

Might as well just call xcrun always instead. I think really old versions of xcrun don't support this flag, but I doubt that is a problem worth worrying about.

Always use xcrun

arichardson retitled this revision from If XCode is not installed, `xcodebuild -version -sdk macosx Path` will give xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance In this case... to [compiler-rt] Fix running tests on macOS when XCode is not installed.Jul 26 2019, 12:52 PM
arichardson edited the summary of this revision. (Show Details)
beanz accepted this revision.Jul 26 2019, 2:08 PM

LGTM.

This revision is now accepted and ready to land.Jul 26 2019, 2:08 PM
This revision was automatically updated to reflect the committed changes.