Build failure on Apple Silicon M1 Mac Mini

Hi,

I'm seeing a build failure on an Apple Silicon Mac Mini that I'm not seeing on my Intel MacBook Pro. (Both checkouts are on the same git hash)

I pulled the build command from the getting started docs and then removed --test. (I saw that as a possible solution, but unfortunately it didn't help):

utils/build-script --skip-build-benchmarks \
  --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
  --sccache --release-debuginfo --swift-disable-dead-stripping \
  --xcode

The build error I'm getting is:

Libtool /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/Swift.build/RelWithDebInfo/swiftLLVMSupport-macosx-x86_64.build/libswiftLLVMSupport-macosx-x86_64.a normal (in target 'swiftLLVMSupport-macosx-x86_64' from project 'Swift')
    cd /Users/home/Developer/swift-source/swift
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -D -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -L/Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/Swift.build/RelWithDebInfo/swiftLLVMSupport-macosx-x86_64.build -filelist /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/Swift.build/RelWithDebInfo/swiftLLVMSupport-macosx-x86_64.build/Objects-normal/arm64/swiftLLVMSupport-macosx-x86_64.LinkFileList -dependency_info /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/Swift.build/RelWithDebInfo/swiftLLVMSupport-macosx-x86_64.build/Objects-normal/arm64/swiftLLVMSupport-macosx-x86_64_libtool_dependency_info.dat -o /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/Swift.build/RelWithDebInfo/swiftLLVMSupport-macosx-x86_64.build/libswiftLLVMSupport-macosx-x86_64.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no library created (no object files in input files matching -arch_only arm64)

I find it odd that it's trying to build x86_64 components. Is there something I need to add to my build command to prevent this from happening on an M1 Mac?

Here are some other stats that may be useful to know:
Xcode 12.4
macOS 11.2.1
sccache 0.2.13
cmake 3.19.1
python3 3.9.0

Thanks for the help

Does making a --clean build helps?
If not that may be a problem on build-script

cc @Varun_Gandhi

No luck with --clean unfortunately

Not sure if this will solve your problem, but it resolved some of the errors I was getting on the M1. Right click on the Xcode application in your Applications folder and click 'Get Info' and check the box for 'Open using Rosetta'.

Same error with Xcode on rosetta

I've found a possible problem. Python's platform.machine() returns x86_64, and so does uname -m

1 Like

I think I've solved it. I was running the command under tmux, which I believe was running under rosetta. When I run those commands from the bare metal terminal, they return arm64. Starting a new build now to test

2 Likes

Build succeeded! Should we add a disclaimer to the getting started doc about using tools like tmux?

EDIT: This may stem from having installed homebrew before it was optimized for apple silicon. I'm troubleshooting that now

Yep, it was homebrew! I had installed homebrew under rosetta, so then all of its installations happened under rosetta as well.

I'm not sure this warrants any sort of documentation change, but that was a fun debug chain :)

For those visiting this thread in the future:

  1. Make sure python is running natively.
  2. Make sure the terminal you're using (i.e., iTerm) isn't running via Rosetta.
2 Likes
Terms of Service

Privacy Policy

Cookie Policy