Skip to content

Drop the unused libnsl dependency from the bundled Xerces - #90

Merged
ryan-kipawa merged 2 commits into
masterfrom
fix/59
Nov 12, 2026
Merged

ryan-kipawa merged 2 commits into
masterfrom
fix/59

Conversation

@ryan-kipawa

@ryan-kipawa ryan-kipawa commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The bundled libxerces-c lists libnsl.so.2 as a dependency but imports none of its symbols (0 of its 89 undefined symbols come from libnsl, and it never calls dlopen). The build now drops that entry with patchelf, next to the existing renaming:

 isolate_linux_libs
   patchelf --force-rpath --set-rpath $ORIGIN --set-soname <tagged>
            --replace-needed <lib> <tagged lib> ...
+           --remove-needed libnsl.so.2

CI no longer runs apt-get install libnsl2 in full_test.yml, build_package.yml or test_mikeio.yml. Those steps were added because ubuntu-latest (24.04) doesn't ship libnsl2, so passing runs without them prove the fix.

Evidence

  • Before: readelf -d libxerces-c-3.2-mikecore-python.so lists NEEDED libnsl.so.2. On Ubuntu 24.04 without libnsl2, import mikecore fails to load the native libraries.
    After: the NEEDED list is glibc, libstdc++, libgcc_s and our tagged libs only. The built wheel in a clean ubuntu:24.04 container (no libnsl.so.2): 341 passed, 2 skipped, 8 xfailed.
  • CI on this PR runs without libnsl2.
  • MIKE IO downstream (run): on Ubuntu without libnsl2, 1157 passed and 2 failed. Both failures (test_eum_conversion: eumICarbonEmmisionFactor not a valid EUMType; test_select_area_rotated_UTM_2: last-digit float difference) also fail on master (run), and the EUM one fails on Windows too, so they aren't caused by this PR.

Merge Danger

Door: two-way

Revert the commit to restore the dependency and the CI install steps.

Blast Radius: Linux users

If Xerces did need libnsl at runtime, Linux users would see unresolved symbols. Symbol analysis and both test suites say it doesn't. Users who set MIKECORE_PYTHON_BIN to a MIKE installation still use that installation's Xerces, which still needs libnsl2. The README now says so, and test_installation_libraries_read_like_the_bundled_ones skips when libnsl.so.2 can't be loaded, as on ubuntu-latest now. Windows is unaffected.

Fixes #59

🤖 Generated with Claude Code

The bundled libxerces-c needs libnsl.so.2 but imports none of its
symbols. Ubuntu 24.04 doesn't install libnsl2 by default, so import
failed there until users installed it. The build now removes that
DT_NEEDED entry with patchelf, and CI no longer installs libnsl2, so
the tests prove the wheel works without it.

Fixes #59

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test stands in for a MIKE installation with the unpatched NuGet
libraries, whose Xerces still needs libnsl.so.2. Without libnsl2 it
can't load, as on ubuntu-latest now that CI no longer installs it.
The README says such an installation may need libnsl2 on Ubuntu 24.04.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryan-kipawa
ryan-kipawa merged commit c5f7154 into master Nov 12, 2026
10 checks passed
@ryan-kipawa
ryan-kipawa deleted the fix/59 branch November 12, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libnsl2 not included by default on ubuntu 24.04

1 participant