Skip to content

Linux binary fails on Ubuntu 26.04: libxml2.so.2 not found #6966

Open

Description

@udondan

New Issue Checklist

Bug Description

The dynamically linked Linux binary swiftlint from the release archives (swiftlint_linux_amd64.zip, 0.65.1) doesn't start on Ubuntu 26.04, which GitHub Actions now uses for ubuntu-latest:

$ swiftlint lint --strict --reporter github-actions-logging
swiftlint: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

Exit code 127. Example run on a GitHub-hosted ubuntu-26.04 runner: https://github.com/udondan/reminders-cli/actions/runs/41100268308/job/124216234394

The binary has libxml2.so.2 as a NEEDED entry:

$ objdump -p swiftlint | grep NEEDED
  NEEDED       libcurl.so.4
  NEEDED       libxml2.so.2
  NEEDED       libm.so.6
  NEEDED       libstdc++.so.6
  NEEDED       libgcc_s.so.1
  NEEDED       libc.so.6
  NEEDED       ld-linux-x86-64.so.2

Ubuntu 26.04 ships a newer libxml2 with a different soname, so libxml2.so.2 no longer exists there. As far as I can tell, the dependency comes in through FoundationXML, which is linked statically with -static-stdlib in make spm_linux_build and is pulled in by SWXMLHash (via SourceKitten). The binary is built on Ubuntu 24.04 (noble), so it's bound to that libxml2 soname.

swiftlint-static from the same archive works, because it has no dynamic dependencies, but it disables all rules that need SourceKit, so it isn't a full replacement.

Possible directions (I haven't tried any of them):

  • Link libxml2 statically into the dynamic swiftlint binary.
  • Additionally publish a build made on Ubuntu 26.04.

The current workaround is to keep the lint job on ubuntu-24.04.

Environment

  • SwiftLint version: 0.65.1
  • Xcode version: n/a (Linux)
  • Installation method used: release archive swiftlint_linux_amd64.zip (installed through mise, aqua backend)
  • OS: Ubuntu 26.04 (GitHub Actions runner ubuntu-26.04); works on ubuntu-24.04
  • Configuration file: not relevant, the binary fails before reading it.

Activity

  1. zunda-pixel commented on Dec 2, 2026

    @zunda-pixel

    SwiftLint depends on SourceKitten but doesn't use its XML parsing. libxml2 comes in because SourceKitten depends on SWXMLHash, which uses FoundationXML, which links libxml2.

    When I replaced SWXMLHash in SourceKitten with xylem, an XML library written in pure Swift, SwiftLint no longer linked libxml2 and ran on Ubuntu 26.04.

    However, xylem requires Swift 6.3 or later on Linux (and macOS 26, so macOS would have to keep using XMLParser), so I haven't opened a PR. I opened jpsim/SourceKitten#855 instead.

    Compared with publishing separate libxml2.so.16 builds as in #6967, I'd appreciate your thoughts on this direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions