Linux static-executable linking errors

Hi!
i'm currently trying to compile my executable package on linux. Unfortunately i can't get it to work.

Did I something wrong or is this a bug?

I compile with

swift build -c release --product Knoggl-Bot -Xswiftc -static-executable

My Package.swift

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Knoggl-Bot",
    dependencies: [
        .package(url: "https://github.com/kylebrowning/APNSwift.git", .upToNextMinor(from: "3.2.0")),
    ],
    targets: [
        .executableTarget(
            name: "Knoggl-Bot",
            dependencies: [
                .product(name: "APNSwift", package: "apnswift")
            ]
        ),
        .testTarget(
            name: "Knoggl-BotTests",
            dependencies: ["Knoggl-Bot", "APNSwift"]),
    ]
)

The output with -v

lsb_release -r
/usr/share/swift/bin/swiftc -print-target-info
/usr/share/swift/bin/swiftc -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.f9XZQe/dummyInput-1.swift
/usr/share/swift/bin/swiftc -lstdc++ -g -L /home/julian/Schreibtisch/Knoggl-Bot/.build/x86_64-unknown-linux-gnu/release -o /home/julian/Schreibtisch/Knoggl-Bot/.build/x86_64-unknown-linux-gnu/release/Knoggl-Bot -module-name Knoggl_Bot -emit-executable -Xlinker --defsym -Xlinker main=Knoggl_Bot_main -Xlinker '-rpath=$ORIGIN' @/home/julian/Schreibtisch/Knoggl-Bot/.build/x86_64-unknown-linux-gnu/release/Knoggl-Bot.product/Objects.LinkFileList -target x86_64-unknown-linux-gnu -static-executable -L /usr/share/swift/lib
error: link command failed with exit code 1 (use -v to see invocation)
clang-10: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
.build/checkouts/swift-crypto/Sources/CCryptoBoringSSL/crypto/bio/socket_helper.c:55: Warnung: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
.build/checkouts/jwt-kit/Sources/CJWTKitBoringSSL/crypto/bio/socket_helper.c:55: Warnung: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
.build/checkouts/swift-nio-ssl/Sources/CNIOBoringSSL/crypto/bio/socket_helper.c:55: Warnung: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/julian/Schreibtisch/Knoggl-Bot/.build/checkouts/swift-nio/Sources/NIOCore/SocketAddresses.swift:430: Warnung: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/julian/Schreibtisch/Knoggl-Bot/.build/checkouts/swift-nio/Sources/NIOPosix/GetaddrinfoResolver.swift:159: Warnung: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libFoundation.a(FileManager.swift.o):FileManager.swift.o:function $s10Foundation11FileManagerC17_attributesOfItem6atPath26includingPrivateAttributesSDyAA0B12AttributeKeyVypGSS_SbtKF: Warnung: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libFoundation.a(FileManager.swift.o):FileManager.swift.o:function $s10Foundation11FileManagerC17_attributesOfItem6atPath26includingPrivateAttributesSDyAA0B12AttributeKeyVypGSS_SbtKF: Warnung: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libFoundation.a(Host.swift.o):Host.swift.o:function $s10Foundation4HostC8_resolveyyF: Warnung: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFPlatform.c.o):CFPlatform.c:function CFCopyUserName: Warnung: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFPlatform.c.o):CFPlatform.c:function CFCopyUserName: Warnung: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFPlatform.c.o):CFPlatform.c:function CFCopyFullUserName: Warnung: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFPlatform.c.o):CFPlatform.c:function CFCopyFullUserName: Warnung: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFPlatform.c.o):CFPlatform.c:function _CFCopyHomeDirURLForUser: Warnung: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFPlatform.c.o):CFPlatform.c:function _CFCopyHomeDirURLForUser: Warnung: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFBundle_Binary.c.o):CFBundle_Binary.c:function _CFBundleDlfcnCheckLoaded: Warnung: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFBundle_Binary.c.o):CFBundle_Binary.c:function _CFBundleDlfcnLoadBundle: Warnung: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFBundle_Binary.c.o):CFBundle_Binary.c:function _CFBundleDlfcnLoadFramework: Warnung: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libCoreFoundation.a(CFBundle_Main.c.o):CFBundle_Main.c:function CFBundleGetMainBundle: Warnung: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC03rawE0Svvpfi: Fehler: undefined reference to 'CFURLSessionMultiHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking15_BodyFileSourceC13readNextChunk33_4778345EAE5363022BCB039E4AF7D195LLyyF: Fehler: undefined reference to 'CFURLSessionMaxWriteSize'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(BodySource.swift.o):BodySource.swift.o:function $s20FoundationNetworking15_BodyFileSourceC7fileURL9workQueue20dataAvailableHandlerAC0A00G0V_8Dispatch0mI0CyyctcfcTf4gggn_n: Fehler: undefined reference to 'CFURLSessionMaxWriteSize'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(HTTPURLProtocol.swift.o):HTTPURLProtocol.swift.o:function $s20FoundationNetworking15userAgentString33_BC65984C210DBF29197DDF08E9690DF1LL_WZ: Fehler: undefined reference to 'CFURLSessionCurlVersionInfo'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC03rawD0Svvpfi: Fehler: undefined reference to 'CFURLSessionEasyHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11errorBufferSays5UInt8VGvg: Fehler: undefined reference to 'CFURLSessionEasyErrorSize'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC8delegateAcA01_cD8Delegate_p_tcfC: Fehler: undefined reference to 'CFURLSessionEasyHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC8delegateAcA01_cD8Delegate_p_tcfc: Fehler: undefined reference to 'CFURLSessionEasyHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionWRITEDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_ptr'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionEasyCodeOK'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionWRITEFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_wc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionREADDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_ptr'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionREADFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_wc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionHEADERDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_ptr'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionHEADERFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_wc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionSOCKOPTDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_ptr'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionSOCKOPTFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_sc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionSEEKDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionSEEKFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_seek'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionNOPROGRESS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionPROGRESSDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSessionOptionXFERINFOFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_tc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleCfd: Fehler: undefined reference to 'CFURLSessionEasyHandleDeinit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleCfD: Fehler: undefined reference to 'CFURLSessionEasyHandleDeinit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13verboseModeOnySb_tF: Fehler: undefined reference to 'CFURLSessionOptionVERBOSE'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo20CFURLSessionEasyCodeV20FoundationNetworkingE7asErroryyKF: Fehler: undefined reference to 'CFURLSessionEasyCodeOK'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionOptionDEBUGDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionEasyCodeOK'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionOptionDEBUGFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSession_easy_setopt_dc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionOptionDEBUGFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set23passHeadersToDataStreamySb_tF: Fehler: undefined reference to 'CFURLSessionOptionHEADER'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set14followLocationySb_tF: Fehler: undefined reference to 'CFURLSessionOptionFOLLOWLOCATION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set16progressMeterOffySb_tF: Fehler: undefined reference to 'CFURLSessionOptionNOPROGRESS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set21skipAllSignalHandlingySb_tF: Fehler: undefined reference to 'CFURLSessionOptionNOSIGNAL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set11errorBufferySrys5UInt8VGSg_tF: Fehler: undefined reference to 'CFURLSessionOptionERRORBUFFER'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set19failOnHTTPErrorCodeySb_tF: Fehler: undefined reference to 'CFURLSessionOptionFAILONERROR'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set3urly0A03URLV_tF: Fehler: undefined reference to 'CFURLSessionOptionURL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set3urly0A03URLV_tF: Fehler: undefined reference to 'CFURLSessionOptionURL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionProtocolHTTP'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionProtocolHTTPS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionOptionPROTOCOLS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionOptionREDIR_PROTOCOLS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26preferredReceiveBufferSizeySi_tF: Fehler: undefined reference to 'CFURLSessionOptionBUFFERSIZE'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26preferredReceiveBufferSizeySi_tF: Fehler: undefined reference to 'CFURLSessionMaxWriteSize'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26preferredReceiveBufferSizeySi_tF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13customHeadersySaySSG_tF: Fehler: undefined reference to 'CFURLSessionOptionHTTPHEADER'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionACCEPT_ENCODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionHTTP_CONTENT_DECODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionACCEPT_ENCODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionHTTP_CONTENT_DECODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13requestMethodySS_tF: Fehler: undefined reference to 'CFURLSessionOptionCUSTOMREQUEST'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13requestMethodySS_tF: Fehler: undefined reference to 'CFURLSessionOptionCUSTOMREQUEST'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set6noBodyySb_tF: Fehler: undefined reference to 'CFURLSessionOptionNOBODY'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set6uploadySb_tF: Fehler: undefined reference to 'CFURLSessionOptionUPLOAD'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set17requestBodyLengthys5Int64V_tF: Fehler: undefined reference to 'CFURLSessionOptionINFILESIZE_LARGE'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set17requestBodyLengthys5Int64V_tF: Fehler: undefined reference to 'CFURLSession_easy_setopt_int64'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set7timeoutySi_tF: Fehler: undefined reference to 'CFURLSessionOptionTIMEOUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC23getTimeoutIntervalSpentSdyF: Fehler: undefined reference to 'CFURLSessionInfoTOTAL_TIME'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC23getTimeoutIntervalSpentSdyF: Fehler: undefined reference to 'CFURLSession_easy_getinfo_double'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoTEXT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoHEADER_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoDATA_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoSSL_DATA_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoHEADER_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoDATA_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoSSL_DATA_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11_PauseStateV03setF02onyAC_tF: Fehler: undefined reference to 'CFURLSessionEasyHandleSetPauseState'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC19connectFailureErrnoSivg: Fehler: undefined reference to 'CFURLSessionInfoOS_ERRNO'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC19connectFailureErrnoSivg: Fehler: undefined reference to 'CFURLSession_easy_getinfo_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11redirectURL0A00F0VSgvg: Fehler: undefined reference to 'CFURLSessionInfoREDIRECT_URL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11redirectURL0A00F0VSgvg: Fehler: undefined reference to 'CFURLSession_easy_getinfo_charp'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU_: Fehler: undefined reference to 'CFURLSessionWriteFuncPause'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU0_: Fehler: undefined reference to 'CFURLSessionReadFuncPause'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU0_: Fehler: undefined reference to 'CFURLSessionReadFuncAbort'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU1_: Fehler: undefined reference to 'CFURLSessionInfoCONTENT_LENGTH_DOWNLOAD'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU1_: Fehler: undefined reference to 'CFURLSession_easy_getinfo_double'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU1_: Fehler: undefined reference to 'CFURLSessionWriteFuncPause'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFs5Int32VSvSg_s5Int64VAGtcfU3_: Fehler: undefined reference to 'CFURLSessionSeekCantSeek'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFs5Int32VSvSg_s5Int64VAGtcfU3_: Fehler: undefined reference to 'CFURLSessionSeekFail'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function 
$s20FoundationNetworking11_EasyHandleC3set13requestMethodySS_tFySPys4Int8VGXEfU_TA: Fehler: undefined reference to 'CFURLSessionOptionCUSTOMREQUEST'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

