Build failure on Apple Silicon M1 Mac Mini


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 \

The build error I'm getting is:

Libtool /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/ normal (in target 'swiftLLVMSupport-macosx-x86_64' from project 'Swift')
    cd /Users/home/Developer/swift-source/swift
    /Applications/ -static -arch_only arm64 -D -syslibroot /Applications/ -L/Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/ -filelist /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/ -dependency_info /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/ -o /Users/home/Developer/swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/LLVMSupport/
error: /Applications/ 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


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.
Terms of Service

Privacy Policy

Cookie Policy