Skip to content

Conversation

@MaxDesiatov
Copy link
Contributor

We're seeing multiple build failures with CMake 4.0: e.g. SwiftPM bootstrapping issues on macOS. build-script will always build a fixed version of CMake that's known to work if preinstalled one is not found. Let's reduce the chances for confusion by not recommending preinstalled CMake in GettingStarted.md.

We're seeing multiple build failures with CMake 4.0: e.g. SwiftPM bootstrapping issues  on macOS. `build-script` will always build a fixed version of CMake that's known to work if preinstalled one is not found. Let's reduce the chances for confusion by not recommending preinstalled CMake in `GettingStarted.md`.
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

1. Install [Ninja][] and [Sccache][]:
- Via [Homebrew][] (recommended):
```sh
brew install cmake ninja sccache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment, can we just pin it instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, the answer is "no" unfortunately

@MaxDesiatov MaxDesiatov requested a review from bnbarham July 15, 2025 21:40
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test macos

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to get this working, but better to not be confusing for now 👍

@MaxDesiatov MaxDesiatov merged commit ede4949 into swiftlang:main Jul 17, 2025
3 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/say-no-to-cmake4.0 branch July 17, 2025 16:04
@JaapWijnen
Copy link
Contributor

JaapWijnen commented Jul 24, 2025

I ran into an issue today.
Instead of the build-script installing a fixed version of cmake (as mentioned in the commit message) I get the following when trying to build
ERROR: can't find CMake (please install CMake)

@MaxDesiatov
Copy link
Contributor Author

I ran into an issue today. Instead of the build-script installing a fixed version of cmake (as mentioned in the commit message) I get the following when trying to build ERROR: can't find CMake (please install CMake)

Which exact commit are you trying to build and on which OS? What's the exact build-script invocation that you're using?

@MaxDesiatov
Copy link
Contributor Author

I assume you're building on macOS? That's fixed in #83296, you'll have to re-run update-checkout after that's merged. Pass --all-repositories to update-checkout in the meantime.

@MaxDesiatov
Copy link
Contributor Author

Also updating update-checkout steps in GettingStarted.md: #83299

@JaapWijnen
Copy link
Contributor

Ah thanks for all the great comments! Yeah I was at the tip of main today so commit 40e372f80bac6b4bca53e5f5114f6114d132a03b
And was using the build-script invocation suggested by the getting started guide.
Thanks for the extra context, super helpful! (meanwhile seem to have gotten around it by installing CMake 3.x from their website)

@JaapWijnen
Copy link
Contributor

@MaxDesiatov I do keep running into an issue that might be related to cmake.
I get the following error from CMake:

-- The C compiler identification is unknown
-- The Swift compiler identification is Apple 6.2
CMake Error at CMakeLists.txt:11 (project):
  The CMAKE_C_COMPILER:

    /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

I tried setting the CC variable but it doesn't seem to be picked up since the already set path probably has presedence and indeed doesn't contain clang.

I ran the following invocation of build-script:

utils/build-script --swift-darwin-supported-archs "$(uname -m)" --release-debuginfo --swift-disable-dead-stripping --bootstrapping=hosttools --build-llvm --swiftpm --llbuild --install-swift --install-swiftpm --install-llbuild --toolchain-benchmarks

Not sure if this was part of the issues with CMake?

@MaxDesiatov
Copy link
Contributor Author

Can you ensure that the version CMake you're running is the one built by build-script? Which build-script product is the failure you've pasted above coming from?

@JaapWijnen
Copy link
Contributor

I no longer have cmake installed locally so it should be, but also yeah it mentions /Users/jaap/Developer/jaap/swift-project/build/cmake-macosx-arm64/bin/cmake everywhere.

I'm not sure which product it is? How do I identify that specifically? Could that be bootstrap or maybe swift-system? Please let me know what I can provide you with :)

@JaapWijnen
Copy link
Contributor

@MaxDesiatov Here's a larger part of the output I'm seeing hope that helps:

--- bootstrap | 2025-08-05 13:50:41,292 | INFO    | MainThread | helpers | call | Line:69 | executing command >>> ['env', 'MACOSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/build/cmake-macosx-arm64/bin/cmake', '-G', 'Ninja', '-DCMAKE_MAKE_PROGRAM=/opt/homebrew/bin/ninja', '-DCMAKE_BUILD_TYPE:=Debug', '-DCMAKE_Swift_FLAGS=\'-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -module-cache-path "/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64/arm64-apple-macosx/swift-system/module-cache"\'', '-DCMAKE_Swift_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-DCMAKE_C_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-DCMAKE_AR:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar', '-DCMAKE_RANLIB:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib', '-DCMAKE_C_FLAGS=-target arm64-apple-macosx12.0', '-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/swiftpm/../swift-system'] with cwd /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64/arm64-apple-macosx/swift-system
-- The C compiler identification is unknown
-- The Swift compiler identification is Apple 6.2
CMake Error at CMakeLists.txt:11 (project):
  The CMAKE_C_COMPILER:

    /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


-- Check for working Swift compiler: /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
-- Check for working Swift compiler: /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc - works
-- Configuring incomplete, errors occurred!
--- bootstrap | 2025-08-05 13:50:41,948 | DEBUG   | MainThread | helpers | call | Line:72 | executing command >>> ['env', 'MACOSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/build/cmake-macosx-arm64/bin/cmake', '-G', 'Ninja', '-DCMAKE_MAKE_PROGRAM=/opt/homebrew/bin/ninja', '-DCMAKE_BUILD_TYPE:=Debug', '-DCMAKE_Swift_FLAGS=\'-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -module-cache-path "/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64/arm64-apple-macosx/swift-system/module-cache"\'', '-DCMAKE_Swift_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-DCMAKE_C_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-DCMAKE_AR:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar', '-DCMAKE_RANLIB:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib', '-DCMAKE_C_FLAGS=-target arm64-apple-macosx12.0', '-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/swiftpm/../swift-system'] with cwd /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64/arm64-apple-macosx/swift-system
--- bootstrap | 2025-08-05 13:50:41,948 | ERROR   | MainThread | helpers | call | Line:73 | Process failure with return code 1: Command '['env', 'MACOSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/build/cmake-macosx-arm64/bin/cmake', '-G', 'Ninja', '-DCMAKE_MAKE_PROGRAM=/opt/homebrew/bin/ninja', '-DCMAKE_BUILD_TYPE:=Debug', '-DCMAKE_Swift_FLAGS=\'-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -module-cache-path "/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64/arm64-apple-macosx/swift-system/module-cache"\'', '-DCMAKE_Swift_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-DCMAKE_C_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-DCMAKE_AR:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar', '-DCMAKE_RANLIB:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib', '-DCMAKE_C_FLAGS=-target arm64-apple-macosx12.0', '-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/swiftpm/../swift-system']' returned non-zero exit status 1.
[---- START stdout ----]
None
[---- END stdout ----]
[---- START stderr ----]
None
[---- END stderr ----]
[---- START OUTPUT ----]
None
[---- END OUTPUT ----]
--- bootstrap | 2025-08-05 13:50:41,948 | DEBUG   | MainThread | bootstrap | wrapper | Line:64 | Done call to build_with_cmake ...
--- bootstrap | 2025-08-05 13:50:41,948 | DEBUG   | MainThread | bootstrap | wrapper | Line:64 | Done call to build_dependency ...
--- bootstrap | 2025-08-05 13:50:41,948 | DEBUG   | MainThread | bootstrap | wrapper | Line:64 | Done call to build ...
--- bootstrap | 2025-08-05 13:50:41,948 | DEBUG   | MainThread | bootstrap | wrapper | Line:64 | Done call to main ...
Traceback (most recent call last):
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 979, in <module>
    main()
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 62, in wrapper
    return func(*args, **kwargs)
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 102, in main
    args.func(args)
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 62, in wrapper
    return func(*args, **kwargs)
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 424, in build
    build_dependency(args, "swift-system")
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 62, in wrapper
    return func(*args, **kwargs)
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 700, in build_dependency
    build_with_cmake(args, cmake_flags, [], args.source_dirs[target_name], args.build_dirs[target_name])
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 62, in wrapper
    return func(*args, **kwargs)
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap", line 642, in build_with_cmake
    call(cmd, cwd=build_dir, verbose=True)
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/helpers.py", line 92, in call
    raise cpe
  File "/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/helpers.py", line 70, in call
    subprocess.check_call(cmd, cwd=cwd)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['env', 'MACOSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/build/cmake-macosx-arm64/bin/cmake', '-G', 'Ninja', '-DCMAKE_MAKE_PROGRAM=/opt/homebrew/bin/ninja', '-DCMAKE_BUILD_TYPE:=Debug', '-DCMAKE_Swift_FLAGS=\'-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk -module-cache-path "/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64/arm64-apple-macosx/swift-system/module-cache"\'', '-DCMAKE_Swift_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-DCMAKE_C_COMPILER:=/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '-DCMAKE_AR:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar', '-DCMAKE_RANLIB:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib', '-DCMAKE_C_FLAGS=-target arm64-apple-macosx12.0', '-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0', '/Users/jaap/Developer/jaap/swift-project/swiftpm/../swift-system']' returned non-zero exit status 1.
ERROR: command `['/Users/jaap/Developer/jaap/swift-project/swiftpm/Utilities/bootstrap', 'build', '--release', '--swiftc-path', '/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '--clang-path', '/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang', '--cmake-path', '/Users/jaap/Developer/jaap/swift-project/build/cmake-macosx-arm64/bin/cmake', '--ninja-path', '/opt/homebrew/bin/ninja', '--build-dir', '/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/swiftpm-macosx-arm64', '--llbuild-build-dir', '/Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/llbuild-macosx-arm64', '--reconfigure', '--verbose']` terminated with a non-zero exit status 1, aborting

So I feel it's trying to build swift-system in order to build swiftpm?

@MaxDesiatov
Copy link
Contributor Author

Does /Users/jaap/Developer/jaap/swift-project/build/Ninja-RelWithDebInfoAssert/toolchain-macosx-arm64/ exist in your setup at all? If so, maybe --install-llvm is missing, and SwiftPM is looking installed clang in that directory?

@JaapWijnen
Copy link
Contributor

Ah yeah that was missing from my invocation. Will run it with that now, thanks!

@JaapWijnen
Copy link
Contributor

That worked! Thanks. The full invocation that worked for me was:

utils/build-script --swift-darwin-supported-archs "$(uname -m)" --release-debuginfo --swift-disable-dead-stripping --bootstrapping=hosttools --build-llvm --install-llvm --swift-testing-macros --install-swift-testing-macros --swift-testing --install-swift-testing --swiftpm --llbuild --install-swift --install-swiftpm --install-llbuild --toolchain-benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants