New Swift Package Repository for Ubuntu/Debian Linux Distributions

Update: The installation clashes with package "lld", the LLVM linker from the Ubuntu package repository.

The error is reporting your system architecture as i386. Is this correct?
Can you post some info on your system?

Also there is only an arm64 release of Swift for Ubuntu/Hirsute at the moment.


>> uname -mpi: x86_64 x86_64 x86_64

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 and here in the forums. A better error message explaining what is going on would be helpful too.

I did post a list of available packages in an earlier post - New Swift Package Repository for Ubuntu/Debian Linux Distributions - #3 by futurejones

/var/www/ ~
swiftlang |        5.4.1-01-ubuntu-bionic |  bionic | amd64, arm64
swiftlang |         5.4.1-01-ubuntu-focal |   focal | amd64, arm64
swiftlang | 5.5-2021-07-09-a-ubuntu-focal |   focal | amd64, arm64
swiftlang |       5.4.1-01-ubuntu-hirsute | hirsute | arm64
/var/www/ ~
swiftlang | 5.4.1-01-debian-buster | buster | arm64
swiftlang | 5.1.5-01-debian-buster | buster | armv7
/var/www/ ~
swiftlang | 5.1.5-01-raspbian-buster | buster | armhf

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.

I didn't see this post, sorry.
And thanks for providing Swift as a deb package.

A few remarks:

  1. The package seem to overwrite my clang, it was version 12, not it is version 10.
  2. As I said, I had to purge lld because of a collision.
    Apart from that, swift runs like a charm. :slight_smile:

Also setting the directories

readable would help to find the right packages.

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.

I agree. From my non-expert perspective that is a great way to increase adoption of Swift on Linux.

You may want to do what @Ron_Olson did with the Fedora package: he put the Swift toolchain in /usr/libexec/swift/ and only symlinked swift, swiftc, and sourcekit-lsp in /usr/bin/. That way, he can install the full Swift toolchain, including its forked LLVM binaries, in a separate directory and not have it collide with system LLVM packages like lld or lldb.

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.

1 Like

That is an option but at this point I don't it's the right thing to do for debian/ubuntu packages.

  1. 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.

  2. 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.

1 Like

Repository Update

Repository Mirror

I have added a mirror to the swiftlang repository. The mirror is hosted on a larger system with better network performance.
The mirror can used by adding running the install repository script.

curl -s | sudo bash

The install script is also available on the mirror.

curl -s | sudo bash

Browsable Repository Directories

The directories in the repositories are now browsable.
example -

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 | sudo bash

# add groovy sources
echo "deb groovy main restricted" | sudo tee -a /etc/apt/sources.list

# run update
sudo apt update

# install swift
sudo apt install swiftlang
1 Like

I have a POWER9 ppc64le machine running Ubuntu 20.04.
Is it possible to add swift ppcle64 to your apt repo?

@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.

Respostory Update

New Developer Snapshots.

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

# new package
1 Like

amd64 for Debian Buster - is it coming back to your repository?

@aatv , there aren't any Swift builds available for amd64 Debian Buster at the moment. There is a bug in binutils that is causing the builds to fail. I hope to have this fixed soon and amd64 packages available sometime this week.

Repository Update

New Install Script

I have created a new install script to allow easy selection of repository sections.
When running the install script you will now get a menu where you can select which repository section to install.

----- Choose Swift Release Type -----
  1) stable - Swift version 5.3.3
  2) latest - Swift version 5.4.* - this will update to the latest release version available
  3) development - Swift developer builds - this will update to the latest developer build available

Enter number [1/2/3] : 3

Installing Swift developer repository

Importing swiftlang gpg key... done.
Running apt-get update... done.

The repository is setup!
You can now install swift using 'sudo apt install swiftlang' 

New 'stable' Repository Section

The stable section allows you to install swift and not worry about the swift version changing when running apt upgrade. This is currently set at swift-5.3.3-release but can be changed to what ever the agreed stable version should be.

New Packages for Debian 10 buster - x86_64/amd64

There are now packages available for x86 Debian 10.
These include 5.3.3 , 5.4.2 and the latest developer snapshots.

Update to Ubuntu 21.04 Hirsute x86_64/amd64 Packages.

The work around to enable the install of libpython3.8 is now built into the installer script.
The /etc/apt/sources.list.d/swiftlang-release.list now includes groovy main.

deb hirsute main dev
deb hirsute main dev
deb groovy main restricted

This allows libpython3.8 to be installed as a dependent with the Swift install without any extra work.

New Developer Snapshots

Swift 5.6 developer snapshots are now available in arm64 and amd64 in the following -

  • Debian 10 buster
  • Ubuntu 18.04 bionic
  • Ubuntu 20.04 focal
  • Ubuntu 21.04 hirsute

Debian 11 Bullseye Now Available

Debian 11 bullseye has been added to the repository with the following packages available.

  • swift-5.4.2-RELEASE for arm64 and amd64
  • swift-DEVELOPMENT-SNAPSHOT-2021-08-13-a for arm64 and amd64

How to add the repository using the quick install script.

# run update and install curl
sudo apt update && sudo apt install curl

# run repository install script
curl -s | sudo bash

# install swift
sudo apt install swiftlang
1 Like

Repository Update

Improvements to Install Script

The install script now supports most Ubuntu/Debian based distributions.
You can now install Swift on distributions such as -

  • Ubuntu
  • Debian
  • Linux Mint
  • Elementary OS
  • Lubuntu
  • Raspbian
  • and many more.

Ubuntu 21.04 Hirsute amd64 / x86_64

The Ubuntu 21.04 Hirsute amd64 / x86_64 packages are now natively built on ubuntu 21.04 and are compatible with the default python3.9 install. The work around to enable the install of libpython3.8 is no longer needed.

Developer Snapshots Updated

The developer snapshots have been updated to swift-DEVELOPMENT-SNAPSHOT-2021-08-25-a swift-DEVELOPMENT-SNAPSHOT-2021-08-30-a


Repository Update

Bug Fix

Fixed the following sudo apt update error with with dual arch installations with x86_64 and i386.

N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository doesn't support architecture 'i386'

Developer Snapshots Updated.

The developer snapshots have been updated to swift-DEVELOPMENT-SNAPSHOT-2021-09-07-a

Zorin OS

Swift install tested and confirmed on Zorin OS


@futurejones The website appears to be down?

@svanimpe It should be ok now, had some power supply issues to the server.

Terms of Service

Privacy Policy

Cookie Policy