Fixed missing -lcurl when building with -static-stdlib and FoundationNetworking #206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
swift:nightly
now allows building standalone/statically linked executables with something likeHowever, if you import FoundationNetworking in your sources, that makes you add more libraries explicitly for linking to resolve the missing symbols:
and yet that is not enough, because it can not resolve
-lcurl
that is probably originating from https://github.com/apple/swift-corelibs-foundation/blob/76068b8caf54f250a7be5336a7c6bb97f55469f8/CoreFoundation/URL.subproj/static/module.mapIt manifests as something like below (I quote just a part of long list of missing
curl_
family of functions):This PR solves it by adding dev package for libcurl (libcurl4-openssl-dev, containing static variant of the library) into the image.
I'm not sure about the flavor though given that there're three variants for Ubuntu:
P.S. You can take a look at the sample reproducing the problem here: https://github.com/grigorye/SwiftDockerLCURLSample
To reproduce the problem, clone the repo and do
docker build .
: