Right, there are a couple of things going on. Most importantly, Swift currently does not provide pre-built binaries for Ubuntu 25.10. I believe the pre-built binaries are always available for all supported LTS versions -- the latest to date is Ubuntu 24.04 (see Install Swift | Swift.org , currently binaries for 20.04, 22.04 and 24.04 are provided).
So I'll assume that you installed the Swift binaries for Ubuntu 24.04 and are attempting to run them on Ubuntu 25.10. This isn't usually gonna work and let's see exactly what's going on:
root@c9c40418cd59:/# /root/.local/share/swiftly/toolchains/6.2.1/usr/bin/swift package init
/root/.local/share/swiftly/toolchains/6.2.1/usr/bin/swift-package: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
So it says it wants libxml2.so.2 but Ubuntu 25.10 provides
root@c9c40418cd59:/# ls /usr/lib/aarch64-linux-gnu/libxml2.so*
/usr/lib/aarch64-linux-gnu/libxml2.so.16 /usr/lib/aarch64-linux-gnu/libxml2.so.16.0.5
and unfortunately, the libxml2.so.16 is the only package provided by Ubuntu:
root@c9c40418cd59:/# apt-cache search ^libxml2
libxml2-16 - GNOME XML library <<<--- see the ...-16
libxml2-dev - GNOME XML library - development files
libxml2-doc - GNOME XML library - documentation
libxml2-utils - GNOME XML library - utilities
tl;dr Yes, your analysis was correct, this new Ubuntu only provides an ABI-breaking libxml2 which isn't compatible with any of the pre-built Swift toolchains available today. But to be honest, even if you solve the libxml2 issue by installing (maybe through a PPA or some other way), there's no guarantee that there won't be yet another issue like this. Linux distributions generally only guarantee ABI stability within a release, not across them. Or in other words: A Swift toolchain for Ubuntu 24.04 isn't expected to work on Ubuntu 25.10.
So I'll assume that you installed the Swift binaries for Ubuntu 24.04 and are attempting to run them on Ubuntu 25.10.
Yep that’s correct. I had a virtual machine that I upgraded from 24.04 to 25.10 earlier this week and ran into this issue. No big deal in my case, I can go back to a previous snapshot. I just wanted to make others aware. I appreciate the expansion on the topic.
I was able to install a libxml2 package from the previous version of Ubuntu (25.04) on my 25.10 install and that resolved the libxml2.so.2 error for me. The package is here:
Consequently swiftly compiles as expected but emits warnings.
To avoid these warnings, the riskier approach is indeed to add libxml2.so.2.9.14 (compatible with ubuntu 24.04) and then create a symbolic link.
Ubuntu 26.04’s development release (that will become LTS) is also affected by the same problem.
The issue is that the older implementation of libxml2 has significant drawbacks (libxml2 narrowly avoids becoming unmaintained)