I have a MyApp project which is dependent of lib1.so library. lib1.so has own dependency lib2.so:
MyApp -> lib1.so -> lib2.so
I want to run MyApp with all dependencies in one directory.
For lib1.so the solution is -rpath key in linker options:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'")
But it does not work for lib2.so - the application does not find it.
It seems lib1.so do not use rpath of application.
Is there any way to specify rpath for lib1.so?
A couple of options are available:
MyAppwith bothlib2.soandlib1.so, so that it loadslib2.sousingMyApp's rpath before loadinglib1.so.patchelf --set-rpath '$ORIGIN' lib1.soto makelib1.souse$ORIGINwhen looking forlib2.so.