[PATCH] Add a flag for overriding default JNI library search path (original) (raw)

Jakub Vaněk linuxtardis at gmail.com
Sun Nov 25 15:51:32 UTC 2018


Hi all,

this patch provides a way how to override where Hotspot searches for libraries by default. This specifically affects JNI libraries

To achieve this, a new configure flag is added: --with-hotspot-libpath. When this option is specified, the path is passed to the os_*.cpp files, where it overrides the existing DEFAULT_LIBPATH string. I tried to follow the way FreeType and other flags are specified.

The goal of this patch is to eliminate Linux distribution-specific patches targetted at doing this. In particular, this patch was inspired by Debian/Ubuntu solution. For example, this is the libpath that is used on armel: /usr/lib/arm-linux-gnueabi/jni:/lib/arm-linux-gnueabi:/usr/lib/arm- linux-gnueabi:/usr/lib/jni:/lib:/usr/lib

For now, it is possible to override the path only on Linux, BSD and AIX. Other platforms don't have the DEFAULT_LIBPATH #define.

I tried building OpenJDK locally with the flag and it worked.

Thanks,

Jakub

HG changeset patch

User Jakub Vaněk <linuxtardis at gmail.com>

Date 1543089715 -3600

Sat Nov 24 21:01:55 2018 +0100

Node ID 2fbd203937c0a42439a48c9c5b505f239a8832af

Parent 30a02b4e6c06e874ec8735dedb7e894844b1d627

Add a flag for overriding default JNI library search path

diff --git a/doc/building.html b/doc/building.html --- a/doc/building.html +++ b/doc/building.html @@ -463,6 +463,7 @@

  • --with-jvm- variants=[,...] - Build the specified variant (or variants) of Hotspot. Valid variants are: server, client, minimal, core, zero, custom. Note that not all variants are possible to combine in a single build.
  • --with-jvm- features=[,...] - Use the specified JVM features when building Hotspot. The list of features will be enabled on top of the default list. For the custom JVM variant, this default list is empty. A complete list of available JVM features can be found using bash configure --help.
  • --with-target-bits= - Create a target binary suitable for running on a platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a reduced build.)
  • +
  • --with-hotspot-libpath= - Override the default runtime library search path. Use this if you want to override where HotSpot searches for JNI libraries by default.
  • Configure Arguments for Native Compilation