Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX ma_context_init__coreaudio fails to open dylibs #750

Closed
dezi opened this issue Oct 11, 2023 · 7 comments · Fixed by dethrace-labs/dethrace#382
Closed

OSX ma_context_init__coreaudio fails to open dylibs #750

dezi opened this issue Oct 11, 2023 · 7 comments · Fixed by dethrace-labs/dethrace#382
Labels

Comments

@dezi
Copy link

dezi commented Oct 11, 2023

After upgrading my macbook to OSX 13.5.2 (22G91), miniaudio all of a sudden fails to

dlopen("CoreFoundation.framework/CoreFoundation", RTLD_NOW)

with the dlerror string:

dlerror=dlopen(CoreFoundation.framework/CoreFoundation, 0x0002): tried: 'CoreFoundation.framework/CoreFoundation' (no such file), '/System/Volumes/Preboot/Cryptexes/OSCoreFoundation.framework/CoreFoundation' (no such file), '/usr/lib/CoreFoundation.framework/CoreFoundation' (no such file, not in dyld cache), 'CoreFoundation.framework/CoreFoundation' (no such file)

Given an absolute path, it is able to open the dylib:

dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", RTLD_NOW)

I made a temporary workaround in my copy of miniaudo.h with all absolute paths to the different libraries for OSX, so my miniaudio is back online.

I posted this bug at

https://developer.apple.com/forums/thread/739136

but as far i can see, Apple is reluctant in picking up this issue.

What could we do inside miniaudio to fix this issue? Is it possible to do some kind of fallback here?

Regards
dezi

@inlife
Copy link

inlife commented Oct 11, 2023

Having a similar same issue on macOS 14.0 (Sonoma)

miniaudio silently fails to load any backend and switches to Null backend

Also confirming that adding "/System/Library/Frameworks/" prefix to all macOS ma_dlopen .framework paths solves the issue

@mackron
Copy link
Owner

mackron commented Oct 12, 2023

Yes there's a work around for this. Use MA_NO_RUNTIME_LINKING. See section 2.2 in the documentation for details: https://miniaud.io/docs/manual/#Building

This has been reported a lot lately. I think it's time to update miniaudio to force compile-time linking for macOS/iOS. Will leave this item open to remind me to get that done.

@inlife
Copy link

inlife commented Oct 12, 2023

Awesome, thanks @mackron 🎉
Will be looking forward to that!

@mackron
Copy link
Owner

mackron commented Oct 14, 2023

I've gone ahead and added the "/System/Library/Frameworks/" prefix to the relevant dlopen() calls. I haven't tested this on my side yet. It's in the dev branch if you were wanting to try that.

As for enforcing compile-time linking - I'll probably delay that to the 0.12 release so I don't unnecessarily break anyone's builds in the 0.11 release cycle.

@khiner
Copy link

khiner commented Oct 24, 2023

I ran into this as well, and it's fixed for me on dev. Thanks for the fix! This would be nice to have in the split header files as well.

@mackron
Copy link
Owner

mackron commented Oct 24, 2023

I'll be doing a release in the coming days at which time I'll update the split version.

@mackron
Copy link
Owner

mackron commented Nov 3, 2023

I've released version 0.11.19 which includes this fix. I'm going to go ahead and close this one to clean up the issue tracker, but I've got an item on my todo list to consider forcing compile-time linking for Apple platforms.

Thanks for the report and confirming the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants