swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.13k stars 102 forks source link

Remove section about static linking #143

Closed jcavar closed 4 years ago

jcavar commented 4 years ago

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?

swift-server-bot commented 4 years ago

Can one of the admins verify this patch?

swift-server-bot commented 4 years ago

Can one of the admins verify this patch?

swift-server-bot commented 4 years ago

Can one of the admins verify this patch?

swift-server-bot commented 4 years ago

Can one of the admins verify this patch?

drexin commented 4 years ago

@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.

jcavar commented 4 years ago

Oh, I see! Thank you very much.

pokryfka commented 4 years ago

Static linking does work and improves performance, however the doc should probably be updated to include information how to do it:

pokryfka commented 4 years ago

@drexin

what is DispatchStubs? what does it "stub"?