I'm not sure why, but it seems my Xcode project is trying to build for x86 (on my M1 Mac), even though both Debug and Release configurations have ONLY_ACTIVE_ARCH = YES. It's clearly trying to build for x86, as evidenced by the -target x86_64-apple-macos13.0
in the invocation. But I can't figure out why.
The full link stage output:
Ld /Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Products/Debug/MyProject.app/Contents/MacOS/MyProject normal (in target 'MyProject' from project 'MyProject')
cd /Users/me/Projects/MyProject
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos13.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk -L/Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Intermediates.noindex/EagerLinkingTBDs -L/Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Products/Debug -L/opt/homebrew/opt/llvm/lib -F/Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Intermediates.noindex/EagerLinkingTBDs -F/Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Products/Debug -filelist /Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Intermediates.noindex/MyProject.build/Debug/MyProject.build/Objects-normal/x86_64/MyProject.LinkFileList -dead_strip -Xlinker -object_path_lto -Xlinker /Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Intermediates.noindex/MyProject.build/Debug/MyProject.build/Objects-normal/x86_64/MyProject_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -framework Cocoa -lcurses -lLLVMAnalysis -lLLVMBitReader -lLLVMCodeGen -lLLVMCore -lLLVMExecutionEngine -lLLVMMC -lLLVMObject -lLLVMRuntimeDyld -lLLVMScalarOpts -lLLVMSelectionDAG -lLLVMSupport -lLLVMTarget -lLLVMTransformUtils -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lz -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Intermediates.noindex/MyProject.build/Debug/MyProject.build/Objects-normal/x86_64/MyProject_dependency_info.dat -o /Users/me/Library/Developer/Xcode/DerivedData/MyProject-fbzxsemlztqkmsgdutlriortdmmd/Build/Products/Debug/MyProject.app/Contents/MacOS/MyProject
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMAnalysis.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMBitReader.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMCore.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMExecutionEngine.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMCodeGen.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMMC.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMRuntimeDyld.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMObject.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMX86Info.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMTarget.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMSupport.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMScalarOpts.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMSelectionDAG.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMTransformUtils.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMX86CodeGen.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/llvm/lib/libLLVMX86Desc.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: in '/opt/homebrew/opt/llvm/lib/libunwind.dylib', building for macOS-x86_64 but attempting to link with file built for macOS-arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I change the ARCHS to just arm64, then it builds fine.