# Ubuntu 25.10 and libxml2

**URL:** <https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239>\
**Category:** Compiler\
**Created:** [November 15, 2025, 7:06pm UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239 "2025-11-15T19:06:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dynamoRando](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dynamorando/32/43475_2.png) [@dynamoRando](https://forums.swift.org/u/dynamoRando)\
**Post date:** [November 15, 2025, 7:06pm UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239/1 "2025-11-15T19:06:00Z")

</div>

Just posting for notice. On Ubuntu 25.10 arm64 when doing something like

```swift
swift package init --name MyLibrary --type library

```

using 6.2.0 I’m getting the error

```swift
error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

```

After going down a rabbit hole I think I’m running into this issue:

> **[PSA: Ubuntu 25.10 features a libxml2 version with API breaking changes](https://discourse.ubuntu.com/t/psa-ubuntu-25-10-features-a-libxml2-version-with-api-breaking-changes/71783)**
>
> Hello, I noticed that Ubuntu 25.10 ships a libxml2 version with a upstream breaking change(libxml2.so.2 → libxml2.so.16) that renders external apps that don’t ships the old version broken(e.g. the DEB distribution from LibreOffice upstream...

which doesn’t seem like there’s much to do. I just wanted to raise awareness.

---

<div class="post-metadata">

**Author:** ![johannesweiss](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johannesweiss/32/38183_2.png) [@johannesweiss](https://forums.swift.org/u/johannesweiss)\
**Post date:** [November 15, 2025, 7:49pm UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239/2 "2025-11-15T19:49:13Z")

</div>

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](https://www.swift.org/install/linux/ubuntu/) , 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:

```swift
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

```swift
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:

```swift
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.

---

<div class="post-metadata">

**Author:** ![dynamoRando](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dynamorando/32/43475_2.png) [@dynamoRando](https://forums.swift.org/u/dynamoRando)\
**Post date:** [November 15, 2025, 8:00pm UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239/3 "2025-11-15T20:00:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xtremekforever](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/xtremekforever/32/43018_2.png) [@xtremekforever](https://forums.swift.org/u/xtremekforever)\
**Post date:** [December 1, 2025, 2:16am UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239/4 "2025-12-01T02:16:29Z")

</div>

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:

[https://launchpad.net/ubuntu/+archive/primary/+files/libxml2\_2.12.7+dfsg+really2.9.14-0.4ubuntu0.4\_amd64.deb](https://launchpad.net/ubuntu/+archive/primary/+files/libxml2_2.12.7+dfsg+really2.9.14-0.4ubuntu0.4_amd64.deb)

Just to let you know this is a possible workaround.

---

<div class="post-metadata">

**Author:** ![pthibaud](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/pthibaud/32/43993_2.png) [@pthibaud](https://forums.swift.org/u/pthibaud)\
**Post date:** [December 23, 2025, 3:26pm UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239/5 "2025-12-23T15:26:38Z")

</div>

A possible (and temporary) workaround is to simply create a symbolic link to libxml2.so.16

```bash
sudo ln -s /lib/x86_64-linux-gnu/libxml2.so.16 /lib/x86_64-linux-gnu/libxml2.so.2

```

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.

```bash
wget https://launchpad.net/ubuntu/+archive/primary/+files/libxml2_2.12.7+dfsg+really2.9.14-0.4ubuntu0.4_amd64.deb
sudo dpkg --fsys-tarfile libxml2_2.12.7+dfsg+really2.9.14-0.4ubuntu0.4_amd64.deb | tar -xO ./usr/lib/x86_64-linux-gnu/libxml2.so.2.9.14 > /lib/x86_64-linux-gnu/libxml2.so.2.9.14
sudo ln -s /lib/x86_64-linux-gnu/libxml2.so.2.9.14 /lib/x86_64-linux-gnu/libxml2.so.2

```

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](https://hackaday.com/2025/12/23/libxml2-narrowly-avoids-becoming-unmaintained/))

---

<div class="post-metadata">

**Author:** ![wnandolo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wnandolo/32/44911_2.png) [@wnandolo](https://forums.swift.org/u/wnandolo)\
**Post date:** [March 30, 2026, 8:07am UTC](https://forums.swift.org/t/ubuntu-25-10-and-libxml2/83239/6 "2026-03-30T08:07:01Z")

</div>

This has also worked for me for FoxitReader. Thanks.
