How to get full path linkage for the jvm shared library

Jim Laskey (Oracle) james.laskey at
Wed Mar 1 21:58:44 UTC 2017

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/ -Wl,-whole-archive *.a -Wl,-no-whole-archive -o

ldd =>  (0x00007ffc183d6000) => not found => /lib64/ (0x00007f18fd1f4000) => /lib64/ (0x00007f18fcef2000) => /lib64/ (0x00007f18fccdc000) => /lib64/ (0x00007f18fc91a000)
	/lib64/ (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?


- Jim

More information about the build-dev mailing list