Skip to content
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

[SR-6481] Statically linked stdlib fails for cross-compilation from OSX to Ubuntu #49031

Open
swift-ci opened this issue Nov 28, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-6481
Radar None
Original Reporter george (JIRA User)
Type Bug
Environment

Running on OSX, compiling to Ubuntu 16.0.4

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 6006b8d3526015b6f7f6cf35e7379a7e

is duplicated by:

  • SR-6851 Implementing Collection and SetAlgebra on generic class type parameter makes isEmpty ambiguous

relates to:

Issue Description:

Prelude (on OSX)

*Note*: swift 4.0.2 is used as an example, the `build_ubuntu_cross_compilation_toolchain` script is from `e36eebf5` (mid-november 2017)

1. `curl -o swift-4.0.2-RELEASE-ubuntu16.04.tar.gz https://swift.org/builds/swift-4.0.2-release/ubuntu1604/swift-4.0.2-RELEASE/swift-4.0.2-RELEASE-ubuntu16.04.tar.gz`

2. `curl -o swift-4.0.2-RELEASE-osx.pkg https://swift.org/builds/swift-4.0.2-release/xcode/swift-4.0.2-RELEASE/swift-4.0.2-RELEASE-osx.pkg`

3. `<path_to_swiftpm>/Utilities/build_ubuntu_cross_compilation_toolchain /tmp/ swift-4.0.2-RELEASE-osx.pkg swift-4.0.2-RELEASE-ubuntu16.04.tar.gz`

4. `mkdir Test`

5. `cd Test`

6. `swift package init --type=executable`

First broken case: --static-swift-stdlib

7. `swift build --static-swift-stdlib --destination=/tmp/cross-toolchain/ubuntu-xenial-destination.json`

8. Upload resulting binary to Ubuntu, I prefer to use docker to test with the `ubuntu:16.04` image: `docker run -ti -v (pwd):/test ubuntu:16.04 /test/.build/linux-unknown-x86_64/debug/Test`

*Observed*: `/test/.build/linux-unknown-x86_64/debug/Test: error while loading shared libraries: libswiftCore.so: cannot open shared object file: No such file or directory`

*Expected*: Binary prints "Hello, World!"

Note: Running on docker image `swift:4.0.2` with LD_LIBRARY_PATH pointing to libswiftCore.so works as expected

Second broken case: partial workaround with -Xswiftc -static-stdlib

7. `swift build -Xswiftc -static-stdlib --destination=/Users/george/Developer/Apple/cross-toolchain/ubuntu-xenial-destination.json`

*Observed*: `

clang: error: no such file or directory: '/usr/lib/x86_64-linux-gnu/libicui18n.a'

clang: error: no such file or directory: '/usr/lib/x86_64-linux-gnu/libicuuc.a'

clang: error: no such file or directory: '/usr/lib/x86_64-linux-gnu/libicudata.a'

`

Note that clang is looking for the libraries in `/usr/lib`, but the files are located in `/tmp/cross-toolchain/ubuntu-xenial.sdk/usr/lib/`

*Expected*: The executable is compiled successfully

@belkadan
Copy link
Contributor

This isn't a supported configuration, so whoever owns that script is going to have to help figure it out.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants