Closed
Description
Description
swiftc -static-executable
fails on Ubuntu
/usr/bin/ld.gold: error: cannot find -licui18nswift
/usr/bin/ld.gold: error: cannot find -licuucswift
/usr/bin/ld.gold: error: cannot find -licudataswift
Reproduction
Sources/main.swift
print("Hello, world!")
swiftc -v -static-executable Sources/main.swift
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
/judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/bin/swift-frontend -frontend -c -primary-file Sources/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -empty-abi-descriptor -resource-dir /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static -use-static-resource-dir -module-name main -plugin-path /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift/host/plugins -plugin-path /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/local/lib/swift/host/plugins -o /tmp/TemporaryDirectory.xoN6RL/main-1.o
/judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/bin/swift-autolink-extract /tmp/TemporaryDirectory.xoN6RL/main-1.o -o /tmp/TemporaryDirectory.xoN6RL/main-2.autolink
/judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/bin/clang -pie /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static/linux/x86_64/swiftrt.o -Xlinker --start-group /tmp/TemporaryDirectory.xoN6RL/main-1.o @/tmp/TemporaryDirectory.xoN6RL/main-2.autolink -Xlinker --end-group -L /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static/linux @/judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static/linux/static-executable-args.lnk --target=x86_64-unknown-linux-gnu -v -o main
error: link command failed with exit code 1 (use -v to see invocation)
clang version 17.0.0 (https://github.com/swiftlang/llvm-project.git 2e6139970eda445d9c6872c0ca293088b4e63dd2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/bin
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
clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
"/usr/bin/ld.gold" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -static -o main /lib/x86_64-linux-gnu/crt1.o /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginT.o -L/judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static/linux -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 /judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static/linux/x86_64/swiftrt.o --start-group /tmp/TemporaryDirectory.xoN6RL/main-1.o -lswiftSwiftOnoneSupport -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswift_RegexParser --end-group -lswiftCore -undefined=pthread_self -undefined=pthread_once -undefined=pthread_key_create -ldispatch -lBlocksRuntime -lpthread -licui18nswift -licuucswift -licudataswift -ldl -lstdc++ -lm --start-group -lgcc -lgcc_eh -lc --end-group /usr/lib/gcc/x86_64-linux-gnu/13/crtend.o /lib/x86_64-linux-gnu/crtn.o
/usr/bin/ld.gold: error: cannot find -licui18nswift
/usr/bin/ld.gold: error: cannot find -licuucswift
/usr/bin/ld.gold: error: cannot find -licudataswift
/judge/swift-6.0.3-RELEASE-ubuntu24.04/usr/lib/swift_static/linux/libswiftCore.a(LibPrespecialized.cpp.o):LibPrespecialized.cpp:function LibPrespecializedState::findLibPrespecialized():(.text._ZN22LibPrespecializedState21findLibPrespecializedEv+0x53): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Expected behavior
a statically linked executable is created
Environment
swiftc --version
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"
Additional information
No response