Hi everybody,
I have set up a new Swift apt package repository for easy install of Swift on Ubuntu/Debian Linux distributions using the apt package manager.
Repository Install and Usage
There are 2 simple steps to use the repository:-
Install the package repository using the quick install script. curl -s https://swiftlang.xyz/install.sh | sudo bash
Install Swift sudo apt install swiftlang
The repository supports the following distributions and architectures -
The main motivation behind creating this repository is as a 'proof of concept' for an official Swift.org apt repository. To explore and test the technologies required and provide a real world testing environment.
Please try out the repository and provide feedback on your experiences.
I have included a live Usage Statistics page on the website to track usage and get an idea of what hardware requirements will be needed.
Thanks for your time and I look forward to your feedback.
I have just pushed Swift version 5.4.2 to the swiftlang.xyz repository.
You can install Swift 5.4.2 using sudo apt update and then sudo apt upgrade.
If you just want to update Swift and not any other packages that might be available, use sudo apt install swiftlang
# check current swift version
ubuntu@ip-172-31-17-153:~$ swift --version
Swift version 5.4.1 (swift-5.4.1-RELEASE)
Target: x86_64-unknown-linux-gnu
# run update
ubuntu@ip-172-31-17-153:~$ sudo apt update
Hit:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 https://swiftlang.xyz/ubuntu focal InRelease [5156 B]
Get:6 https://swiftlang.xyz/ubuntu focal/main amd64 Packages [523 B]
Fetched 334 kB in 1s (347 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
# update available
ubuntu@ip-172-31-17-153:~$ apt list --upgradable -a
Listing... Done
swiftlang/release 5.4.2-01-ubuntu-focal amd64 [upgradable from: 5.4.1-01-ubuntu-focal]
swiftlang/now 5.4.1-01-ubuntu-focal amd64 [installed,upgradable to: 5.4.2-01-ubuntu-focal]
# run upgrade
ubuntu@ip-172-31-17-153:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
swiftlang
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 342 MB of archives.
After this operation, 42.0 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://swiftlang.xyz/ubuntu focal/main amd64 swiftlang amd64 5.4.2-01-ubuntu-focal [342 MB]
Fetched 342 MB in 38s (8983 kB/s)
(Reading database ... 97764 files and directories currently installed.)
Preparing to unpack .../swiftlang_5.4.2-01-ubuntu-focal_amd64.deb ...
Unpacking swiftlang (5.4.2-01-ubuntu-focal) over (5.4.1-01-ubuntu-focal) ...
Setting up swiftlang (5.4.2-01-ubuntu-focal) ...
Processing triggers for man-db (2.9.1-1) ...
# check new swift version
ubuntu@ip-172-31-17-153:~$ swift --version
Swift version 5.4.2 (swift-5.4.2-RELEASE)
Target: x86_64-unknown-linux-gnu
Developer Snapshot Updated to Swift 5.5-2021-07-15-a
I have just pushed the latest Swift developer snapshot to the swiftlang.xyz repository.
If you the developer repository installed (curl -s https://swiftlang.xyz/install-dev.sh | sudo bash) you can install latest snapshot using sudo apt update and then sudo apt upgrade.
# check current swift version
ubuntu@ip-172-31-24-100:~$ swift --version
Swift version 5.5-dev (LLVM d26cc0e18da572f, Swift 6a80196da3cbbb3)
Target: x86_64-unknown-linux-gnu
# run update
ubuntu@ip-172-31-24-100:~$ sudo apt update
Hit:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 https://swiftlang.xyz/ubuntu focal InRelease [5156 B]
Get:6 https://swiftlang.xyz/ubuntu focal/dev amd64 Packages [528 B]
Fetched 334 kB in 1s (333 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
# update available
ubuntu@ip-172-31-24-100:~$ apt list --upgradable -a
Listing... Done
swiftlang/release 5.5-2021-07-15-a-ubuntu-focal amd64 [upgradable from: 5.5-2021-07-09-a-ubuntu-focal]
swiftlang/now 5.5-2021-07-09-a-ubuntu-focal amd64 [installed,upgradable to: 5.5-2021-07-15-a-ubuntu-focal]
swiftlang/release 5.4.2-01-ubuntu-focal amd64
# run upgrade
ubuntu@ip-172-31-24-100:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
swiftlang
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 334 MB of archives.
After this operation, 5146 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://swiftlang.xyz/ubuntu focal/dev amd64 swiftlang amd64 5.5-2021-07-15-a-ubuntu-focal [334 MB]
Fetched 334 MB in 36s (9389 kB/s)
(Reading database ... 97795 files and directories currently installed.)
Preparing to unpack .../swiftlang_5.5-2021-07-15-a-ubuntu-focal_amd64.deb ...
Unpacking swiftlang (5.5-2021-07-15-a-ubuntu-focal) over (5.5-2021-07-09-a-ubuntu-focal) ...
Setting up swiftlang (5.5-2021-07-15-a-ubuntu-focal) ...
Processing triggers for man-db (2.9.1-1) ...
# check new swift version
ubuntu@ip-172-31-24-100:~$ swift --version
Swift version 5.5-dev (LLVM 473bb9eb9557b06, Swift b14f2b993493ef5)
Target: x86_64-unknown-linux-gnu
The repository did not work for me (Ubuntu Hirsute):
curl ... ok
sudo apt update errors:
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://archive.swiftlang.xyz/ubuntu hirsute InRelease' doesn't support architecture 'i386'
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://swiftlang.xyz/ubuntu hirsute InRelease' doesn't support architecture 'i386'
I had to update /etc/apt/sources.list.d/swiftlang-release.list:
< deb https://archive.swiftlang.xyz/ubuntu/ hirsute main
< deb https://swiftlang.xyz/ubuntu/ hirsute main
---
> deb [arch=amd64] https://archive.swiftlang.xyz/ubuntu/ hirsute main
> deb [arch=amd64] https://swiftlang.xyz/ubuntu/ hirsute main
The thing is, it is a multiarch system so you should specify the arch in swiftlang-release.list as mentioned above.
I see. Maybe this should be mentioned on swiftlang.xyz and here in the forums. A better error message explaining what is going on would be helpful too.
The error messages are the standard error messages generated by the apt package manager on your system. They are not anything I can change on the repository side.
Thanks for your feedback, I will look into including the archtype in the sources list.
Another long-term wish would be to build swift with the system clang (12 at the moment) and not include clang in swiftlang. But I guess this has to be sorted out at a higher level.
The alternative is to use the system LLVM packages instead, which is what I do with my Termux package that runs natively on Android devices. That means I don't have the Swift REPL with the Swift-forked lldb working though.
That is an option but at this point I don't it's the right thing to do for debian/ubuntu packages.
It hides the underlying issue that we have multiple versions of packages conflicting with each other. This needs to be addressed, especially as the swift versions of the packages are now older than default installed versions.
The best solution is to decouple the packages and supply them as separate install packages.
The second best solution is to use the replaces option in the debian/control file. This can be used to identify and fix any conflicts with existing packages. The replace option in the apt package manager works differently the the equivilent option in redhat's yum packager. In the apt package manager, replaces allows 2 packages to coexist and only addresses the conflicting files.
In the swift-5.4.2 packages there are currently the following replaces options used - clang, clang-10, libicu, lldb, llvm (The clang versions change depending on default option available for the install target)
It looks like lld will also have to be added to the list.
Swift 5.4.2 x86_64/amd64 Package for Ubuntu/hirsute.
There is a new install package for ubuntu/hirsute amd64 version.
There is no official hirsute version so I have repackaged the focal version to install on hirsute.
This means that the swiftlang package needs libpython3.8. (hirsute is now on libpython3.9)
Note: To install libpython3.8 on hirsute you will need to add the sources for ubuntu/groovy to the /etc/apt/sources.list file.
# add swiftlang repository
curl -s https://swiftlang.xyz/install.sh | sudo bash
# add groovy sources
echo "deb http://archive.ubuntu.com/ubuntu/ groovy main restricted" | sudo tee -a /etc/apt/sources.list
# run update
sudo apt update
# install swift
sudo apt install swiftlang
@BracketMaster, I don't think Swift is available for ubuntu/20.04/ppc64le, but if somebody can supply a compatible toolchain, I can package it and add it to the repository.
Swift 5.6 has arrived!
The developer snapshots have been updated to 2021-07-30-a
Swift version 5.6-dev (LLVM ba0b85f590c1ba2, Swift b8d2f269cb060ad)
Target: x86_64-unknown-linux-gnu
Fix for lld Conflict
All the 5.4.2 packages have been rebuild with fix for lld conflict.
The new packages have an iteration number of 02 and will be available after running sudo apt update.
# example
# old package
swiftlang_5.4.2-01-ubuntu-focal_amd64.deb
# new package
swiftlang_5.4.2-02-ubuntu-focal_amd64.deb