Closed jcavar closed 4 years ago
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
@jcavar As noted in the README, static linking requires some additional linker flags to work, but it is not fundamentally broken. You can statically link an executable with SPM by telling the compiler directly to do it with -Xswiftc -static-executable
instead of --static-swift-stdlib
. In addition to that you may have to pass additional library dependencies to the linker with -Xlinker
, e.g. when using Dispatch, you have to pass -Xlinker -lDispatchStubs
. This is of course not optimal and we hope to have a better solution in the future, but it allows executables to be statically linked.
Oh, I see! Thank you very much.
Static linking does work and improves performance, however the doc should probably be updated to include information how to do it:
-static-executable
instead of --static-swift-stdlib
-lDispatchStubs
and -latomic
@drexin
what is DispatchStubs
?
what does it "stub"?
Static linking doesn't work on Linux
Motivation:
It is currently not possible to statically link binaries on Linux due to this bug:
https://bugs.swift.org/browse/SR-648
Modifications:
README only.
Result:
README only. I am not sure if it is worth adding note about that to README?