Hi there!
I'm stuck trying to build the most recent release version of the Swift toolchain on Linux into an archive with a similar layout as the releases available at https://swift.org . I am in need of doing this as part of an ongoing effort of packaging the toolchain for Ubuntu, initially as a a ppa and ultimately in the universe package repository (I work for Canonical and have sought advice on how to accomplish this also internally, with there being initial support for it).
Thus far I've made a ppa available at swiftlang : Matias Piipari as a starting point essentially re-packaging the Swift.org tarballs (really a ropey proof of concept given the filesystem layout inside the archive etc), and also successfully elsewhere built some Snap packages of SwiftLint, SwiftFormat, the Vapor Toolbox etc using this deb as a staged component inside, mostly to check that package is OK. To actually do this in a way that will work across ARM64 and AMD64 microarchitectures and to address various lintian (Debian package linting errors with my ropey current package), building actually from source (with Ubuntu intended additional compiler flags added) is necessary.
My following attempt with utils/build-toolchain (should be reproducible in a clean VM such as using a 22.04 instance launched using multipass or any other VM host of choice) demonstrates the failure:
sudo snap install sccache --candidate --classic sudo apt-get -y update sudo apt-get -y install build-essential clang cmake git icu-devtools libcurl4-openssl-dev libedit-dev libicu-dev libncurses5-dev libpython3-dev libsqlite3-dev libxml2-dev ninja-build pkg-config python2 python2-dev python3-six python3-distutils rsync swig systemtap-sdt-dev tzdata unzip uuid-dev mkdir source cd source git clone git@github.com:apple/swift.git ../../swiftlang-builder/swift cd swift utils/update-checkout --clone utils/update-checkout --tag swift-5.7.1-RELEASE ./utils/build-toolchain teh_prefix The build failure is as follows happens when buildin libdispatch_static:
+ /usr/bin/cmake --build /source/build/buildbot_linux/libdispatch_static-linux-x86_64 -- -j8 all [73/82][ 89%][14.758s] Linking Swift static library src/swift/libswiftDispatch.a FAILED: src/swift/libswiftDispatch.a src/swift/CMakeFiles/swiftDispatch.dir/Block.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Data.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Dispatch.swift.o src/swift/CMakeFiles/swiftDispatch.dir/IO.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Private.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Queue.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Source.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Time.swift.o src/swift/CMakeFiles/swiftDispatch.dir/Wrapper.swift.o src/swift/swift/Dispatch.swiftmodule : && /source/build/buildbot_linux/swift-linux-x86_64/bin/swiftc -output-file-map src/swift/CMakeFiles/swiftDispatch.dir/Release/output-file-map.json -incremental -j 8 -emit-library -static -o src/swift/libswiftDispatch.a -module-name Dispatch -module-link-name swiftDispatch -emit-module -emit-module-path src/swift/swift/Dispatch.swiftmodule -emit-dependencies -module-cache-path "/source/build/buildbot_linux/libdispatch_static-linux-x86_64/module-cache" -O -Xcc -fblocks -Xcc -fmodule-map-file=/source/swift-corelibs-libdispatch/dispatch/module.modulemap -Xcc -I/source/swift-corelibs-libdispatch -Xcc -I/source/swift-corelibs-libdispatch/src/swift/shims -I /source/swift-corelibs-libdispatch/src/BlocksRuntime -I /source/build/buildbot_linux/libdispatch_static-linux-x86_64 -I /source/swift-corelibs-libdispatch -I /source/swift-corelibs-libdispatch/src -I /source/build/buildbot_linux/libdispatch_static-linux-x86_64/src /source/swift-corelibs-libdispatch/src/swift/Block.swift /source/swift-corelibs-libdispatch/src/swift/Data.swift /source/swift-corelibs-libdispatch/src/swift/Dispatch.swift /source/swift-corelibs-libdispatch/src/swift/IO.swift /source/swift-corelibs-libdispatch/src/swift/Private.swift /source/swift-corelibs-libdispatch/src/swift/Queue.swift /source/swift-corelibs-libdispatch/src/swift/Source.swift /source/swift-corelibs-libdispatch/src/swift/Time.swift /source/swift-corelibs-libdispatch/src/swift/Wrapper.swift && : <unknown>:0: error: could not build C module 'SwiftShims' [80/82][ 97%][15.643s] Linking CXX executable dispatch_io_pipe ninja: build stopped: subcommand failed. ERROR: command terminated with a non-zero exit status 1, aborting What am I doing wrong? The instructions over at swift/GettingStarted.md at main · apple/swift · GitHub
which suggest doing utils/build-script --release-debuginfo --skip-early-swift-driver \ --skip-early-swiftsyntax do work, but don't yield the full toolchain.