-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-2280] swiftc -static-stdlib option fails on Ubuntu 14.04 & 15.10 #44887
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
Comments
Comment by Joel Hughes (JIRA) This issue appears to be resolved in latest preview, at least for me using: ```
echo 'print("hello")' > main.swift |
Comment by Joel Hughes (JIRA) However, when coping the resulting binary to a basic ubuntu docker container the binary still has unresolved dependencies: ``` |
Maybe libicu is not installed in your docker container or the path is incorrect? Use ldd to see the full pathnames of the libs e.g.:
|
Comment by Joel Hughes (JIRA) That's right, so I shouldn't have expected a static bin with no dependency on libicui18n.so? |
-static-stdlib only links in libswiftCore.a it doesn't generate fully static binaries. Ive been having a look at this and I was able to statically link in the libicu library and its extra data file. The problem is that the swift runtime actually uses dlopen()/dlsym() to examine its own binary to find the protocol and metadata information contained in other ELF segments and libdl will complain if it is linked into a static binary I have made some random notes here: http://si.org/posts/2016/09/swift_static_binary where I get as far as linking in libicu |
#5269 should fix this. It tries to find the .a files for ICU and creates a file of linker arguments:
The large filesize is due to the libicudata |
This is resolved right? |
Yes I would say so. On ubuntu, the ICU libraries should be statically linked in now when -static-stdlib is used which I think solves the issue. If a developer doesnt want this behaviour they can always edit the
file and change the libs back to the dynamic ones. |
Environment
Ubuntu 14.04, Ubuntu 15.10
Additional Detail from JIRA
md5: 12b3c71761ce9762d3e3755bd28b44eb
blocks:
relates to:
Issue Description:
The `-static-stdlib` option fails on Ubuntu 14.04 and on 15.10 (on macOS it works). This is using the latest nightly toolchain (`LLVM 3a878c6fdb, Clang cb02d1caed, Swift 8436ef8`).
To reproduce:
The result is this:
Passing `-v` yields this:
The text was updated successfully, but these errors were encountered: