Itching to use Swift but - foiled

Unable to compile the "hello world" example. Any advice for Ubuntu 24.04.2 LTS ?
I installed 6.1.2 from swift.org, then followed the "getting started" for a CLI program but it failed with an enormous and cryptic error message about the manifest being invalid which I passed to ChatGPT. That indicated an incompatibility with glibc.
Then I switched to the Docker version and that at least was able to compile and run.

Next I dabbled with remote access to the Docker version (as its on a separate PC) via VS Code, but its not worth the hassle.

So I then I went for the statically linked Linux SDK and its back to complaining about the manifest. Latest output below.

Any advice would be welcome!

john@NUC8i3BEH:~/Projects/Swift/testStatic$  cd /home/john/Projects/Swift
john@NUC8i3BEH:~/Projects/Swift$  cd /home/john/Projects/Swift/test
john@NUC8i3BEH:~/Projects/Swift/test$ swift package init --type executable
Creating executable package: test
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/main.swift
john@NUC8i3BEH:~/Projects/Swift/test$ swift build --swift-sdk x86_64-swift-linux-musl
error: 'test': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.yGoEL5/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/test/Package.swift", "-o", "/tmp/TemporaryDirectory.VtzE4I/test-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception
error: 'test': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.b5jgvm/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/test/Package.swift", "-o", "/tmp/TemporaryDirectory.PNmSBb/test-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception
john@NUC8i3BEH:~/Projects/Swift/test$ 

Would you mind pasting that error message in this thread? It's hard to pinpoint the problem without actually seeing the complete error message with relevant details.

If you're successively trying building with different Swift SDKs in the same source directory, I would also recommend removing .build directory before switching Swift SDKs. There are known issues with incremental compilation that can lead to similar problems, until those are fixed the easiest workaround is rm -rf .build. I'm not saying that's the root cause here, but could help in some cases.

1 Like

I suspect this is a SwiftPM feature bug - naming the manifest test is probably going to cause issues. Not ideal, but if you try with a folder name of something different like HelloSwift does it work?

Hi Max, Thanks for your reply, here's the original message

': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.kD1b1D/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.0.0", "/home/john/Projects/Swift/two/Package.swift", "-o", "/tmp/TemporaryDirectory.IK86Dn/two-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception"

Hi Tim,
Alas no. Much the same

john@NUC8i3BEH:~/Projects/Swift/HelloSwift$ swift package init --type executable
Creating executable package: HelloSwift
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/main.swift
john@NUC8i3BEH:~/Projects/Swift/HelloSwift$ swift build
error: 'helloswift': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.D329jL/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/HelloSwift/Package.swift", "-o", "/tmp/TemporaryDirectory.qtA2Tm/helloswift-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception
error: 'helloswift': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.yT3qE6/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/HelloSwift/Package.swift", "-o", "/tmp/TemporaryDirectory.OfvheJ/helloswift-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception
john@NUC8i3BEH:~/Projects/Swift/HelloSwift$ swift build --swift-sdk x86_64-swift-linux-musl
error: 'helloswift': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.pUMRJ3/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/HelloSwift/Package.swift", "-o", "/tmp/TemporaryDirectory.yGyHXa/helloswift-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception
error: 'helloswift': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.XSlqFM/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/HelloSwift/Package.swift", "-o", "/tmp/TemporaryDirectory.amsrBz/helloswift-manifest"])
error: link command failed due to signal 6 (use -v to see invocation)
pure virtual method called
terminate called without an active exception
john@NUC8i3BEH:~/Projects/Swift/HelloSwift$ 

It seems like you are using swiftly. Swiftly "redirects" the request to the actual toolchain. In order to isolate if an issue if occurring with swiftly, or with the toolchain, could you try executing the swift binary from the toolchain?

e.g:

❯ mkdir HelloSwift
❯ cd HelloSwift
❯ swift package init --type executable
❯ $(swiftly use --print-location)/usr/bin/swift build
❯ $(swiftly use --print-location)/usr/bin/swift build --swift-sdk x86_64-swift-linux-musl

Also, does this work with a prior Swift toolchain version? e.g. : 6.0 or 6.1?

If they still fail, maybe passing --very-verbose will provide addition information on the error.

Hi Sam,
To my layman's eyes, I don't see any clues in the output (had to divert it to nohup to collect all the text - attached). I guess I'll try going back through the earlier versions as I don't need the latest-and-greatest for what I want to do.
Thanks for the suggestion!

