Unable to build Swift

Hey everyone, I've been trying to build Swift from source for several days now without much luck. Any help or suggestions would be greatly appreciated. Thanks!

I have tried building on MacOS 10.15.5 with Xcode and with Ninja, using various combinations of the following:

Xcode Command Line Tools: -- 11.5 (11E608c) and 12.0 Beta (12A6159)
Swift Versions: (swift-5.2.4-RELEASE and swift-5.2-RELEASE)

When attempting to build with Xcode, I get the following errors:

**** BUILD FAILED ****

The following build commands failed:

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/AST/LLVM.build/Debug/StmtDataCollectors.build/Script-DC2AFA1E7C3946E9B1EC4AD8.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Basic/LLVM.build/Debug/ClangDiagnosticLex.build/Script-71EC3DA510934C9F83A7AFC8.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/AST/LLVM.build/Debug/ClangAttrClasses.build/Script-C97917A3C9E64723BD5D8ACD.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Basic/LLVM.build/Debug/ClangDiagnosticCommon.build/Script-05AAC6A592CB4D909F61EBE3.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Serialization/LLVM.build/Debug/ClangAttrPCHWrite.build/Script-10FB28EBE83B4D138D2B0F11.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Basic/LLVM.build/Debug/ClangDiagnosticSerialization.build/Script-D69D2A3C258746A6AF7EAD50.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Basic/LLVM.build/Debug/ClangARMMveBuiltinAliases.build/Script-6CAE68D3FE444CE8AAD8295D.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/AST/LLVM.build/Debug/ClangCommentNodes.build/Script-71E0E10783434D529508296E.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Parse/LLVM.build/Debug/ClangAttrParserStringSwitches.build/Script-A8B49009CCAA42989380EF3B.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/lib/Headers/LLVM.build/Debug/clang-resource-headers.build/Script-0FB049EF848245A4847367ED.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Sema/LLVM.build/Debug/ClangAttrParsedAttrList.build/Script-BE8B1AB94EAE4F7787369DC6.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/AST/LLVM.build/Debug/ClangCommentCommandList.build/Script-7EB71BF2FC654542AC931D00.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Sema/LLVM.build/Debug/ClangAttrParsedAttrKinds.build/Script-839C3A21A4D348D3A5BCB77A.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/Basic/LLVM.build/Debug/ClangAttrSubjectMatchRuleList.build/Script-5FD4DF5007504FA89B728A1B.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/tools/clang/include/clang/AST/LLVM.build/Debug/ClangCommentHTMLNamedCharacterReferences.build/Script-B0AADB99897F41648FEF452D.sh

**PhaseScriptExecution** CMake\ Rules /Users/.../Documents/Repos/swift-source/build/Xcode-DebugAssert/llvm-macosx-x86_64/include/llvm/IR/LLVM.build/Debug/intrinsics_gen.build/Script-E1647114C8B34E6AA59482B0.sh

(16 failures)

utils/build-script: fatal error: command terminated with a non-zero exit status 65, aborting

When attempting to build with Ninja, I get the following errors:

FAILED: include/llvm/IR/IntrinsicImpl.inc 

cd /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64 && /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/llvm-tblgen -gen-intrinsic-impl -I /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include/llvm/IR -I /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include/llvm/IR/Intrinsics.td --write-if-changed -o include/llvm/IR/IntrinsicImpl.inc -d include/llvm/IR/IntrinsicImpl.inc.d

/bin/sh: /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/llvm-tblgen: Input/output error

[491/3823][ 12%][83.254s] Building IntrinsicsXCore.h...

FAILED: include/llvm/IR/IntrinsicsXCore.h 

cd /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64 && /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/llvm-tblgen -gen-intrinsic-enums -intrinsic-prefix=xcore -I /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include/llvm/IR -I /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include/llvm/IR/Intrinsics.td --write-if-changed -o include/llvm/IR/IntrinsicsXCore.h -d include/llvm/IR/IntrinsicsXCore.h.d

/bin/sh: /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/llvm-tblgen: Input/output error

[492/3823][ 12%][83.254s] Building Attributes.inc...

FAILED: include/llvm/IR/Attributes.inc 

cd /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64 && /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/llvm-tblgen -gen-attrs -I /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include/llvm/IR -I /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include /Users/.../Documents/Repos/swift-source/llvm-project/llvm/include/llvm/IR/Attributes.td --write-if-changed -o include/llvm/IR/Attributes.inc -d include/llvm/IR/Attributes.inc.d

/bin/sh: /Users/.../Documents/Repos/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/llvm-tblgen: Input/output error

[505/3823][ 13%][85.991s] Building CXX object lib/DebugInfo/Symbolize/CMakeFiles/LLVMSymbolize.dir/Symbolize.cpp.o

ninja: build stopped: subcommand failed.

utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

Here is how I build swift, may be you could try this.

brew install cmake ninja
mkdir swift-source/
git clone --branch swift-5.2-RELEASE git@github.com:apple/swift.git
./swift/utils/update-checkout --clone-with-ssh
./swift/utils/update-checkout --tag swift-5.2-RELEASE
./swift/utils/build-script --clean --xcode --release-debuginfo --debug-swift

Thanks @byaruhaf. I'll give that a try. The build command I was using is: utils/build-script --debug --xcode --clean

That should also work, important part for me was the branch swift-5.2-RELEASE

Terms of Service

Privacy Policy

Cookie Policy