This is an archive of the discontinued LLVM Phabricator instance.

Fix compiler-rt build on macOS without XCode
ClosedPublic

Authored by arichardson on Oct 30 2019, 2:01 AM.

Details

Summary

Starting with 8a5bfbe6db2824642bf9a1d27a24c5b6132b244f (D68292) this file
unconditionally uses xcodebuild to get the SDK version. On my system this
always fails with
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Diff Detail

Event Timeline

arichardson created this revision.Oct 30 2019, 2:01 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 30 2019, 2:01 AM
Herald added subscribers: llvm-commits, Restricted Project, mgorny, dberris. · View Herald Transcript
yln added a comment.EditedOct 30 2019, 11:35 AM

@delcypher: would xcrun --sdk ${sdk_name} --show-sdk-version work in all cases? If yes, we could use it instead of xcodebuild.

LGTM otherwise.

compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
10

Would this function benefit from a similar change?

71

Nitpick: indent not consistent with other occurences.

delcypher requested changes to this revision.Oct 30 2019, 4:31 PM
delcypher added inline comments.
compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
10

Yes we should but perhaps as a separate patch?

52

I would just replace all the xcodebuild commands in find_darwin_sdk_version with xcrun --sdk ${sdk_name} --show-sdk-version.

This revision now requires changes to proceed.Oct 30 2019, 4:31 PM
In D69610#1727552, @yln wrote:

@delcypher: would xcrun --sdk ${sdk_name} --show-sdk-version work in all cases? If yes, we could use it instead of xcodebuild.

LGTM otherwise.

@yln I think so.

Use xcrun instead of xcodebuild

arichardson marked 2 inline comments as done.Oct 31 2019, 4:32 AM

As I don't have XCode installed, it would be great if someone who does can confirm that this still works as expected.

arichardson marked 3 inline comments as done.Oct 31 2019, 4:42 AM
arichardson added inline comments.
compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
10

See D69659

yln accepted this revision.EditedOct 31 2019, 9:59 AM

Applied it locally, ninja check-asan still works after rm -rf projects/compiler-rt. Thanks Alexander!

delcypher accepted this revision.Oct 31 2019, 1:42 PM

LGTM. Thanks for the patch.

This revision is now accepted and ready to land.Oct 31 2019, 1:42 PM