Swift 6.0.3 doesn't compile on x86_64 Linux

This is just a heads-up that Swift 6.0.3 doesn't compile on x86_64 Linux.

-- Building Swift standard library and overlays for SDKs: LINUX
--   Build type:       Release
--   Assertions:       FALSE
-- 
-- Building Swift runtime with:
--   Leak Detection Checker Entrypoints: FALSE
-- 
-- Differentiable Programming Support: TRUE
-- Concurrency Support:                TRUE
-- Distributed Support:                TRUE
-- NonEscapableTypes Support:          FALSE
-- String Processing Support:          TRUE
-- Backtracing Support:                TRUE
-- Unicode Support:                    TRUE
-- Observation Support:                TRUE
-- Synchronization Support:            TRUE
-- 
-- Building Swift auxiliary executables for SDKs: LINUX
-- 
-- Building Swift Remote Mirror for SDKs: LINUX
-- 
-- Building Swift External Generic Metadata Builder for SDKs: LINUX
-- 
CMake Error at cmake/modules/SwiftUtils.cmake:116 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  stdlib/cmake/modules/SwiftSource.cmake:887 (get_bootstrapping_swift_lib_dir)
  stdlib/cmake/modules/SwiftSource.cmake:141 (_compile_swift_files)
  stdlib/cmake/modules/AddSwiftStdlib.cmake:1015 (handle_swift_sources)
  stdlib/cmake/modules/AddSwiftStdlib.cmake:2471 (add_swift_target_library_single)
  stdlib/public/Cxx/CMakeLists.txt:9 (add_swift_target_library)


-- Configuring incomplete, errors occurred!
See also "/home/swift/swift-source/build/buildbot_linux/swift-linux-x86_64/CMakeFiles/CMakeOutput.log".
See also "/home/swift/swift-source/build/buildbot_linux/swift-linux-x86_64/CMakeFiles/CMakeError.log".
ERROR: command terminated with a non-zero exit status 1, aborting

ERROR: command terminated with a non-zero exit status 1, aborting

It obviously does compile, or there wouldn't be many toolchains available for all the distros. :wink: What command are you invoking to build it? Also, what CMake version are you using? Swift 6.0 requires 3.19.6 or later.

Finally, do you have a prebuilt host 5.8 or later Swift toolchain in your path, as the doc recommends? Without that, it won't build.

cmake version 3.25.1
Debian clang version 14.0.6

$ ninja --version
1.11.1

No I don't have Swift already installed. I'm trying to install it for the first time from sources. It doesn't matter though because the build is failing before swiftc would be used.

I'm having a similar experience with 6.0.2 BTW, where I get

clang: error: unknown argument: '-fno-lifetime-dse'
ninja: build stopped: subcommand failed.

OK, that's the problem then: the Swift 6 compiler has multiple components written in Swift now and requires a prebuilt Swift compiler to build. You can build 5.8 or 5.9 first purely from source, if you don't trust the existing prebuilt compilers for some reason, then build Swift 6 with that toolchain.

It is failing because the CMake config in get_bootstrapping_swift_lib_dir() is looking for a prebuilt Swift runtime to link against and doesn't find one, because you haven't provided a prebuilt Swift toolchain.

That error is from compiling LLVM or the Swift frontend? Could be because of how old your host clang is, try something more recent, as the current release is clang 19.