Skip to content

AppImage: bundle libbz2.so.1.0 - #652

Open
SmallTardigrade wants to merge 1 commit into
CrealityOfficial:masterfrom
SmallTardigrade:fix/appimage-bundle-libbz2
Open

SmallTardigrade wants to merge 1 commit into
CrealityOfficial:masterfrom
SmallTardigrade:fix/appimage-bundle-libbz2

Conversation

@SmallTardigrade

Copy link
Copy Markdown

Description

The Linux AppImage doesn't start on Fedora-based systems:

bin/CrealityPrint: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory

Fixes #650 and #566, and the libbz2 part of #637.

Cause

The binary is built on Ubuntu 24.04, where the library's soname is libbz2.so.1.0. Fedora ships the same library as libbz2.so.1, with no libbz2.so.1.0, so the loader finds nothing. build_appimage.sh.in copies a list of libraries into usr/lib, and libbz2 isn't on it.

Changes

One line in src/platform/unix/build_appimage.sh.in, beside the similar ones:

cp /lib/x86_64-linux-gnu/libbz2.so.1.0* usr/lib/
  • It adds about 160 KB (libbz2.so.1.0 and libbz2.so.1.0.4).
  • The pattern is narrower than the neighbouring libbz2.so.* style on purpose. Copying libbz2.so.1 as well put Ubuntu's copy ahead of the host's for host libraries that link against it. With this pattern they keep using their own.

#539 is also aimed at this error, by keeping a user's LD_LIBRARY_PATH. It doesn't conflict with this change. Bundling means users don't have to make their own link.

Screenshots/Recordings/Graphs

None. This changes packaging only, with no UI change.

Tests

Environment: the released V7.3.1.6378 AppImage, unpacked, on Fedora 44, plus an ubuntu:24.04 container (24.04.5, libbz2-1.0 1.0.8-5.1ubuntu0.1).

  • The line itself: run in the container, it exits 0 and copies both files. The soname of the copied library is libbz2.so.1.0.
  • Before: on Fedora, with only the bundled usr/lib on LD_LIBRARY_PATH, ldd reports libbz2.so.1.0 => not found.
  • After: with the copied files added, ldd -r resolves libbz2.so.1.0 to the copy and reports nothing missing or undefined. libbz2.so.1 still resolves to /lib64/libbz2.so.1.
  • Start-up: with the copied files, the binary loads with no loader error and was still running when stopped after 3 seconds. LD_DEBUG=libs shows the copy being initialised.

Not tested:


🤖 Generated with Claude Code

The binary is built on Ubuntu, where libbz2's soname is libbz2.so.1.0.
Fedora-based systems ship it as libbz2.so.1 only, so the AppImage fails to
start there with "libbz2.so.1.0: cannot open shared object file".

Copy only the .1.0 names, so host libraries linked against libbz2.so.1 keep
using the host's copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant