Skip to content

fix(flatpak): disable libbfd in the flatpak build (#13) - #19

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/flatpak-bundle-libbfd
Jun 8, 2026
Merged

fix(flatpak): disable libbfd in the flatpak build (#13)#19
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/flatpak-bundle-libbfd

Conversation

@got3nks

@got3nks got3nks commented Jun 8, 2026

Copy link
Copy Markdown

Fixes #13.

aMule's cmake/bfd.cmake auto-detects libbfd at configure time and links against it for backtrace symbol resolution. The GNOME 49 SDK (build-time) ships libbfd-2.46.so + bfd.h, so the detection fires. The GNOME 49 runtime (the tree shipped to end users alongside the bundle) does not ship libbfd — it's a development library — so installed flatpaks abort at startup:

amule: error while loading shared libraries: libbfd-2.46.so: cannot open shared object file: No such file or directory

Every Linux user installing the 3.0.0 flatpak bundle is hitting this today.

Fix

  1. Add option(ENABLE_BFD "..." ON) to cmake/options.cmake, mirroring the adjacent ENABLE_NLS pattern. Default ON, so distro packagers, the AppImage build, native local builds, and CI all behave exactly as before.
  2. Gate include(cmake/bfd.cmake) in CMakeLists.txt on ENABLE_BFD. When OFF, HAVE_BFD stays unset and the downstream if(HAVE_BFD) guards in src/CMakeLists.txt and src/libs/common/CMakeLists.txt skip the libbfd linkage.
  3. Pass -DENABLE_BFD=NO from the flatpak manifest template, with a comment block explaining why this channel specifically needs it.

Backtrace impact for flatpak users

MuleDebug.cpp:368-521 already implements a full !HAVE_BFD fallback: backtrace() + backtrace_symbols() still emit the stack with function names, and the code shells out to addr2line -C -f -s -e /proc/$$/exe via popen() for source line info when available. The post-#677 PIE-base translation keeps addresses meaningful on modern PIE binaries. Net: slightly less detailed in-process resolution, but crash reports remain actionable.

Verified

Full clean rebuild on Linux ARM64, installed, ran. readelf -d confirms libbfd is no longer in DT_NEEDED. flatpak run org.amule.aMule --version returns the banner cleanly:

aMule GIT compiled with wxGTK3 v3.2.6 and Boost 1.87 (Snapshot: rev. 2.3.3-693-g...) (OS: Linux)

Follow-up

The Flathub-strict manifest staged in #16 will need the same -DENABLE_BFD=NO config-opt addition; queued as a one-line follow-up once #16 lands.

The GNOME 49 SDK ships libbfd (in /usr/lib + bfd.h in /usr/include),
so cmake/bfd.cmake auto-detects it and links aMule against
libbfd-2.46.so. The GNOME 49 *Runtime* (the tree shipped to end
users alongside the bundle) does NOT ship libbfd — it's a
development library, not a runtime one — so installed flatpaks
abort at startup:

    amule: error while loading shared libraries: libbfd-2.46.so:
    cannot open shared object file

Every Linux user installing the 3.0.0 flatpak bundle hits this today
(amule-org#13).

Add an ENABLE_BFD option to amule's CMake (default ON, so distro
packagers, the AppImage build, native local builds and CI keep
using libbfd exactly as before) and gate the cmake/bfd.cmake
include on it. Pass -DENABLE_BFD=NO from the flatpak manifest to
disable libbfd linkage there.

MuleDebug.cpp's existing !HAVE_BFD fallback already handles this:
backtrace() + backtrace_symbols() still emit the stack with
function names, and the code shells out to addr2line for source
line info when available. The post-amule-project#677 PIE-base translation keeps
addresses meaningful on modern PIE binaries. Net effect on flatpak
crash reports: slightly less detailed (no in-process file:line
resolution) but still actionable.

Only the flatpak channel is affected. AppImage and native packages
keep symbol-resolved backtraces via libbfd.
@got3nks
got3nks force-pushed the fix/flatpak-bundle-libbfd branch from 1af762c to dea65f1 Compare June 8, 2026 16:01
@got3nks
got3nks merged commit 6985ba0 into amule-org:master Jun 8, 2026
9 checks passed
got3nks added a commit that referenced this pull request Jun 8, 2026
Stages the Flathub-strict version of the aMule Flatpak manifest in `packaging/flathub/` — the file that will be submitted to flathub/flathub once domain attestation for the app-id is resolved. Differences from the internal `packaging/linux/flatpak/org.amule.aMule.yaml.in`:

- All `${...}` template variables resolved to concrete values (Flathub forbids envsubst).
- The amule source: `branch:` swapped for `tag: + commit:` (Flathub forbids mutable refs).
- The cryptopp source: existing tag augmented with a pinned commit.

Pinned at master tip post-#15 (icon refresh), #17 (metainfo / desktop polish), and #19 (ENABLE_BFD option). Carries -DENABLE_BFD=NO so the Flathub-built bundle inherits the libbfd-runtime-missing fix.

Companion file `packaging/flathub/README.md` documents the two-manifest layout, the submission flow against flathub/flathub:new-pr, and how to refresh the pin on each new aMule release tag.
@got3nks
got3nks deleted the fix/flatpak-bundle-libbfd branch June 8, 2026 16:32
got3nks added a commit that referenced this pull request Jun 14, 2026
…atforms

The macOS-only `std::_Exit(0)` block in OnExit() was added to dodge a
wxWebSessionURLSession dtor bug under wx 3.3.2. Turns out the
Linux backend (wxWebSessionCURL, wx 3.2.6) hits the same class of
shutdown crash: its dtor calls curl_multi_cleanup, libcurl invokes the
registered socket callback (wxWebSessionCURL::SocketCallback) to drop
tracked sockets, and that callback dereferences session state the
dtor's earlier steps have already torn down. wxASSERT fires,
wxFatalSignalHandler raise(SIGABRT)s.

Verified with a debug-symbol Flatpak + gdb on a user-supplied core,
fully symbolicated:

    #19 main                                amule-gui.cpp:98
    #18 wxEntry                             wx/init.cpp:500
    #17 wxEntryCleanup                      wx/init.cpp:205
    #16 wxModule::CleanUpModules            wx/module.cpp:191
    #15 wxModule::DoCleanUpModules          wx/module.cpp:200
    #14 wxRefCounterMT::DecRef
        wxWebSession::Close                 wx/webrequest.cpp:1074
    #13 wxWebSessionCURL::~wxWebSessionCURL wx/webrequest_curl.cpp:932
    #12 wxWebSessionCURL::~wxWebSessionCURL wx/webrequest_curl.cpp:929
    #11-#6 libcurl curl_multi_cleanup
    #5  wxWebSessionCURL::SocketCallback    wx/webrequest_curl.cpp:1047
    #4  raise()
    #3  wxFatalSignalHandler                wx/unix/utilsunx.cpp:1523
    #0  abort

Same justification used for the macOS guard applies on every
platform: by this point in OnExit we have saved state, joined
threads, and flushed logs -- nothing aMule-owned remains to clean up.
_Exit bypasses atexit and static destructors uniformly, so the buggy
wx dtor never runs and the process terminates cleanly.

Remove this once the upstream wx fix lands in a release we depend on.

Reported in #18.
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.

Document Flatpak installation

1 participant