Schreibtisch = Desktop
Fehler = Error
Warnung = Warning

When compiling with

swift build

everything works as expected

Thank you for your help!

There are two issues here:

  1. You seem to have a dependency on FoundationNetworking which has a transitive dependency on libcurl. For this to work you also have to statically link in libcurl.
  2. You also have a dependency on libc. When using -static-executable swift will statically link libc which is not really supported and that's why you get these warnings: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking. Which kind of defeats the purpose.

Regarding 1. you can get this to work by checking this post on how to find the transitive dependencies and statically link against them during build.

Regarding 2. In the same thread you can also find a lengthy discussion about the quirks related to -static-executable and libc.

My recommendation would be to NOT use -static-executable but instead use -static-swift-stdlib. The latter will statically link the Swift runtime libraries into your binary, so you can deploy it to a system without Swift installed. You would still need the runtime dependencies (such as libcurl, etc) available for dynamic linking.

In Docker world sth like this works well (see Docker in swift-server/guides)

#------- build -------
FROM swift:centos8 as builder

# set up the workspace
RUN mkdir /workspace
WORKDIR /workspace

# copy the source to the docker image
COPY . /workspace

RUN swift build -c release --static-swift-stdlib

#------- package -------
FROM centos
# copy executables
COPY --from=builder /workspace/.build/release/<executable-name> /

# set the entry point (application name)
CMD ["<executable-name>"]
3 Likes

First of all, thank you for this detailed answer!

I already tried linking the the dependencies from libcurl.

pkg-config --libs --static libcurl

gives me the following result

-lcurl -lnghttp2 -lidn2 -lrtmp -lssh -lpsl -lnettle -lgnutls -Wl,-Bsymbolic-functions -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -llber -lldap -llber -lbrotlidec -lz

When i try compiling with those flags added, i get this result

error: link command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld.gold: Fehler: kann -lnghttp2 nicht finden
/usr/bin/ld.gold: Fehler: kann -lidn2 nicht finden
/usr/bin/ld.gold: Fehler: kann -lrtmp nicht finden
/usr/bin/ld.gold: Fehler: kann -lssh nicht finden
/usr/bin/ld.gold: Fehler: kann -lpsl nicht finden
/usr/bin/ld.gold: Fehler: kann -lnettle nicht finden
/usr/bin/ld.gold: Fehler: kann -lgnutls nicht finden
/usr/bin/ld.gold: Fehler: kann -lgssapi_krb5 nicht finden
/usr/bin/ld.gold: Fehler: kann -lkrb5 nicht finden
/usr/bin/ld.gold: Fehler: kann -lk5crypto nicht finden
/usr/bin/ld.gold: Fehler: kann -lcom_err nicht finden
/usr/bin/ld.gold: Fehler: kann -lbrotlidec nicht finden
+ pretty much the same as above