error: 'hello': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.tSN59K/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/hello/Package.swift", "-v", "-o", "/tmp/TemporaryDirectory.0KVTin/hello-manifest"])
/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swift-frontend -frontend -c -primary-file /home/john/Projects/Swift/hello/Package.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -vfsoverlay /tmp/TemporaryDirectory.tSN59K/vfs.yaml -swift-version 6 -package-description-version 6.1.0 -empty-abi-descriptor -resource-dir /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift -module-name main -in-process-plugin-server-path /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/host/plugins -plugin-path /home/john/.local/share/swiftly/toolchains/6.1.2/usr/local/lib/swift/host/plugins -o /tmp/TemporaryDirectory.mGktLq/Package-1.o
/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swift-autolink-extract /tmp/TemporaryDirectory.mGktLq/Package-1.o -o /tmp/TemporaryDirectory.mGktLq/main-1.autolink
/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/clang -pie -Xlinker --build-id -Xlinker -rpath -Xlinker /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.mGktLq/Package-1.o @/tmp/TemporaryDirectory.mGktLq/main-1.autolink -L /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux -lswiftCore --target=x86_64-unknown-linux-gnu -v -L /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -lPackageDescription -Xlinker -rpath -Xlinker /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -o /tmp/TemporaryDirectory.0KVTin/hello-manifest
Swift version 6.1.2 (swift-6.1.2-RELEASE)
Target: x86_64-unknown-linux-gnu
error: link command failed due to signal 6 (use -v to see invocation)
clang version 17.0.0 (GitHub - swiftlang/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project. bb511dfa7c889bf054eff34192ffc1f97278dd7f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/bin/ld.gold" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -pie -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /tmp/TemporaryDirectory.0KVTin/hello-manifest /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux -L/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib --build-id -rpath /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.mGktLq/Package-1.o -lswiftSwiftOnoneSupport -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswift_RegexParser -lswiftCore -lPackageDescription -rpath /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /lib/x86_64-linux-gnu/crtn.o
pure virtual method called
terminate called without an active exception
error: 'hello': Invalid manifest (compiled with: ["/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.y4883p/vfs.yaml", "-L", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-swift-version", "6", "-I", "/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.1.0", "/home/john/Projects/Swift/hello/Package.swift", "-v", "-o", "/tmp/TemporaryDirectory.Ea1QLq/hello-manifest"])
/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swift-frontend -frontend -c -primary-file /home/john/Projects/Swift/hello/Package.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -vfsoverlay /tmp/TemporaryDirectory.y4883p/vfs.yaml -swift-version 6 -package-description-version 6.1.0 -empty-abi-descriptor -resource-dir /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift -module-name main -in-process-plugin-server-path /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/host/plugins -plugin-path /home/john/.local/share/swiftly/toolchains/6.1.2/usr/local/lib/swift/host/plugins -o /tmp/TemporaryDirectory.3mICyd/Package-1.o
/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/swift-autolink-extract /tmp/TemporaryDirectory.3mICyd/Package-1.o -o /tmp/TemporaryDirectory.3mICyd/main-1.autolink
/home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin/clang -pie -Xlinker --build-id -Xlinker -rpath -Xlinker /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.3mICyd/Package-1.o @/tmp/TemporaryDirectory.3mICyd/main-1.autolink -L /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux -lswiftCore --target=x86_64-unknown-linux-gnu -v -L /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -lPackageDescription -Xlinker -rpath -Xlinker /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -o /tmp/TemporaryDirectory.Ea1QLq/hello-manifest
Swift version 6.1.2 (swift-6.1.2-RELEASE)
Target: x86_64-unknown-linux-gnu
error: link command failed due to signal 6 (use -v to see invocation)
clang version 17.0.0 (GitHub - swiftlang/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project. bb511dfa7c889bf054eff34192ffc1f97278dd7f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/john/.local/share/swiftly/toolchains/6.1.2/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/bin/ld.gold" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -pie -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /tmp/TemporaryDirectory.Ea1QLq/hello-manifest /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux -L/home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib --build-id -rpath /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.3mICyd/Package-1.o -lswiftSwiftOnoneSupport -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswift_RegexParser -lswiftCore -lPackageDescription -rpath /home/john/.local/share/swiftly/toolchains/6.1.2/usr/lib/swift/pm/ManifestAPI -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /lib/x86_64-linux-gnu/crtn.o
pure virtual method called
terminate called without an active exception

Did you use Swiftly before the 1.0.0 release?

I also encountered some strange errors on Ubuntu after updating to 6.1.2 using Swiftly 1.0.0, because I didn't properly uninstall Swiftly 0.3.0 before upgrading (as described here)

Hi Steven, No I started with 6.1.2 just this week

I'm also using Ubuntu 24.04.2, with Swift 6.1.2 installed through Swiftly, but cannot reproduce this :confused:

Well its good to know it works as advertised ! I suspect there's something else in my environment as I try a variety of development tools.

I should probably keep all that stuff in VMs or something away from my daily used machine.

Cheers,
John