# Dlopen does not use RUNPATH on shared library SUSE 15SP6

**URL:** <https://forums.suse.com/t/dlopen-does-not-use-runpath-on-shared-library-suse-15sp6/45878>\
**Category:** General\
**Created:** [September 19, 2025, 1:02am UTC](https://forums.suse.com/t/dlopen-does-not-use-runpath-on-shared-library-suse-15sp6/45878 "2025-09-19T01:02:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![just\_curious](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@just\_curious](https://forums.suse.com/u/just_curious)\
**Post date:** [September 19, 2025, 1:02am UTC](https://forums.suse.com/t/dlopen-does-not-use-runpath-on-shared-library-suse-15sp6/45878/1 "2025-09-19T01:02:45Z")

</div>

I have an application which loads liba.so and at run time liba.so opens libb.so. Starting with SUSE Linux Enterprise Server 15 SP6 the code fails to load libb.so and does not use RUNPATH on the shared library. What has changed in SP6 from SP4 and how to make this code work?

1. Create a file a.c with the following code:  
#include \<stdio.h\>  
#include \<dlfcn.h\>  
void a\_func(void) {  
printf(“a.so: Trying to load b.so …\n”);  
void \*handle = dlopen(“libb.so”, RTLD\_LAZY | RTLD\_GLOBAL);  
if (!handle) {  
printf(“Failed to load b.so: %s\n”, dlerror());  
return;  
}  
void (\*b\_func)(void) = dlsym(handle, “b\_func”);  
b\_func();  
}  
Compile it with the following command:  
gcc -fPIC -shared -o liba.so a.c -Wl,-rpath,‘$ORIGIN’

2. Create another file b.c in the same directory as a.c, with the following code:  
#include \<stdio.h\>  
void b\_func(void) {  
printf(“Hello from b.so!\n”);  
}  
Compile it with the following command:

gcc -fPIC -shared -o libb.so b.c

1. Create another file main.c in another directory with the following code:  
#include \<stdio.h\>  
#include \<stdlib.h\>  
#include \<dlfcn.h\>

int main() {  
// Load the shared library  
void \*handle = dlopen(“/path/to/liba.so”, RTLD\_LAZY);  
if (!handle) {  
fprintf(stderr, “Error loading library: %s\n”, dlerror());  
exit(EXIT\_FAILURE);  
}

```auto
// Clear any existing errors
dlerror();

// Get the function pointer
void (*a_func)() = (void (*)())dlsym(handle, "a_func");
char *error = dlerror();
if (error != NULL) {
    fprintf(stderr, "Error locating function: %s\n", error);
    dlclose(handle);
    exit(EXIT_FAILURE);
}

// Call the function
a_func();

// Close the library
dlclose(handle);

return 0;

```

}

Compile it with the following command:  
gcc -o main.exe main.c -ldl

on SUSE 15SP4  
main.exe  
a.so: Trying to load b.so …  
Hello from b.so!

on SUSE 15SP6

main.exe  
a.so: Trying to load b.so …  
Failed to load b.so: libb.so: cannot open shared object file: No such file or directory

---

<div class="post-metadata">

**Author:** ![Harish\_Patil](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/harish_patil/32/12175_2.png) [@Harish\_Patil](https://forums.suse.com/u/Harish_Patil)\
**Post date:** [September 29, 2025, 7:00pm UTC](https://forums.suse.com/t/dlopen-does-not-use-runpath-on-shared-library-suse-15sp6/45878/2 "2025-09-29T19:00:37Z")

</div>

Thank you for posting this query.

We are also facing the similar issue.

Any alternative or solution will be appreiciable.

Thanks in advance.
