Open kkebo opened 3 months ago
This is a known issue with the Swift toolchain, which is why Fedora installs it in /usr/libexec/swift/5.8.1/
instead.
Thank you for the information.
However, when it comes to swift-docker, I think this problem can be solved with small modifications like this:
diff --git a/nightly-main/ubuntu/22.04/Dockerfile b/nightly-main/ubuntu/22.04/Dockerfile
index 31496b5..1088ee2 100644
--- a/nightly-main/ubuntu/22.04/Dockerfile
+++ b/nightly-main/ubuntu/22.04/Dockerfile
@@ -59,8 +59,8 @@ RUN set -e; \
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
&& gpg --batch --verify latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
# - Unpack the toolchain, set libs permissions, and clean up.
- && tar -xzf latest_toolchain.tar.gz --directory / --strip-components=1 \
- && chmod -R o+r /usr/lib/swift \
+ && tar -xzf latest_toolchain.tar.gz --directory /usr/local --strip-components=2 \
+ && chmod -R o+r /usr/local/lib/swift \
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz \
&& apt-get purge --auto-remove -y curl
Feel free to submit a pull, and someone may review it.
I was wrong. My suggestion will be a breaking change if there's a user who expects swift
to be in /usr/bin/swift
.
That's why Fedora adds symlinks into /usr/bin/
.
I don't think so. Fedora's package manager always needs to install packages under /usr
, but docker images don't have such restrictions. The whole problem with swift-docker is just a compatibility issue.
Right, Fedora worked around this issue already by installing the Swift toolchain into /usr/libexec/swift/5.8.1/
instead and symlinking Swift executables into /usr/bin/
. These docker images could do the same.
It might be worth considering if we could do a one-time change of install locations for Swift 6 cc @shahmishal
Right, Fedora worked around this issue already by installing the Swift toolchain into /usr/libexec/swift/5.8.1/ instead and symlinking Swift executables into /usr/bin/. These docker images could do the same.
Like swift-ci images, if Swift executables are installed into $SWIFT_PREFIX/
and $SWIFT_PREFIX/usr/bin
has a higher priority position than /usr/bin
in $PATH
, it may be acceptable to copy the executable to /usr/bin
for compatibility.
However, we may not be able to use symbolic links for that purpose. Because symlinking Swift executables does not work in Swift 6.0 due to apple/swift#70932 at least for now. It has been fixed on the main branch, but not on the release/6.0 branch.
Currently, a swift toolchain is installed under
/usr/bin
.https://github.com/apple/swift-docker/blob/88941f87eaded894699adae832cd0a820ee544ae/nightly-6.0/ubuntu/22.04/Dockerfile#L62
This is a problem because apt packages overwrites them. For example,
apt-get install llvm
overwrites Swift's builtin LLVM tools by themselves so that LLVM tools is downgraded from 17 to 14.