Fehler: kann -lnghttp2 nicht finden = Error: cannot find -lnghttp2
.......

Do you know how to install all those dependencies?

Also --static-swift-stdlib seems to give me a similar / same result.

This depends on your linux distribution. But I am surprised that it can't find the dependent libraries as they should be installed when you install curl.

Hm, can you share what the output is?

I use Linux Mint 20.2 Cinnamon

Sure, this is the output with swift build -c release --static-swift-stdlib -v
(I had to shorten it)

lsb_release -r
/usr/share/swift/bin/swiftc -print-target-info
/usr/share/swift/bin/swiftc -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.bHextP/dummyInput-1.swift
Planning build
/usr/share/swift/bin/swift-frontend -frontend -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -print-target-info
/usr/share/swift/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.caejfR/dummyInput-2.swift
/usr/share/swift/bin/swiftc -lstdc++ -g -L /home/julian/Schreibtisch/Knoggl-Bot/.build/x86_64-unknown-linux-gnu/release -o /home/julian/Schreibtisch/Knoggl-Bot/.build/x86_64-unknown-linux-gnu/release/Knoggl-Bot -module-name Knoggl_Bot -static-stdlib -emit-executable -Xlinker --defsym -Xlinker main=Knoggl_Bot_main -Xlinker '-rpath=$ORIGIN' @/home/julian/Schreibtisch/Knoggl-Bot/.build/x86_64-unknown-linux-gnu/release/Knoggl-Bot.product/Objects.LinkFileList -target x86_64-unknown-linux-gnu -L /usr/share/swift/lib
error: link command failed with exit code 1 (use -v to see invocation)
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC03rawE0Svvpfi: Fehler: undefined reference to 'CFURLSessionMultiHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC13configuration9workQueueAeC14_ConfigurationV_8Dispatch0jH0CtcfC: Fehler: undefined reference to 'CFURLSessionMultiHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC13configuration9workQueueAeC14_ConfigurationV_8Dispatch0jH0Ctcfc: Fehler: undefined reference to 'CFURLSessionMultiHandleInit'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSessionMultiOptionSOCKETDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSession_multi_setopt_ptr'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSessionMultiCodeOK'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSessionMultiOptionSOCKETFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSession_multi_setopt_sf'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSessionMultiOptionTIMERDATA'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSession_multi_setopt_ptr'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSessionMultiOptionTIMERFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC14setupCallbacks33_76FB65EF45BDE9115477B690E87F5E28LLyyF: Fehler: undefined reference to 'CFURLSession_multi_setopt_tf'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC9configure4withyAC14_ConfigurationV_tF: Fehler: undefined reference to 'CFURLSessionMultiOptionMAX_HOST_CONNECTIONS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC9configure4withyAC14_ConfigurationV_tF: Fehler: undefined reference to 'CFURLSession_multi_setopt_l'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(MultiHandle.swift.o):MultiHandle.swift.o:function $s20FoundationNetworking10URLSessionC12_MultiHandleC9configure4withyAC14_ConfigurationV_tF: Fehler: undefined reference to 'CFURLSessionMultiCodeOK'

/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionEasyCodeOK'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionOptionDEBUGFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSession_easy_setopt_dc'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13debugOutputOn4taskySb_AA14URLSessionTaskCtF: Fehler: undefined reference to 'CFURLSessionOptionDEBUGFUNCTION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set23passHeadersToDataStreamySb_tF: Fehler: undefined reference to 'CFURLSessionOptionHEADER'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set14followLocationySb_tF: Fehler: undefined reference to 'CFURLSessionOptionFOLLOWLOCATION'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set16progressMeterOffySb_tF: Fehler: undefined reference to 'CFURLSessionOptionNOPROGRESS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set21skipAllSignalHandlingySb_tF: Fehler: undefined reference to 'CFURLSessionOptionNOSIGNAL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set11errorBufferySrys5UInt8VGSg_tF: Fehler: undefined reference to 'CFURLSessionOptionERRORBUFFER'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set19failOnHTTPErrorCodeySb_tF: Fehler: undefined reference to 'CFURLSessionOptionFAILONERROR'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set3urly0A03URLV_tF: Fehler: undefined reference to 'CFURLSessionOptionURL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set3urly0A03URLV_tF: Fehler: undefined reference to 'CFURLSessionOptionURL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionProtocolHTTP'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionProtocolHTTPS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionOptionPROTOCOLS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSessionOptionREDIR_PROTOCOLS'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC33setAllowedProtocolsToHTTPAndHTTPSyyF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26preferredReceiveBufferSizeySi_tF: Fehler: undefined reference to 'CFURLSessionOptionBUFFERSIZE'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26preferredReceiveBufferSizeySi_tF: Fehler: undefined reference to 'CFURLSessionMaxWriteSize'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26preferredReceiveBufferSizeySi_tF: Fehler: undefined reference to 'CFURLSession_easy_setopt_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13customHeadersySaySSG_tF: Fehler: undefined reference to 'CFURLSessionOptionHTTPHEADER'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionACCEPT_ENCODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionHTTP_CONTENT_DECODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionACCEPT_ENCODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set26automaticBodyDecompressionySb_tF: Fehler: undefined reference to 'CFURLSessionOptionHTTP_CONTENT_DECODING'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13requestMethodySS_tF: Fehler: undefined reference to 'CFURLSessionOptionCUSTOMREQUEST'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13requestMethodySS_tF: Fehler: undefined reference to 'CFURLSessionOptionCUSTOMREQUEST'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set6noBodyySb_tF: Fehler: undefined reference to 'CFURLSessionOptionNOBODY'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set6uploadySb_tF: Fehler: undefined reference to 'CFURLSessionOptionUPLOAD'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set17requestBodyLengthys5Int64V_tF: Fehler: undefined reference to 'CFURLSessionOptionINFILESIZE_LARGE'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set17requestBodyLengthys5Int64V_tF: Fehler: undefined reference to 'CFURLSession_easy_setopt_int64'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set7timeoutySi_tF: Fehler: undefined reference to 'CFURLSessionOptionTIMEOUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC23getTimeoutIntervalSpentSdyF: Fehler: undefined reference to 'CFURLSessionInfoTOTAL_TIME'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC23getTimeoutIntervalSpentSdyF: Fehler: undefined reference to 'CFURLSession_easy_getinfo_double'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoTEXT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoHEADER_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoDATA_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoSSL_DATA_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoHEADER_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoDATA_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $sSo16CFURLSessionInfoV20FoundationNetworkingE11debugHeaderSSvg: Fehler: undefined reference to 'CFURLSessionInfoSSL_DATA_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11_PauseStateV03setF02onyAC_tF: Fehler: undefined reference to 'CFURLSessionEasyHandleSetPauseState'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC19connectFailureErrnoSivg: Fehler: undefined reference to 'CFURLSessionInfoOS_ERRNO'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC19connectFailureErrnoSivg: Fehler: undefined reference to 'CFURLSession_easy_getinfo_long'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11redirectURL0A00F0VSgvg: Fehler: undefined reference to 'CFURLSessionInfoREDIRECT_URL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC11redirectURL0A00F0VSgvg: Fehler: undefined reference to 'CFURLSession_easy_getinfo_charp'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU_: Fehler: undefined reference to 'CFURLSessionWriteFuncPause'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU0_: Fehler: undefined reference to 'CFURLSessionReadFuncPause'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU0_: Fehler: undefined reference to 'CFURLSessionReadFuncAbort'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU1_: Fehler: undefined reference to 'CFURLSessionInfoCONTENT_LENGTH_DOWNLOAD'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU1_: Fehler: undefined reference to 'CFURLSession_easy_getinfo_double'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFSiSpys4Int8VG_S2iSvSgtcfU1_: Fehler: undefined reference to 'CFURLSessionWriteFuncPause'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFs5Int32VSvSg_s5Int64VAGtcfU3_: Fehler: undefined reference to 'CFURLSessionSeekCantSeek'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFs5Int32VSvSg_s5Int64VAGtcfU3_: Fehler: undefined reference to 'CFURLSessionSeekFail'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFs5Int32VSvSg_s5Int64VAGtcfU3_: Fehler: undefined reference to 'CFURLSessionSeekCantSeek'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC14setupCallbacks33_D9E5C2617EDF43EF06D31AE9AD581FE0LLyyFs5Int32VSvSg_s5Int64VAGtcfU3_: Fehler: undefined reference to 'CFURLSessionSeekOk'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC15_CurlStringListCyAESaySSGcfc: Fehler: undefined reference to 'CFURLSessionSListAppend'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC15_CurlStringListCyAESaySSGcfc: Fehler: undefined reference to 'CFURLSessionSListAppend'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC15_CurlStringListC6appendyySSF: Fehler: undefined reference to 'CFURLSessionSListAppend'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC15_CurlStringListCfd: Fehler: undefined reference to 'CFURLSessionSListFreeAll'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC15_CurlStringListCfD: Fehler: undefined reference to 'CFURLSessionSListFreeAll'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set3urly0A03URLV_tFySPys4Int8VGXEfU_TA: Fehler: undefined reference to 'CFURLSessionOptionURL'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoTEXT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoHEADER_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoDATA_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoSSL_DATA_OUT'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoHEADER_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoDATA_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking17printLibcurlDebug33_D9E5C2617EDF43EF06D31AE9AD581FE0LL6handle4type4data4size8userInfos5Int32VSv_AJSpys4Int8VGSiSvSgtFTf4dnnnn_n: Fehler: undefined reference to 'CFURLSessionInfoSSL_DATA_IN'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC15_CurlStringListCyAESaySSGcfCTf4gd_n: Fehler: undefined reference to 'CFURLSessionSListAppend'
/usr/share/swift/lib/swift_static/linux/libFoundationNetworking.a(EasyHandle.swift.o):EasyHandle.swift.o:function $s20FoundationNetworking11_EasyHandleC3set13requestMethodySS_tFySPys4Int8VGXEfU_TA: Fehler: undefined reference to 'CFURLSessionOptionCUSTOMREQUEST'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

