Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gubasso/5f41e9ea2f542791e52da44d06042fe1 to your computer and use it in GitHub Desktop.
Save gubasso/5f41e9ea2f542791e52da44d06042fe1 to your computer and use it in GitHub Desktop.

SLE_15_SP4 pyexpat depedency issue

Error

  • Python 3.11’s pyexpat extension was compiled against Expat ≥ 2.6, where the symbol XML_SetReparseDeferralEnabled was first introduced. libexpat.github.io
  • The SLE 15 SP4 build root still ships Expat 2.4.x (see the distro changelog: “Update to 2.4.4 in SLE-15-SP4”). build.opensuse.org
  • At build time the loader finds the older libexpat.so.1, can’t resolve the new symbol, and the very first Python invocation (python3.11 -m pip wheel …) aborts:
ImportError: … pyexpat … undefined symbol: XML_SetReparseDeferralEnabled

Solution (Didn't work)

  • Pull a newer Expat into the buildroot
  1. Make sure the project repo list for SLE_15_SP4 includes openSUSE:Backports:SLE-15-SP4 (or its :Update) – that repo already carries expat ≥ 2.6.
  2. Add an explicit dependency so the resolver can choose it:
BuildRequires: libexpat-devel >= 2.6.0
Requires: libexpat1 >= 2.6.0

Require the newer Expat on SP4 only

%if 0%{?suse_version} == 150400
BuildRequires:  libexpat-devel >= 2.6.0
Requires:       libexpat1      >= 2.6.0
%endif

Add the Backports repo to your SLE 15 SP4 build target

  • Quick one-off test without touching project meta:
osc build --clean \
  --alternative-project openSUSE:Backports:SLE-15-SP4 \
  standard x86_64
  • Test locally with Backports enabled:
osc meta prj home:gbasso:branches:Cloud:Tools -e

Edit meta file. Just add one line to the existing <repository name="SLE_15_SP4"> section:

  <repository name="SLE_15_SP4">
    <path project="SUSE:SLE-15-SP4:GA"     repository="standard"/>
    <path project="SUSE:SLE-15-SP4:Update" repository="standard"/>
    <!-- Backports overlay (gives us Expat ≥2.6) -->
    <path project="openSUSE:Backports:SLE-15-SP4" repository="standard"/>

    <arch>x86_64</arch>
    <arch>i586</arch>
  </repository>

Update working copy -> osc up Run build -> osc build --clean SLE_15_SP4 x86_64

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