jhowlin
(Jason Howlin)
1
Running into an error when attempting to build main using the following command (from the getting started docs):
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
--sccache --release-debuginfo --swift-disable-dead-stripping --test \
--Xcode
Error:
--- Building earlyswiftdriver ---
+ /Users/jason/Documents/Swift/swift-project/swift-driver/Utilities/build-script-helper.py build --package-path /Users/jason/Documents/Swift/swift-project/swift-driver --build-path /Users/jason/Documents/Swift/swift-project/build/Xcode-RelWithDebInfoAssert/earlyswiftdriver-macosx-arm64 --configuration release --toolchain /Library/Developer/CommandLineTools/usr --ninja-bin /opt/homebrew/bin//ninja --cmake-bin /opt/homebrew/bin//cmake --local_compiler_build
env: python: No such file or directory
ERROR: command terminated with a non-zero exit status 127, aborting
Because macOS 12.3 removed python 2, there is no /usr/bin/python anymore. I can't add a symlink or re-install python 2 into that directory because of system integrity protection.
Any thoughts about how to resolve this? Thanks!
Maybe these 3 PRs can solve the problem:
For this case in specific note that the error message says in which file the failure is happening /Users/jason/Documents/Swift/swift-project/swift-driver/Utilities/build-script-helper.py, so we can see that this is on swift driver dependency. I hit the same issue and while investigating noted that this was fixed but then reverted in Revert "Update build-script-helper.py to use python3" by shahmishal · Pull Request #1024 · apple/swift-driver · GitHub so there should be a good reason for that. For now if you want to unblock the build just manually editing those files #!/usr/bin/env python to #!/usr/bin/env python3 should help =]
I think for running the build script command the only files you would have to change locally are /Users/jason/Documents/Swift/swift-project/swift-driver/Utilities/build-script-helper.py and the cmake one removing the python2.7 as [build-script] Drop Python2.7 from swift_cmake_options. by plotfi · Pull Request #42009 · apple/swift · GitHub, after changing that locally your command should run fine
jhowlin
(Jason Howlin)
5
Thanks! I ended up changing everything in the swift-project/swift directory to use python3, as well as the two files you mentioned.
Now I get past that error and about 20 minutes in it fails with:
clang: error: no such file or directory: '/Users/jason/Documents/Swift/swift-project/build/Xcode-RelWithDebInfoAssert/swift-macosx-arm64/lib/RelWithDebInfo/libswiftCompilerModules-bootstrapping1.a'
I am using the following build command:
utils/build-script --skip-build-benchmarks --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" --sccache --release-debuginfo --swift-disable-dead-stripping --Xcode
On macOS 12.3 M1, Xcode 13.3. I do see in the forums here others having problems doing Xcode builds. Fairly sure at this point it is no longer a python version issue.
Any thoughts? Thanks!
I would suggest you to try --bootstrap=off flag. Make sure to use --reconfigure the first time you use that bootstrap flag :)
jhowlin
(Jason Howlin)
7
** BUILD SUCCEEDED **
That did the trick, thank you.
It looks like everything got fixed up except the change to benchmark/scripts/build_script_helper.py.
Is there a reason why this part didn't land?
Overcot
(Alexey Ivashko)
9
Also,
/swift-driver/Utilities/build-script-helper.py
It crashes when building on m1, mac os 12.3 with this command:
utils/build-script --skip-build-benchmarks \
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
--sccache --release-debuginfo --swift-disable-dead-stripping --test \
--xcode
And the output is:
+ /opt/homebrew/bin/sccache --show-stats
+ /usr/libexec/PlistBuddy -c 'Print :SupportedTargets:macosx:Archs' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/SDKSettings.plist
+ mkdir -p /Users/overcot/Work/swift-project/build/Xcode-RelWithDebInfoAssert
--- Building earlyswiftdriver ---
+ /Users/overcot/Work/swift-project/swift-driver/Utilities/build-script-helper.py build --package-path /Users/overcot/Work/swift-project/swift-driver --build-path /Users/overcot/Work/swift-project/build/Xcode-RelWithDebInfoAssert/earlyswiftdriver-macosx-arm64 --configuration release --toolchain /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr --ninja-bin /opt/homebrew/bin/ninja --cmake-bin /opt/homebrew/bin/cmake --local_compiler_build
env: python: No such file or directory
ERROR: command terminated with a non-zero exit status 127, aborting
Keith
(Keith Smiley)
10