Hi,
I'm trying to load libgcrypt library (brew install libgcrypt) with dlopen/dlsym but getting a crash when I use RTLD_LAZY | RTLD_LOCAL mode with dlopen.
Any other combination works, for example:
RTLD_LAZY | RTLD_GLOBAL
RTLD_NOW | RTLD_GLOBAL
RTLD_NOW | RTLD_LOCAL
I have attached a tiny sample program to reproduce the issue:
$ gcc -o dyld_test dyld_test.c
$ ./dyld_test gcry_check_version
dyld: lazy symbol binding failed: Symbol not found: __gcry_check_version
Referenced from: /usr/local/lib/libgcrypt.dylib
Expected in: flat namespace
dyld: Symbol not found: __gcry_check_version
Referenced from: /usr/local/lib/libgcrypt.dylib
Expected in: flat namespace
I have tried to build dyld myself but failed to succeed.
https://opensource.apple.com/source/dyld/dyld-852.2/
Any help would be really appreciated.
Thank you,
Aleix
dyld_test.c