Why dlopen failed on some macOS

Hi All:
I use dlopen to load a dylib on macOS, It woks fine. Recently, I received one customer report bug, After checked the log, I found that dlopen failed on customer's environment(macOS 13.5.2 22G91) as below

load xxxx failed: dlopen(/xxx/yyy/zzz.dylib, 0x0001): tried: '/xxx/yyy/zzz.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/xxx/yyy/zzz.dylib' (no such file), '/xxx/yyy/zzz.dylib' (no such file)

  • I use full file path to dlopen dylib, and the file is located at there
  • I checked dylib signature, notarization, dependency frameworks, all are valid
  • I got copy and replace customer's dylib into myself environment, It woks fine
  • Customer tried several mac computers, others do not have this problem

I am confused about this issue and do not know how to investigate further. Any comments is appreciated.

Did you check whether your customer has restarted the affected Mac?

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have a similar problem.

OSX Version 13.5.2 (22G91)

For some reason this version is not able to open framework libs using the standard path, see this code:


#include <stdio.h> #include <dlfcn.h>

int main(int argc, char *argv[]) {

printf("hallo\n");

void *handle1 = dlopen("CoreFoundation.framework/CoreFoundation", RTLD_NOW); printf("REL CoreFoundation.framework %lx\n", (long) handle1); printf("##### dlerror=%s\n",dlerror());

void *handle2 = dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", RTLD_NOW); printf("ABS CoreAudio.framework %lx\n", (long) handle2); printf("##### dlerror=%s\n",dlerror()); }

hallo REL CoreFoundation.framework 0

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)

ABS CoreAudio.framework 49f8aebe8

dlerror=(null)


Why is this?

This issue isn’t really the same as yangyang_2020’s, because you can reproduce it all the time and their issue only happens on small subset of Macs. Please start a new thread for your issue. Tag it with Linker so that I see it.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It is the same issue.

Because the problem started with an upgrade to

OSX Version 13.5.2 (22G91)

Before that, the application did run fine.

So I guess the default search path was changed in that release.

Regards dennis

I am also having similar issue, I packaged my app based of kivy and python and running in xcode. here is the error:

Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 0x0001): tried: '/Users/jahna/Library/Developer/Xcode/DerivedData/villagers_goods-bmgxikubanqmwuhetawxtarwzhzu/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/Current/Foundation' (no such file),