Search code examples
c++dlopenrhel7

dlopen failing on Rhel 7.2, 64 bit for libjvm.so


I am calling dlopen ("libjvm.so", RTLD_NOLOAD) on RHEL 64 within a 64 bit java process. and it fails with error:

 libjvm.so: invalid mode for dlopen(): Invalid argument

I did lsof -p <pid of java process> and it shows libjvm.so as a loaded module. the libjvm.so is loaded from path jre1.8.0_121/lib/amd64/server/libjvm.so. Not able to find more about that error . The same thing works fine when using 32 bit version of java. where the libjvm.so is being loaded from lib/i386/client directory. Appreciate any pointers about where to look for the reason or what this error really means. thanks.


Solution

  • invalid mode for dlopen()

    This is correct error: you've called dlopen with invalid mode.

    From dlopen man page

    One of the following two values must be included in flags:
       RTLD_LAZY ...
       RTLD_NOW  ...