-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static Linking doesn't work yet #3
Comments
It's on my todo list as well. @fabianfett post compilation flags he used: swift-server/swift-aws-lambda-runtime#17 (comment) |
I can confirm that adding
fixed static compilation in my setup on swift:5.2-amazonlinux2 docker image with
build with:
|
Didn't know about that static-executable-args.lnk file. Might be enough to just put that into the xtoolchain? |
Looks like |
I did a quick test last week, it worked, it did noticeably improve cold start, QED. Revisited it today with partial success.
Examples: all static
static + dyn
static + dyn including libuuid
all dyn
Now I guess I should have mentioned that and it does make big difference, So while the approach above should be useful, I have not yet done it with |
Yes, I was specifically trying with Foundation (with static linking there should be very little reason to avoid it in the first place). This introduces the problematic libuuid dependency. I should eventually disable SIP and check what the linker is actually doing. Not sure when I'll find the time. |
Hm, why is |
FWIW, AFAIK Swift 5.3 brought static linking fixes, which might solve the whole Radar. Need to figure out the required flags. https://forums.swift.org/t/static-linking-on-linux-in-swift-5-3-1/41989
So we probably need the first when building for a regular Ubuntu and the latter for Amazon Linux 🤔 |
No idea whether this is good, was flying around here :-) We need proper static linking support which should be available now as part of the 5.3 fixes (Issue #3).
Which we have in
Note sure why this works for dynamic, but not for static. The include is from the |
It gets a little further when specifying |
Hi there, has there been any new success with getting Foundation to compile statically for AWS lambdas? |
That's something @fabianfett might be able to answer. I think it is possible, but maybe not with the current SPMDestinations toolchain version, that needs an update eventually. |
All the required static libs should be available in the SDK / X toolchain, but I still got linking error. Need to find the right combination of flags.
The text was updated successfully, but these errors were encountered: