"required mapping already in use": When using JNI, what is the essence of the error message "lib___.so: required mapping 0x10000 size 0xcc00 is already in use by file /bin.../native_threads/java (lib___.so)", where lib___.so is the C module compiled into a dynamic loadable library?

Bill Vollers

Note: I'm not an expert on linker issues, so this answer may not address all occurrences of this issue, but it helped mine.

Our project involved converting a standalone C program into a library with a JNI interface. In doing the conversion, I inadvertently did not pass the '-G' flag to the linker when building the shared library. Since the program was previously standalone (and needed to continue as such in a separate build), it did have a main(). So instead of building a shared library, I had built an executable.

I got the above error message when attempting to load the executable as a library. Once I realized the problem, added the '-G' flag and rebuilt, the error was resolved.

So the lesson is: check that your shared library has really been built as a shared library when receiving this error message.

About | Sitemap | Contact