This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Disable building all Darwin libraries (except builtins) for macOS i386 when the SDK is >= 10.15.
ClosedPublic

Authored by delcypher on Oct 1 2019, 12:53 PM.

Details

Summary

In the macOS 10.15 SDK the ability to link i386 binaries was removed and
in the corresponding OS it is not possible to run macOS i386 binaries.

The consequence of these changes meant that targets like check-asan
would fail because:

  • Unit tests could not be linked for i386
  • Lit tests for i386 would fail due to not being able to execute compiled binaries.

The simplest fix to this is to simply disable building for i386 for
macOS when using the 10.15 SDK (or newer). This disables building the
i386 slice for most compiler-rt libraries and consequently disables the
unit and lit tests for macOS i386.

Note that because the DARWIN_osx_ARCHS CMake variable is a cache
variable this patch will have no affect on existing builds unless
the existing cache variable is deleted. The simplest way to deal with
this is delete existing builds and just do a fresh configure.

Note this should not affect the builtins which are managed with
the DARWIN_osx_BUILTIN_ARCHS CMake cache variable.

For those who wish to force using a particular set of architectures when
using newer SDKs passing -DDARWIN_osx_ARCHS=i386;x86_64;x86_64h to
CMake should provide a usable (but completely unsupported) workaround.

rdar://problem/55668535
rdar://problem/47939978

Diff Detail

Event Timeline

delcypher created this revision.Oct 1 2019, 12:53 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 1 2019, 12:53 PM
Herald added subscribers: Restricted Project, mgorny. · View Herald Transcript

I'm including so many reviewers here because this affects anyone who ships a Clang toolchain that wishes to target macOS i386.

vitalybuka resigned from this revision.Oct 9 2019, 2:39 PM
yln accepted this revision.Oct 9 2019, 4:00 PM

I confirmed that ninja check-asan works with this patch on my macOS 10.15 machine.

This revision is now accepted and ready to land.Oct 9 2019, 4:00 PM
This revision was automatically updated to reflect the committed changes.

@yln Thanks for the review!

This breaks the build for me. I don't have XCode installed. Can we get the same information using xcrun instead?

$ xcrun --show-sdk-version
10.14.6

This broke cross-compilation from Linux for us, since we don't have xcodebuild/xcrun . We currently build with

CMAKE_FLAGS="-DDARWIN_macosx_CACHED_SYSROOT:STRING=/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root"

export MACOSX_DEPLOYMENT_TARGET=10.9
export LDFLAGS=-mmacosx-version-min=10.9

I would be happy to provide a -DDARWIN_macosx_CACHED_SDKVERSION