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

Global ld.conf or switching symlinks to activate toolchain #68

Open
freef4ll opened this issue Sep 28, 2023 · 2 comments
Open

Global ld.conf or switching symlinks to activate toolchain #68

freef4ll opened this issue Sep 28, 2023 · 2 comments

Comments

@freef4ll
Copy link

In case application has been built by swift container, global library path needs to be deployed in order to find the Swift runtime in order to run the application not inside a container.

For example the RPATH will be set to /usr/lib/swift/linux, and if the toolchain is going to be deployed by Swiftly under /usr/local, it is not possible to execute binaries which are built by the container:

$ chrpath -l MySwiftBinary 
MySwiftBinary: RUNPATH=/usr/lib/swift/linux:$ORIGIN

One either needs to have a global entry like this (to avoid setting LD_LIBRARY_PATH for each application):

$ cat /etc/ld.so.conf.d/swift.conf 
/usr/local/share/toolchains/5.9.0/usr/lib/swift/linux

It would be nice that swiftly use would handle this use case.

@patrickfreed
Copy link
Collaborator

Swift on Linux doesn't have a stable ABI, so I'm not actually sure this is a use case that we want to encourage. For example, if the versions of the Swift runtime differed between the container and the deployed system, my understanding is that it may not / won't work. Instead, the binary should be compiled on the deployment hosts using the swiftly-installed toolchain, or the executable should be built in the container using --static-swift-stdlib.

@freef4ll
Copy link
Author

Haven't had problems with minor versions, for example built with 5.8.1 and executed fine on a host that lagged(unintentionally) and had 5.8.0. I understand that there is no guarantees, but adding an additional 74MB on each binary adds large overhead for CI/CD pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants