Skip to content

Fix build with wxWidgets 3.3: macOS app bundle, frameworks, and cross-platform compat fixes - #453

Merged
mrjimenez merged 4 commits into
amule-project:masterfrom
got3nks:fix-mac-wx33-asstring
Apr 22, 2026
Merged

Fix build with wxWidgets 3.3: macOS app bundle, frameworks, and cross-platform compat fixes#453
mrjimenez merged 4 commits into
amule-project:masterfrom
got3nks:fix-mac-wx33-asstring

Conversation

@got3nks

@got3nks got3nks commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes build with wxWidgets 3.3 on both Linux and macOS, adds proper .app bundle generation on macOS via cmake. All 6 targets (amule, amuled, amulegui, amulecmd, amuleweb, ed2k) now build cleanly on macOS ARM (Tahoe, wx 3.3.2) and Ubuntu (wx 3.3.2).

Changes

wx 3.3 API fixes (all platforms)

  • TextClient.cpp: wx 3.3 requires _() to wrap a string literal, not a runtime expression. This broke amulecmd on both Linux and macOS. Move the string concatenation outside _():
    - Show(_("Processing by hash: "+token+wxT("\n")));
    + Show(_("Processing by hash: ") + token + wxT("\n"));

wx 3.3 API fixes (macOS only)

  • amule.cpp / WebInterface.cpp: wxCFStringRef::AsString() no longer accepts an encoding argument in wx 3.3. Drop the parameter — the parameterless overload uses UTF-8 internally, which is correct for all modern macOS versions. Both call sites are inside #ifdef __WXMAC__, so Linux/Windows are unaffected.

macOS readline / libedit fix

  • ExternalConnector.cpp: macOS ships libedit (not GNU readline). Its rl_readline_name is char * (not const char *) and rl_completion_entry_function is Function * (not rl_compentry_func_t *). Added #ifdef __WXMAC__ casts so both platforms compile. Linux codepath unchanged.

cmake: Apple framework linking

Link required Apple frameworks that were previously missing from cmake (the old Xcode project handled them):

  • muleappcore: IOKit + CoreFoundationPlatformSpecific.cpp sleep-prevention API, inherited by all targets
  • amule (GUI): CoreServices + ApplicationServicesLSRegisterURL for ed2k helper
  • amuleweb: CoreServices + ApplicationServicesLSFindApplicationForInfo for template dir
  • ed2k: CoreServicesFSFindFolder for app-support path

cmake: macOS .app bundle

