gen2brain/malgo

Dynamic Linking fails on OSX OSX 13.5.2 and 14.0 (Sonoma)

dezi opened this issue · 2 comments

dezi commented

Since release OSX 13.5.2 onwards, OSX CoreFoundation libs et al fail to dynamically link, resulting in no backend beeing opened.

Refer to this issue of miniaudio:

mackron/miniaudio#750

I followed the instructions here and brought malgo back to work:

in file miniaudio.c i added no runtime linking:


#include "_cgo_export.h"

#ifdef __APPLE__
    #define MA_NO_RUNTIME_LINKING
#endif

#define MINIAUDIO_IMPLEMENTATION
#include "miniaudio.h"

in file miniaudio.go a added in line 14:

#cgo darwin LDFLAGS: -framework CoreFoundation -framework CoreAudio -framework AudioToolbox

I will provide a pull request if desired.

Regards,
dezi

I prefer to wait and see how miniaudio will proceed. From that issue, the fix is also simply adding the absolute path to libraries, another fix is the workaround from the docs you propose. With runtime linking cross compiling i.e. from Linux, malgo only needs zig cc or maybe just clang, with compile-time linking it would need all frameworks libraries, i.e. whole osxcross.
Or perhaps adding a new build tag, i.e. ma_no_runtime_linking can be added. For now, you can also just append CGO_CFLAGS/CGO_LDFLAGS.

Is this maybe related to #48?