Build Swift Error: using unsupported Xcode version

I'm trying to build Swift, I am on Big Sur and have both Xcode 12.5 and Xcode 13 Beta installed.
I got this error when building, is it possible to tell the script to use the Xcode 13 Beta instead of the unsupported 12.5?

utils/build-script --verbose-build --skip-build-benchmarks \

--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \--sccache --release-debuginfo --swift-disable-dead-stripping --test \

--xcode --skip-test-cmark

error: using unsupported Xcode version:

Xcode 12.5.1

Build version 12E507

Install one of:

12.3 (12C33)

12.4 (12D4e)

12.5 (12E262)

13.0 beta (13A5154h)

You can prepend an environment variable to your command line:

  • env SKIP_XCODE_VERSION_CHECK=1 utils/build-script [...] to use Xcode 12.5.1, or

  • env DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer utils/build-script [...] to use Xcode 13 beta.

2 Likes

Thank you so much for the solution. That worked. But I now face another build error. The build script succeeded and I was able to open the xcode project. But when I try a subsequent build with command+B on the swift-frontend scheme, it give me this error:


Do you have any suggestions?

1 Like

I suggest using Ninja instead of Xcode (by omitting the --xcode flag) because it's the tried-and-tested build system for this project.

You can still use Xcode to edit and commit changes, by creating an empty xcworkspace (File → New → Workspace) inside the "swift-project" directory, and adding a folder reference (File → Add Files…) of the "swift-project/swift" directory.

Thanks for the recommendation, I will try using Ninja build on Linux or macOS.

And since you said:

and adding a folder reference (File → Add Files…) of the "swift-project/swift" directory.

That must explain why I see a completely different file structure when I open the generated Xcode project, which contains the content of folder swift-macos-x86_64. But the actual codebase is contained and referenced from the Xcode project to the swift-project/swift directory right?

Tried using Ninja. Still failing build:

[173/185] Linking CXX static library lib/libswiftSIL.a
FAILED: lib/libswiftSIL.a 
: && /usr/local/Cellar/cmake/3.20.4/bin/cmake -E rm -f lib/libswiftSIL.a && /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar crs lib/libswiftSIL.a  lib/SIL/CMakeFiles/swiftSIL.dir/SIL.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/AbstractionPattern.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/ApplySite.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/Bridging.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/Linker.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/Notifications.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/OperandOwnership.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SIL.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILArgument.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILBasicBlock.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILBuilder.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILConstants.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILCoverageMap.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILDebugScope.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILDeclRef.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILDefaultWitnessTable.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILDifferentiabilityWitness.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILFunction.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILFunctionBuilder.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILFunctionType.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILGlobalVariable.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILInstruction.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILInstructions.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILLocation.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILModule.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILPrinter.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILProfiler.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILSuccessor.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILType.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILUndef.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILVTable.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILValue.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/SILWitnessTable.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/TypeLowering.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/IR/ValueOwnership.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/BasicBlockUtils.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/BitDataflow.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/DebugUtils.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/Dominance.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/DynamicCasts.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/GenericSpecializationMangler.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/InstructionUtils.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/LoopInfo.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/MemAccessUtils.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/MemoryLocations.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/OptimizationRemark.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/OwnershipUtils.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/PrettyStackTrace.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/Projection.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/SILBridging.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/SILInstructionWorklist.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/SILRemarkStreamer.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Utils/ValueUtils.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/DebugInfoVerifier.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/LoadBorrowImmutabilityChecker.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/LinearLifetimeChecker.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/MemoryLifetimeVerifier.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/ReborrowVerifier.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/SILOwnershipVerifier.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Verifier/SILVerifier.cpp.o lib/SIL/CMakeFiles/swiftSIL.dir/Parser/ParseSIL.cpp.o && /usr/local/Cellar/cmake/3.20.4/bin/cmake -E touch lib/libswiftSIL.a && :
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive member: lib/libswiftSIL.a(Linker.cpp.o) size too large (archive member extends past the end of the file)
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar: internal ranlib command failed
ninja: build stopped: subcommand failed.
1 Like

I don't know why ranlib is failing.

Support for Xcode 13 is a work in progress: apple/swift#38109.

You could try Xcode 12.5 (add the --reconfigure or --clean flag, when building for the first time).

You may also wish to exclude "swift-project" or "swift-project/build" from Time Machine backups.

Terms of Service

Privacy Policy

Cookie Policy