I ran into a similar problem using Docker.

I tried to take a look with my projects. I'm cross-compiling here and supplying --static-swift-stdlib creates an error with regards to SwiftShims:

<unknown>:0: error: missing required module 'SwiftShims'

Any idea what that could mean? For the records… my invocation is

swift build -v -c release --static-swift-stdlib --destination /Library/Developer/Destinations/arm64-5.5.2-RELEASE.json

I‘ve been playing with this as well and I also ran into problems with some of my projects (which worked fine with -static-stdlib on Swift 5.4. I will need to dig a bit deeper because it was really confusing and I could not focus on this today and will share more.

3 Likes

I use swift5.5.2-centos7 to compile vapor and have the same problem.

/usr/bin/swiftc -lstdc++ -g -L /workspace/.build/x86_64-unknown-linux-gnu/release -o /workspace/.build/x86_64-unknown-linux-gnu/release/Run -module-name Run -static-stdlib -emit-executable -Xlinker --defsym -Xlinker main=Run_main -Xlinker '-rpath=$ORIGIN' @/workspace/.build/x86_64-unknown-linux-gnu/release/Run.product/Objects.LinkFileList -target x86_64-unknown-linux-gnu -lz -L /usr/lib
error: link command failed with exit code 254 (use -v to see invocation)
clang-10: error: unable to execute command: Killed
clang-10: error: linker command failed due to signal (use -v to see invocation)
[root@bd14fe7bd421 workspace]# 

Yup, I see exactly the same error after upgrading from 5.4 -> 5.5.2. I also started to adopt async/await in the meantime, so I am trying to see if this is somehow related.

UPDATE

With some help from @johannesweiss and @drexin, the workaround for my async problem described below is to add an explicit import Dispatch to the file.


There might some kind of regression here. This simple program:

# app.swift
@main
struct App {
  static func main() async throws {
    print("Hello")
    try await Task.sleep(nanoseconds: 1_000_000_000)
    print("Bye!")
  }
}

cannot be compiled on linux with --static-swift-stdlib:

Output
swift build -c release --static-swift-stdlib -v
lsb_release -r
/usr/bin/swiftc -print-target-info
/usr/bin/swiftc -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.3N5phf/dummyInput-1.swift
Planning build
/usr/bin/swiftc -L /usr/lib/swift/pm/ManifestAPI -lPackageDescription -Xlinker -rpath -Xlinker /usr/lib/swift/pm/ManifestAPI -swift-version 5 -I /usr/lib/swift/pm/ManifestAPI -package-description-version 5.5.0 /app/Package.swift -Xfrontend -disable-implicit-concurrency-module-import -o /tmp/TemporaryDirectory.lzqv4h/app-manifest
/tmp/TemporaryDirectory.lzqv4h/app-manifest -fileno 13
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.o1LiJf/dummyInput-2.swift
/usr/bin/swiftc -g -L /app/.build/aarch64-unknown-linux-gnu/release -o /app/.build/aarch64-unknown-linux-gnu/release/static-test -module-name static_test -static-stdlib -emit-executable -Xlinker --defsym -Xlinker main=static_test_main -Xlinker '-rpath=$ORIGIN' @/app/.build/aarch64-unknown-linux-gnu/release/static-test.product/Objects.LinkFileList -target aarch64-unknown-linux-gnu -L /usr/lib
error: link command failed with exit code 1 (use -v to see invocation)
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_queue_attr_make_with_qos_class'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_queue_create'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_queue_set_width'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalImpl(swift::Job*): error: undefined reference to 'dispatch_release'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_time'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_after_f'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to '_dispatch_queue_attr_concurrent'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_queue_attr_make_with_qos_class'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_queue_create'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_queue_set_width'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueGlobalWithDelayImpl(unsigned long long, swift::Job*): error: undefined reference to 'dispatch_release'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueMainExecutor: error: undefined reference to '_dispatch_main_q'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueMainExecutor: error: undefined reference to '_dispatch_main_q'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueMainExecutorImpl(swift::Job*): error: undefined reference to '_dispatch_main_q'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function swift_task_enqueueMainExecutorImpl(swift::Job*): error: undefined reference to '_dispatch_main_q'
/usr/lib/swift_static/linux/libswift_Concurrency.a(GlobalExecutor.cpp.o):GlobalExecutor.cpp:function dispatchEnqueueDispatchAsync(dispatch_queue_s*, void*, unsigned int): error: undefined reference to 'dispatch_async_f'
/usr/lib/swift_static/linux/libswift_Concurrency.a(Task.cpp.o):Task.cpp:function swift_task_asyncMainDrainQueueImpl(): error: undefined reference to 'dispatch_main'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

If I remove the async code from the example, it compiles fine:

import Foundation

@main
struct App {
  static func main()  {
    print("Hello")
    Thread.sleep(forTimeInterval: 1)
    print("Bye!")
  }
}
Output
$ swift build -c release --static-swift-stdlib -v
lsb_release -r
/usr/bin/swiftc -print-target-info
/usr/bin/swiftc -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.iW25ig/dummyInput-1.swift
Planning build
/usr/bin/swiftc -L /usr/lib/swift/pm/ManifestAPI -lPackageDescription -Xlinker -rpath -Xlinker /usr/lib/swift/pm/ManifestAPI -swift-version 5 -I /usr/lib/swift/pm/ManifestAPI -package-description-version 5.5.0 /app/Package.swift -Xfrontend -disable-implicit-concurrency-module-import -o /tmp/TemporaryDirectory.xEguEh/app-manifest
/tmp/TemporaryDirectory.xEguEh/app-manifest -fileno 14
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -print-target-info
/usr/bin/swift-frontend -frontend -emit-supported-features /tmp/TemporaryDirectory.cADivj/dummyInput-2.swift
/usr/bin/swiftc -module-name static_test -incremental -emit-dependencies -emit-module -emit-module-path /app/.build/aarch64-unknown-linux-gnu/release/static_test.swiftmodule -output-file-map /app/.build/aarch64-unknown-linux-gnu/release/static_test.build/output-file-map.json -whole-module-optimization -num-threads 4 -c /app/Sources/static-test/program.swift -I /app/.build/aarch64-unknown-linux-gnu/release -target aarch64-unknown-linux-gnu -swift-version 5 -O -g -j4 -DSWIFT_PACKAGE -module-cache-path /app/.build/aarch64-unknown-linux-gnu/release/ModuleCache -static-stdlib -parseable-output -Xfrontend -entry-point-function-name -Xfrontend static_test_main -parse-as-library -color-diagnostics
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization/usr/bin/swift-frontend -frontend -c /app/Sources/static-test/program.swift -emit-module-path /app/.build/aarch64-unknown-linux-gnu/release/static_test.swiftmodule -emit-module-doc-path /app/.build/aarch64-unknown-linux-gnu/release/static_test.swiftdoc -emit-module-source-info-path /app/.build/aarch64-unknown-linux-gnu/release/static_test.swiftsourceinfo -emit-dependencies-path /app/.build/aarch64-unknown-linux-gnu/release/static_test.build/static_test.d -target aarch64-unknown-linux-gnu -Xllvm -aarch64-use-tbi -disable-objc-interop -I /app/.build/aarch64-unknown-linux-gnu/release -color-diagnostics -g -module-cache-path /app/.build/aarch64-unknown-linux-gnu/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -new-driver-path /usr/bin/swift-driver -entry-point-function-name static_test_main -resource-dir /usr/lib/swift_static -use-static-resource-dir -module-name static_test -parse-as-library -num-threads 4 -o /app/.build/aarch64-unknown-linux-gnu/release/static_test.build/program.swift.o
/usr/bin/swift-autolink-extract /app/.build/aarch64-unknown-linux-gnu/release/static_test.build/program.swift.o -o /app/.build/aarch64-unknown-linux-gnu/release/static_test.build/static_test.autolink
/usr/bin/swiftc -g -L /app/.build/aarch64-unknown-linux-gnu/release -o /app/.build/aarch64-unknown-linux-gnu/release/static-test -module-name static_test -static-stdlib -emit-executable -Xlinker --defsym -Xlinker main=static_test_main -Xlinker '-rpath=$ORIGIN' @/app/.build/aarch64-unknown-linux-gnu/release/static-test.product/Objects.LinkFileList -target aarch64-unknown-linux-gnu -L /usr/lib
[0/0] Build complete!

Side note, I am not sure why I see these warnings:

remark: Incremental compilation has been disabled: it is not compatible with whole module 
optimization
$ swift --version
Swift version 5.5.2 (swift-5.5.2-RELEASE)
Target: aarch64-unknown-linux-gnu

(same result when running on intel)

@juliangerhards I am afraid that according to @johannesweiss:

FoundationNetworking isn't really compatible with -static-stdlib (or -static-executable )
it's supposed to work if you never import FoundationNetworking / import FoundationXML

So your best bet is to use a different packaging strategy, see Guides or use AsyncHTTPClient instead of URLSession.


@mickeyl

I also saw this once, too, but after cleaning the .build directory it disappeared.


@vine After more banging my head against it and trying different Swift versions etc... it finally hit me.

The fact that there is no real error shown here and just an ominous Killed finally made me realise that this might be a memory issue and the linker process is killed because the machine runs out of memory. If you are running in Docker on Mac try increasing the allocated RAM for the Docker VM. This fixed the problem for me.

2 Likes

Yes, I use mac. One server can compile, but one cannot. The server is 2 core 4G

This is sad.. Whatever i give up and just install Swift on my server.. :smiley: Or maybe switch to Go again.

But thank you very much for your time!

you can copy runtime

ldd .build/install/Run | grep swift | awk '{print $3}' | xargs cp -Lv -t .build/install/

It is indeed a memory problem. Is there a solution?

Increase memory of your Docker instance to 6GB. This worked for me.

I got the same issue and tested on ubuntu server 20.04:

dependency: libcurl4-openssl-dev

build flags: swift build -c release -Xswiftc -static-stdlib

fail: 5.5
fail: 5.5.1
fail: 5.5.2
success: 5.5.3

1 Like

Wow thanks! It actually works in 5.5.3!