Compiler build failing

I followed the Getting Started document as mentioned in the GitHub docs and when running the actual build command I am getting this error:

% utils/build-script --skip-build-benchmarks \
  --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "x86_64" \
  --sccache --release-debuginfo --test
[utils/build-script] NOTE: Using toolchain default
+ /usr/libexec/PlistBuddy -c 'Print :SupportedTargets:macosx:Archs' /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/SDKSettings.plist
+ mkdir -p /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert
Building the standard library for: swift-test-stdlib-macosx-x86_64
Running Swift tests for: check-swift-macosx-x86_64
+ /usr/local/bin/cmake --build /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/cmark-macosx-x86_64 -- -j16 all
ninja: no work to do.
symlinking the system headers (/Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++) into the local clang build directory (/Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/include).
+ ln -s -f /Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++ /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/include
+ /usr/local/bin/cmake --build /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64 -- -j16 all
ninja: no work to do.
copying compiler-rt embedded builtins from /Library/Developer/CommandLineTools/usr/bin/../lib/clang/12.0.0/lib/darwin into the local clang build directory /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/bin/../lib/clang/10.0.0/lib/darwin.
+ /usr/local/bin/cmake --build /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64 -- -j16 all swift-test-stdlib-macosx-x86_64
[3/15][ 20%][0.597s] Linking CXX shared library lib/swift/macosx/x86_64/libswiftStdlibUnittest.dylib
ld: warning: directory not found for option '-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../../../Developer/Library/Frameworks'
[5/15][ 33%][0.682s] Linking CXX shared library lib/swift/macosx/x86_64/libswiftRuntimeUnittest.dylib
ld: warning: directory not found for option '-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../../../Developer/Library/Frameworks'
[6/15][ 40%][0.751s] Linking CXX shared library lib/swift/macosx/x86_64/libswiftStdlibUnittestFoundationExtras.dylib
ld: warning: directory not found for option '-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../../../Developer/Library/Frameworks'
[8/15][ 53%][0.764s] Linking CXX shared library lib/swift/macosx/x86_64/libswiftDifferentiationUnittest.dylib
ld: warning: directory not found for option '-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../../../Developer/Library/Frameworks'
[11/15][ 73%][0.845s] Generating /Users/fatpanda/code/swift/swift-project/b...sx-x86_64/./lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftmodule
FAILED: lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftmodule lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftdoc lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftinterface 
cd /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest && /usr/local/Cellar/cmake/3.18.4/bin/cmake -E remove -f /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftmodule /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftdoc /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftinterface && /usr/local/Cellar/cmake/3.18.4/bin/cmake -E make_directory /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx/XCTest.swiftmodule && /Library/Developer/CommandLineTools/usr/bin/python3 /Users/fatpanda/code/swift/swift-project/swift/utils/line-directive @/Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest/e80a9083717e28b40af2a396b463c9572d16e1da.txt -- /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./bin/swiftc -emit-module -o /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftmodule -avoid-emit-module-source-info -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -target x86_64-apple-macosx10.9 -resource-dir /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift -F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../../../Developer/Library/Frameworks -O -g -D INTERNAL_CHECKS_ENABLED -D SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -D SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING -D SWIFT_RUNTIME_OS_VERSIONING -module-cache-path /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./module-cache -no-link-objc-runtime -enable-library-evolution -Xfrontend -enforce-exclusivity=unchecked -module-name XCTest -swift-version 5 -swift-version 5 -autolink-force-load -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements -warn-swift3-objc-inference-complete -Xfrontend -verify-syntax-tree -Xfrontend -module-interface-preserve-types-as-written -warn-implicit-overrides -Fsystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/ -module-link-name swiftXCTest -whole-module-optimization -save-optimization-record=bitstream -parse-as-library -I /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx -emit-module-interface-path /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx/XCTest.swiftmodule/x86_64-apple-macos.swiftinterface -Xfrontend -experimental-skip-non-inlinable-function-bodies @/Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest/e80a9083717e28b40af2a396b463c9572d16e1da.txt
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:24:19: error: underlying Objective-C module 'XCTest' not found
@_exported import XCTest // Clang module
                  ^
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:31:11: error: cannot find type 'XCTContext' in scope
extension XCTContext {
          ^~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:54:11: error: cannot find type 'XCUIElement' in scope
extension XCUIElement {
          ^~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:73:46: error: cannot find type '_XCTAssertionType' in scope
func _XCTFailureDescription(_ assertionType: _XCTAssertionType, _ formatIndex: Int, _ expressionStrings: CVarArg...) -> String {
                                             ^~~~~~~~~~~~~~~~~
[12/15][ 80%][1.076s] Compiling /Users/fatpanda/code/swift/swift-project/bu...InfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest/OSX/x86_64/XCTest.o
FAILED: stdlib/public/Darwin/XCTest/OSX/x86_64/XCTest.o 
cd /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest && /Library/Developer/CommandLineTools/usr/bin/python3 /Users/fatpanda/code/swift/swift-project/swift/utils/line-directive @/Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest/e80a9083717e28b40af2a396b463c9572d16e1da.txt -- /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./bin/swiftc -c -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -target x86_64-apple-macosx10.9 -resource-dir /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift -F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../../../Developer/Library/Frameworks -O -g -D INTERNAL_CHECKS_ENABLED -D SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -D SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING -D SWIFT_RUNTIME_OS_VERSIONING -module-cache-path /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./module-cache -no-link-objc-runtime -enable-library-evolution -Xfrontend -enforce-exclusivity=unchecked -module-name XCTest -swift-version 5 -swift-version 5 -autolink-force-load -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements -warn-swift3-objc-inference-complete -Xfrontend -verify-syntax-tree -Xfrontend -module-interface-preserve-types-as-written -warn-implicit-overrides -Fsystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/ -module-link-name swiftXCTest -whole-module-optimization -save-optimization-record=bitstream -parse-as-library -I /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/./lib/swift/macosx -o /Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest/OSX/x86_64/XCTest.o @/Users/fatpanda/code/swift/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/stdlib/public/Darwin/XCTest/e80a9083717e28b40af2a396b463c9572d16e1da.txt
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:24:19: error: underlying Objective-C module 'XCTest' not found
@_exported import XCTest // Clang module
                  ^
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:31:11: error: cannot find type 'XCTContext' in scope
extension XCTContext {
          ^~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:54:11: error: cannot find type 'XCUIElement' in scope
extension XCUIElement {
          ^~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:73:46: error: cannot find type '_XCTAssertionType' in scope
func _XCTFailureDescription(_ assertionType: _XCTAssertionType, _ formatIndex: Int, _ expressionStrings: CVarArg...) -> String {
                                             ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:68:14: error: cannot find '_XCTCurrentTestCase' in scope
  let test = _XCTCurrentTestCase()
             ^~~~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:69:3: error: cannot find '_XCTPreformattedFailureHandler' in scope
  _XCTPreformattedFailureHandler(test, expected, file.description, Int(line), condition, message())
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:84:25: error: cannot find '_XCTFailureFormat' in scope
  return String(format: _XCTFailureFormat(assertionType, formatIndex + 100), arguments: expressionStrings)
                        ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:130:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.fail
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:136:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.`nil`
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:175:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.notNil
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:219:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.`true`
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:250:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.`false`
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:281:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.equal
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:319:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.notEqual
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:372:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.equalWithAccuracy
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:448:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.notEqualWithAccuracy
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:509:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.greaterThan
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:548:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.greaterThanOrEqual
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:586:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.lessThan
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:625:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.lessThanOrEqual
                      ^~~~~~~~~~~~~~~~~
/Users/fatpanda/code/swift/swift-project/swift/stdlib/public/Darwin/XCTest/XCTest.swift:694:23: error: cannot find '_XCTAssertionType' in scope
  let assertionType = _XCTAssertionType.noThrow
                      ^~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

I am getting this again and again. What might be the problem and how do I fix this? I am a newbie at this.

It looks like CommandLineTools is being used instead of Xcode. Did you use xcode-select -s to select the Xcode you installed?

No, I didn't.

Does using xcode-select fix the issue? Or do you still see the same issue?

Terms of Service

Privacy Policy

Cookie Policy