The monolithic GUI now builds as aMule.app with:

  • Proper Info.plist (auto-generated by cmake's MACOSX_BUNDLE support)
  • Icon from platforms/MacOSX/aMule-Xcode/amule.icns bundled into Resources/
  • Bundle identifier org.amule.aMule

Only the GUI target gets the bundle; amuled, amulecmd, etc. remain plain executables. On Linux/Windows nothing changes.

Tested

  • macOS 26 (Tahoe) ARM, wxWidgets 3.3.2 — all 6 targets build and run
  • Ubuntu, wxWidgets 3.3.2 — all 6 targets build clean, no regressions

got3nks added 2 commits April 17, 2026 23:03
wxCFStringRef::AsString() no longer accepts an encoding argument in
wxWidgets 3.3.  The parameterless overload uses UTF-8 internally,
which is correct for all modern macOS versions.

This only affects macOS builds (the call site is inside #ifdef __WXMAC__).
cmake: generate a proper aMule.app bundle on macOS with the icon
from platforms/MacOSX/aMule-Xcode/amule.icns and auto-generated
Info.plist.  Only the monolithic GUI target gets the bundle;
amuled and other tools remain plain executables.

cmake: link Apple frameworks where needed:
  - muleappcore: IOKit + CoreFoundation (PlatformSpecific.cpp
    sleep-prevention API, used by all targets that link it)
  - amule (GUI): CoreServices + ApplicationServices (LSRegisterURL
    for ed2k helper registration)
  - amuleweb: CoreServices + ApplicationServices (LSFindApplication
    for template directory lookup)
  - ed2k: CoreServices (FSFindFolder for app-support path)

ExternalConnector.cpp: fix macOS libedit incompatibility with
GNU readline — rl_readline_name is char* (not const char*) and
rl_completion_entry_function is Function* (not rl_compentry_func_t*)
on macOS.  Guarded with #ifdef __WXMAC__ so Linux builds are
unaffected.

TextClient.cpp: move string concatenation outside _() macro — wx
3.3 requires _() to wrap a literal, not a runtime expression.

WebInterface.cpp: drop AsString() encoding parameter (same wx 3.3
fix as amule.cpp in the previous commit).

Tested: all 6 targets (amule, amuled, amulegui, amulecmd, amuleweb,
ed2k) build clean on macOS 26 ARM (wx 3.3.2) and Ubuntu (wx 3.3.2).
@got3nks got3nks changed the title Fix macOS build with wxWidgets 3.3: drop AsString encoding parameter Fix macOS build with wxWidgets 3.3: app bundle, frameworks, and compat fixes Apr 17, 2026
@got3nks got3nks changed the title Fix macOS build with wxWidgets 3.3: app bundle, frameworks, and compat fixes Fix build with wxWidgets 3.3: macOS app bundle, frameworks, and cross-platform compat fixes Apr 17, 2026
got3nks added 2 commits April 21, 2026 17:13
The wx 3.3.2 release dropped the wxCFStringRef::AsString(wxFontEncoding)
overload.  Only the no-arg AsString() remains.  Two GUI tools still
called the old overload and failed to compile:

- src/utils/aLinkCreator/src/alcframe.cpp (alc)
- src/utils/wxCas/src/wxcascte.cpp (wxcas)

Both sites were untouched by the earlier wx 3.3 fixes because the GUI
tools aren't in the default build set.

Drop the encoding argument.  Strings are UTF-8 in wx 3.x, no encoding
hint needed.
Both GUI tools use FSFindFolder + CFURLCreateFromFSRef (CoreServices /
CoreFoundation) to locate the user's Application Support directory.
These need -framework CoreServices on the link line, which the CMake
targets were missing, so the linker failed with

    Undefined symbols for architecture arm64:
      _FSFindFolder, _CFURLCreateFromFSRef, _CFURLCopyFileSystemPath,
      _CFRelease

Mirrors the framework linking already present on the amule, amuled,
and ed2k targets.
@got3nks
got3nks force-pushed the fix-mac-wx33-asstring branch from d82ae9c to 116820e Compare April 21, 2026 15:18
@mrjimenez
mrjimenez merged commit 2ff2751 into amule-project:master Apr 22, 2026
3 checks passed
@got3nks
got3nks deleted the fix-mac-wx33-asstring branch May 3, 2026 15:19
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Aug 8, 2026
amule-project#454)

On 32-bit targets the throttler's std::atomic<int64_t> needs libatomic
(the ops expand to __atomic_*_8 library calls). The availability check
used find_library(atomic), which only searches standard filesystem
paths. With GCC, libatomic ships inside the compiler's own runtime dir
(e.g. .../lib/gcc14/), which isn't on that path, so find_library
false-fails and configure aborts -- even though `-latomic` links fine
because the GCC driver resolves its internal copy (reported on MacPorts,
amule-project#453).

Replace find_library with check_library_exists(atomic __atomic_load_8),
which links a probe with `-latomic` through the compiler driver. It
succeeds wherever the flag actually links -- GCC's internal libatomic or
a system libatomic (Clang / distro packages, versioned or not) -- and
only errors when the flag genuinely can't link. The 32-bit "require
libatomic" decision and the FATAL_ERROR guidance are unchanged; only the
availability probe changes.

Closes amule-project#453.
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.

2 participants