Swift compile error

/swift-source/swift/stdlib/public/Darwin/Foundation/UUID.swift:77:16: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'UUID' to 'Hashable' by implementing 'hash(into:)' instead
public var hashValue: Int {
^
[803/1383][ 58%][2086.641s] Compiling .../stdlib/public/core/OSX/x86_64/Swift.o
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

When I run utils/build-script --release-debuginfo, I got this error.
I tried [SR-1805] Swift compile instructions incomplete or incorrect · Issue #44414 · apple/swift · GitHub, but didn't work.

How can I compile it?
Thank you.

You got an error while compiling the stdlib, which means you got quite far -- you're almost there! The build-script invocation you used is fine; it should work as is.

The warning you quoted is unrelated to the actual error; to help us find the cause, please look for a line that includes error:, and paste that in instead.

swift-source/swift/stdlib/public/Darwin/SceneKit/SceneKit.swift.gyb:184:10: error: argument labels '(__vertices:, count:)' do not match any available overloads
self.init(__vertices: vertices, count: vertices.count)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
swift-source/swift/stdlib/public/Darwin/SceneKit/SceneKit.swift.gyb:184:10: note: overloads for 'SCNGeometrySource.init' exist with these partially matching parameter lists: (normals: UnsafePointer, count: Int), (textureCoordinates: UnsafePointer, count: Int), (vertices: UnsafePointer, count: Int)
self.init(__vertices: vertices, count: vertices.count)
^
/swift-source/swift/stdlib/public/Darwin/SceneKit/SceneKit.swift.gyb:188:10: error: argument labels '(__normals:, count:)' do not match any available overloads
self.init(__normals: normals, count: normals.count)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
swift-source/swift/stdlib/public/Darwin/SceneKit/SceneKit.swift.gyb:188:10: note: overloads for 'SCNGeometrySource.init' exist with these partially matching parameter lists: (normals: UnsafePointer, count: Int), (textureCoordinates: UnsafePointer, count: Int), (vertices: UnsafePointer, count: Int)
self.init(__normals: normals, count: normals.count)
^
swift-source/swift/stdlib/public/Darwin/SceneKit/SceneKit.swift.gyb:192:14: error: incorrect argument label in call (have '__textureCoordinates:count:', expected 'textureCoordinates:count:')
self.init(__textureCoordinates: textureCoordinates, count: textureCoordinates.count)
^~~~~~~~~~~~~~~~~~~~~
textureCoordinates
[5/564][ 0%][3.643s] Building CXX obj...tion-macosx-x86_64.dir/CheckClass.mm.o
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

These are the errors I got.
Thank you.

Great! This looks like a mismatch between the SDK that's in your Xcode vs. the SDK we expect on the master branch.

My guess is that you're using some Xcode version other than the latest beta release. Make sure you have 10.2 beta 4 selected as the active Xcode, and retry the build.

You can check which Xcode is active with xcode-select -p , and you can change it with sudo xcode-select -s <path>. You will probably need to invoke build-script with the --reconfigure option to have it pick up the new selection.

Let me know how it goes!

1 Like

Thank you very much.
I could fix the issue, but the new error came out.

Terminal

-- Configuring incomplete, errors occurred!
See also "/Users/keita/Desktop/gsoc/swift-source/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/CMakeFiles/CMakeOutput.log".
See also "/Users/keita/Desktop/gsoc/swift-source/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/CMakeFiles/CMakeError.log".
FAILED: build.ninja
/usr/local/Cellar/cmake/3.13.4/bin/cmake -S/Users/keita/Desktop/gsoc/swift-source/swift -B/Users/keita/Desktop/gsoc/swift-source/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64
ninja: error: rebuilding 'build.ninja': subcommand failed
utils/build-script: fatal error: command terminated with a non-zero exit status

CMakeError.log.

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
Apple LLVM version 10.0.1 (clang-1001.0.46.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Checking whether the ASM compiler is Clang using "--version" did not match "(clang version)":
Apple LLVM version 10.0.1 (clang-1001.0.46.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
error: 'futimens' is only available on macOS 10.13 or newer [-Werror,-Wunguarded-availability-new]
if (::futimens(FD, Times))
^~~~~~~~~~
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/stat.h:373:9: note: 'futimens' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
int futimens(int __fd, const struct timespec __times[2]) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0));
^
/swift-source/llvm/lib/Support/Unix/Path.inc:644:7: note: enclose 'futimens' in a __builtin_available check to silence this warning
if (::futimens(FD, Times))
^~~~~~~~~~
1 error generated.
[8/2719][ 0%][3.485s] Building CXX ob...CMakeFiles/LLVMTableGen.dir/Main.cpp.o
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

I am trying to fix the problems now.

Anyways, thank you for fixing the issue.

I run utils/build-script --debug --Xcode now. It has been running for 3 hours, but it seems it works so far.

I think I better use utils/build-script --debug --Xcode than utils/build-script --debug.

I could build with utils/build-script --debug --Xcode.

1 Like

--debug will get you a compiler built without optimizations. This is usually not what you want, unless you're actually debugging an issue with the compiler itself. Debug builds of the compiler will be unbearably slow for regular Swift work.

For stdlib work, use build-script --release-debuginfo or --release.