Can't build Swift toolchain: clang: error: invalid version number in '-mmacosx-version-min=10.10'

Hi All,

I've recently pulled the source code to build swift and downloaded all the related submodules, I want to be able to test ExpressibleByStringInterpolation new implementation, but I am unable to build anything, I always end up getting this error:

 clang: error: invalid version number in '-mmacosx-version-min=10.10'

 --- bootstrap: error: build failed with exit status 1

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

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

All I'm doing it building using ./utils/build-toolchain macOS within the Swift folder. I have Xcode 10.0 installed on my system.

What's going on here?

Thank you for your help.

That sounds like Xcode 10 isn't the Xcode used for the command line. Check the "Command Line Tools" setting in Xcode's preferences under Locations, or use the xcode-select tool.

Thank you for the reply, sadly that's not it, the command line is properly set. Just in case I update the location but it's still failing in the same way.

Maybe this will help better if I add more of the errors that it shows:

~/Developer/Projects/swift-source/swift
+ /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Utilities/bootstrap --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -v --swiftc=/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swift-macosx-x86_64/bin/swiftc --sbt=/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/llbuild-macosx-x86_64/bin/swift-build-tool --build=/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64 --link-llbuild --llbuild-source-dir=/Users/remydemarest/Developer/Projects/swift-source/llbuild --llbuild-build-dir=/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/llbuild-macosx-x86_64
--- bootstrap: note: building runtime v4_2 target: PackageDescription4:
/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swift-macosx-x86_64/bin/swiftc -module-name PackageDescription -incremental -emit-dependencies -emit-module -emit-module-path /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4_2/modules/PackageDescription.swiftmodule -output-file-map /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4_2/PackageDescription.build/output-file-map.json -parse-as-library -c /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/JSON.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/LanguageStandardSettings.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Package.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/PackageDependency.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/PackageRequirement.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Product.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Target.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Version+StringLiteralConvertible.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Version.swift -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4_2/modules -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4_2/inc -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/llbuild-macosx-x86_64/products/llbuildSwift -I /Users/remydemarest/Developer/Projects/swift-source/llbuild/products/libllbuild/include -Onone -g -j8 -DPACKAGE_DESCRIPTION_4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -swift-version 4
--- bootstrap: note: building runtime v4 target: PackageDescription4:
/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swift-macosx-x86_64/bin/swiftc -module-name PackageDescription -incremental -emit-dependencies -emit-module -emit-module-path /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4/modules/PackageDescription.swiftmodule -output-file-map /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4/PackageDescription.build/output-file-map.json -parse-as-library -c /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/JSON.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/LanguageStandardSettings.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Package.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/PackageDependency.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/PackageRequirement.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Product.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Target.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Version+StringLiteralConvertible.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Version.swift -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4/modules -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/runtimes/4/inc -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/llbuild-macosx-x86_64/products/llbuildSwift -I /Users/remydemarest/Developer/Projects/swift-source/llbuild/products/libllbuild/include -Onone -g -j8 -DPACKAGE_DESCRIPTION_4 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -swift-version 4
--- bootstrap: note: building stage1
clang -fobjc-arc -fmodule-name=clibc -arch x86_64 -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -g -O0 -MD -MT dependencies -MF /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/clibc.build/libc.d -c /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/clibc/libc.c -o /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/clibc.build/libc.o
/Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swift-macosx-x86_64/bin/swiftc -module-name PackageDescription4 -incremental -emit-dependencies -emit-module -emit-module-path /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/modules/PackageDescription4.swiftmodule -output-file-map /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/PackageDescription4.build/output-file-map.json -parse-as-library -c /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/JSON.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/LanguageStandardSettings.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Package.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/PackageDependency.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/PackageRequirement.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Product.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Target.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Version+StringLiteralConvertible.swift /Users/remydemarest/Developer/Projects/swift-source/swiftpm/Sources/PackageDescription4/Version.swift -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/modules -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/swiftpm-macosx-x86_64/.bootstrap/inc -I /Users/remydemarest/Developer/Projects/swift-source/build/buildbot_osx/llbuild-macosx-x86_64/products/llbuildSwift -I /Users/remydemarest/Developer/Projects/swift-source/llbuild/products/libllbuild/include -Onone -g -j8 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -swift-version 4
clang: error: invalid version number in '-mmacosx-version-min=10.10'

Ah, is it possible you have the Xcode Command Line Tools package installed? Or a clang built from somewhere else?

Do these print different answers?

clang --version
xcrun clang --version

cc @Aciid

$ clang --version
clang version 1.1 (branches/release_27 101620)
Target: x86_64-apple-darwin18
Thread model: posix

$ xcrun clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

SwiftPM's bootstrap script doesn't lookup clang using xcrun (it should) so thats the issue. Can you try removing the other clang from your PATH?

Now the path is the same in both cases and the version is the same so I'm trying again. I'll let you know if it worked out!

Thank you it seems to have worked! Although the first time I ran the builder I got a Kernel Panic but it's fine now.

1 Like
Terms of Service

Privacy Policy

Cookie Policy