New Swift Package Repository for Ubuntu/Debian Linux Distributions

I have run older versions of 32-bit swift on a Pi Zero I have (Swift 5.1.5 I think?) but I haven’t tested out these latest versions yet

1 Like

Just as a short note: I am missing a listing of those community efforts on swift.org. Would this be a sensible thing?

2 Likes

Hi, we just added Swift 5.7 runtime support this week for Debian 11 Armhf (armv7) as the swiftlang-slim package. I believe the Pi Zero is running Debian Armel (no hard float support, Armv5). It would not be hard to modify the scripts to cross compile for Armv6, but I currently don't own one to test on. If you need Armv6 support, I would recommend using Buildroot GitHub - MillerTechnologyPeru/buildroot-swift: Buildroot external to support the Swift programming language

https://www.debian.org/ports/arm/

3 Likes

Did you compile the runtime yourself for that?

Thanks for the suggestion @ColemanCDA! As I understand it it actually uses armv6 with hardware float support. I like to refer to this article any time I get confused from reading about ARM on Wikipedia:

Using arm6hf (Raspbian’s derivative of armhf with ARMv7-only instructions removed but floating-point instructions retained) provides us with an operating system which will run on every device we have ever manufactured, all the way back to 2011.

I can never seem to remember which are the names of the architectures and which are the names of the instruction sets...

Maintenance Notice for Swift Community Apt Repository

Hi everybody,
The Apt Repository will be offline for a few days for server relocation and maintenance.
I will post an update when everything is back online.
Thanks.

2 Likes

Swift Community Apt Repository Update

Hi everybody,
The Apt Repository back online and there have been some great new updates.

Swift 5.7.1 Release

The repository has been updated with the Swift 5.7.1 release.

Armv7 Support for Swift 5.7

There are now armv7 versions of swift 5.7.1 available for Debian 11 and Raspbian Bullseye.
Enormous thanks to @ColemanCDA for all his great work on getting swift 5.7 built for armv7.
This is a huge achievement and deserves many congratulations.

Ubuntu 22.10 Kinetic Support.

The repository has been updated to fully support the latest Ubuntu Kinetic release with swift 5.7.1.
Kinetic has some great improvements and has prebuilt support for most Raspberry Pi models.

Updated Install Script and User Guide

The quick install script and user guide have been updated to reflect the new repository features.

Support Needed Please

The Swift Community Apt Repository is entirely self funded and maintained by myself. I do not receive any financial assistance from Apple or any other company.
This takes considerable time and expense and is becoming more and more difficult to sustain.
My main motivation for providing this repository is my passion for the Swift community and I hope to be able to continue doing so for the foreseeable future.
If you would like help support the repository you can make donations at https://ko-fi.com/futurejones#

6 Likes

Amazing work @futurejones and @ColemanCDA!

1 Like

The package swiftlang installing clang (13) prevents ispc (GitHub - ispc/ispc: Intel® Implicit SPMD Program Compiler) from being properly configured via cmake.

This is another example where swiftlang installing a custom clang over Debian-built clang is making problems. The problem is that openmp is not properly found with cmake when swiftlang is installed. Removing it and re-installing clang and clang-15 helped.

@gonsolo can you post details of which ubuntu or debian version you are having the issue with and what the exact errors being reported are?
Thanks.

cat /etc/lsb-release 

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.10
DISTRIB_CODENAME=kinetic
DISTRIB_DESCRIPTION="Ubuntu 22.10"
-- ISPC Runtime will be built with support of OpenMP tasking model on CPU
CMake Error at /usr/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
Call Stack (most recent call first):
  /usr/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.24/Modules/FindOpenMP.cmake:545 (find_package_handle_standard_args)
  ispcrt/CMakeLists.txt:90 (find_package)
sudo apt remove swiftlang
sudo apt install --reinstall clang clang-15
cmake -G Ninja ..

-- ISPC Runtime will be built with support of OpenMP tasking model on CPU
-- Found OpenMP_C: -fopenmp=libomp (found version "5.0") 
-- Found OpenMP_CXX: -fopenmp=libomp (found version "5.0") 
-- Found OpenMP: TRUE (found version "5.0")  
-- Configuring done

The root cause is that swiftlang uses a different clang and that it installs it as default.
Two things come to mind:

  1. The Ubuntu package should install (the old version 13) clang privately. Right now it's not possible to have clang-15 as default if swiftlang is installed.
  2. Apple's llvm-project should be upstreamed to llvm/llvm-project.

@gonsolo I am working on a fix for all the conflicts with clang and llvm related native packages. This will be available in the swift-5.7.2 release. I hope to have this uploaded to the repository very soon.

3 Likes

:+1: :+1: :+1:

Update: I downloaded the new 5.7.2 package (where clang is installed in /usr/libexec/swift/bin and the only things in /usr/bin are the three links sourcekit-lsp, swift and swiftc), rebuilt ispc and everything works now. Thanks again.

Great to see the updates worked!

Swift 5.7.2 Repository Update

Hi everybody,
The Apt Repository has been updated with the latest swift-5.7.2-RELEASE.
There have also been some changes and improvements to the packages.

New Package Installation Directory

Previously packages were installed in the /usr directory.
This has been causing conflicts with a number of native packages such as clang and llvm.
To fix this issue the new packages have been rebuilt to install in the /usr/libexec/swift/ directory.

Swift Repl LLDB Error

When using the swift repl there is the following error -
ModuleNotFoundError: No module named 'lldb'.
To fix this error python3-lldb-13 has been added as a recommended package.
This fix has been added to following distributions :-

  • Debian Buster
  • Debian Bullseye
  • Ubuntu Jammy
  • Ubuntu Kinetic

If you need the fix for Ubuntu Focal you will need to add an extra repository and manually install python3-lldb-13 as it is not available in the standard Ubuntu Focal repository.

# add the following url to /etc/apt/sources.list
deb http://ports.ubuntu.com/ubuntu-ports/ focal-proposed universe

# run apt update
sudo apt update

# install python3-lldb-13
sudo apt install python3-lldb-13

Thank you to everyone who has supported me on KoFi.

4 Likes

To fix this issue the new packages have been rebuilt to install in the /usr/libexec/swift/ directory.

Thanks!

Could ldconfig config be added in /etc/ld.so.conf.d so that the system is able to find the run time environment by default?

@Sven Hi,
Can you post an example of what you think the ldconfig file should contain and why it would be needed?
Thanks.

Simple one would be:

$ cat /etc/ld.so.conf.d/swiftlang.conf 
/usr/libexec/swift/lib/swift/linux

The problem is that if another Swift package builds the binaries (i.e Docker container), a system with the .deb packages won't be able to find these:

ldd my-binary | grep "not found"
	libswiftGlibc.so => not found
	libswiftDispatch.so => not found
	libdispatch.so => not found
	libBlocksRuntime.so => not found
	libFoundation.so => not found
	libswift_Concurrency.so => not found
	libswiftCore.so => not found

I think a link to /usr/libexec/swift/bin/swift-demangle can safely be put into /usr/bin.

All swift-prefixed tools should be accessible by swift <toolname>, so there’s no need to expose them explicitly.

1 Like

Ok. Thanks.