Closed
Description
Description
Trying to compile a simple Swift program on either main
or the 5.9
release branch is currently failing to link when using --static-swift-stdlib
. It produces the following linker error
#4 6.932 error: link command failed with exit code 1 (use -v to see invocation)
#4 6.932 clang version 13.0.0 (https://github.com/apple/llvm-project.git d41f263a5bcfd9715eaf9a3351f00b4566f13231)
#4 6.932 Target: aarch64-unknown-linux-gnu
#4 6.932 Thread model: posix
#4 6.932 InstalledDir: /usr/bin
#4 6.932 Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-redhat-linux/11
#4 6.932 Selected GCC installation: /usr/bin/../lib/gcc/aarch64-redhat-linux/11
#4 6.932 Candidate multilib: .;@m64
#4 6.932 Selected multilib: .;@m64
#4 6.932 "/usr/bin/ld.gold" -pie -EL --hash-style=gnu --eh-frame-hdr -m aarch64linux -dynamic-linker /lib/ld-linux-aarch64.so.1 -o /.build/aarch64-unknown-linux-gnu/release/Test /usr/bin/../lib/gcc/aarch64-redhat-linux/11/../../../../lib64/Scrt1.o /usr/bin/../lib/gcc/aarch64-redhat-linux/11/../../../../lib64/crti.o /usr/bin/../lib/gcc/aarch64-redhat-linux/11/crtbeginS.o -L/usr/lib/swift_static/linux -L/.build/aarch64-unknown-linux-gnu/release -L/usr/lib -L/usr/bin/../lib/gcc/aarch64-redhat-linux/11 -L/usr/bin/../lib/gcc/aarch64-redhat-linux/11/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib /usr/lib/swift_static/linux/aarch64/swiftrt.o --start-group /.build/aarch64-unknown-linux-gnu/release/TestExecutable.build/Program.swift.o /.build/aarch64-unknown-linux-gnu/release/TestLib.build/File.swift.o -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswift_RegexParser -lswiftGlibc -lBlocksRuntime -ldispatch -lDispatchStubs -lswiftDispatch -lCoreFoundation -lFoundation -luuid -licui18nswift -licuucswift -licudataswift -lm -lpthread -lutil -ldl --end-group -ldl -lpthread -lswiftCore -lstdc++ -lm -export-dynamic --exclude-libs ALL --gc-sections --defsym main=TestExecutable_main "-rpath=\$ORIGIN" -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/aarch64-redhat-linux/11/crtendS.o /usr/bin/../lib/gcc/aarch64-redhat-linux/11/../../../../lib64/crtn.o
#4 6.932 /usr/lib/swift_static/linux/libswiftCore.a(Metadata.cpp.o):Metadata.cpp:function swift::blockOnMetadataDependency(swift::MetadataDependency, swift::MetadataDependency): error: undefined reference to 'std::__glibcxx_assert_fail(char const*, int, char const*, char const*)'
#4 6.932 /usr/lib/swift_static/linux/libswiftCore.a(MetadataLookup.cpp.o):MetadataLookup.cpp:function swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType(swift::Demangle::__runtime::Node*, unsigned int, bool): error: undefined reference to 'std::__glibcxx_assert_fail(char const*, int, char const*, char const*)'
#4 6.932 /usr/lib/swift_static/linux/libswiftCore.a(MetadataLookup.cpp.o):MetadataLookup.cpp:function swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType(swift::Demangle::__runtime::Node*, unsigned int, bool): error: undefined reference to 'std::__glibcxx_assert_fail(char const*, int, char const*, char const*)'
#4 6.932 /usr/lib/swift_static/linux/libswiftCore.a(MetadataLookup.cpp.o):MetadataLookup.cpp:function __swift::__runtime::llvm::ArrayRef<swift::MetadataOrPack>& std::vector<__swift::__runtime::llvm::ArrayRef<swift::MetadataOrPack>, std::allocator<__swift::__runtime::llvm::ArrayRef<swift::MetadataOrPack> > >::emplace_back<swift::MetadataOrPack*, unsigned int>(swift::MetadataOrPack*&&, unsigned int&&): error: undefined reference to 'std::__glibcxx_assert_fail(char const*, int, char const*, char const*)'
#4 6.932 clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
#4 6.932 error: fatalError
Steps to reproduce
Try to compile a simple swift package that contains an executable target that contains just this
@main
struct Main {
static func main() async throws {}
}
Environment
- Swift compiler version info: April 11, 2023 main or 5.9 snapshots.