Error image dlopen () not found

I have software that first loads .dylib, allows you to call libFirst.dylib using the following command:

void* handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL); 

Later inside the function from the loaded libFirst.dylib I try to load another .dylib using the same command, but for libSecond.dylib loading this shared library gives me the following warnings in my Xcode console:

 error warning: Ignored unknown object module at 0x129310 with type 0x8a8399 dlerror: dlopen(/path/libSecond.dylib, 9): Library not loaded: libFirst.dylib Referenced from: /path/libSecond.dylib Reason: image not found 

I do not understand that its libFirst.dylib is not loaded, but I am currently included in a function from libFirst.dylib, so how can this be?

All my paths in DYLD_LIBRARY_PATH also display correctly.

Thanks in advance, I am stuck on this for several days.

+6
source share
1 answer

As a result, I set the name -install_name to change the installation name of all my libraries to @ rpath / dylibName.dylib, and then in Xcode I set the Runpath path search paths using @loader_path to find all my .dylib that I used.

+3
source

Source: https://habr.com/ru/post/892857/


All Articles