Hi! It turns out that `dlopen()` in musl cannot find the already loaded shared library using the library soname from the dynamic section, unlike glibc. Here is a simple demo app: ``` # cat main.c #include #include #define SOMELIB_DIR "/root/dlopen_file_name_test/somelib/" #define SOMELIB_NAME "libsomelib.so" int main() { void* library_handle = dlopen(SOMELIB_DIR SOMELIB_NAME, RTLD_LAZY | RTLD_LOCAL); printf("dlopen first load: %p\n", library_handle); { void* library_handle2 = dlopen(SOMELIB_DIR SOMELIB_NAME, RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); printf("dlopen by file path: %p\n", library_handle2); if (library_handle2) dlclose(library_handle2); } { void* library_handle3 = dlopen(SOMELIB_NAME, RTLD_LAZY | RTLD_LOCAL); // RTLD_NOLOAD doesn't work either printf("dlopen by file name: %p %s\n", library_handle3, library_handle3 ? NULL : dlerror()); if (library_handle3) dlclose(library_handle3); } if (library_handle) dlclose(library_handle); return 0; } # cat somelib.c int somelib_func() { return 0; } # cat Makefile all: mkdir -p somelib gcc -shared somelib.c -Wl,-soname,libsomelib.so -o somelib/libsomelib.so gcc main.c -o main -ldl ``` Compile & run: ``` # make mkdir -p somelib gcc -shared somelib.c -Wl,-soname,libsomelib.so -o somelib/libsomelib.so gcc main.c -o main -ldl # ./main dlopen first load: 0x7f06a28a4ca0 dlopen by file path: 0x7f06a28a4ca0 dlopen by file name: 0 Error loading shared library libsomelib.so: No such file or directory ``` Do you have any plans to support it? -- - Ilia