Seems that -Wl,-rpath, does what I need.

> On Mar 1, 2017, at 5:58 PM, Jim Laskey (Oracle) <james.las...@oracle.com> 
> wrote:
> 
> I have a service library that creates an instance of the jvm (on OEL linux.)  
> I have no control of where the library is used or how the environment is 
> configured, ie., it needs to be self contained.
> 
> When I link. I more or less...
> 
> g++ *.cpp /usr/lib/jvm/jre/lib/amd64/server/libjvm.so -Wl,-whole-archive *.a 
> -Wl,-no-whole-archive -o libmine.so
> 
> ldd  libmine.so
> 
>       linux-vdso.so.1 =>  (0x00007ffc183d6000)
>       libjvm.so => not found
>       libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f18fd1f4000)
>       libm.so.6 => /lib64/libm.so.6 (0x00007f18fcef2000)
>       libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f18fccdc000)
>       libc.so.6 => /lib64/libc.so.6 (0x00007f18fc91a000)
>       /lib64/ld-linux-x86-64.so.2 (0x000055d478b6b000)
> 
> The only way I can get this to work where needed is to 
> 
> export LD_LIBRARY_PATH=/usr/lib/jvm/jre/lib/amd64/server:.
> 
> How do I get the linker to hard code the full jvm library path so this is 
> unnecessary?
> 
> Cheers,
> 
> - Jim
> 
> 
> 

Reply via email to