diff --git a/setup.py b/setup.py index 46103bcc..69a9ba90 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ except ImportError: import subprocess from os import environ -from os.path import dirname, join, exists +from os.path import dirname, join, exists, isdir import sys from platform import machine from setup_sdist import SETUP_KWARGS @@ -119,6 +119,13 @@ def compile_native_invocation_handler(*possible_homes): )] else: LIB_LOCATION = 'jre/lib/server/libjvm.dylib' + FULL_LIB_LOCATION = join(JRE_HOME.decode(), LIB_LOCATION) + + if not exists(FULL_LIB_LOCATION): + # In that case, the Java version is very likely >=9. + # So we need to modify the `libjvm.so` path. + LIB_LOCATION = 'lib/server/libjvm.dylib' + INCLUDE_DIRS = [ '{0}/include'.format(FRAMEWORK), '{0}/include/darwin'.format(FRAMEWORK) @@ -180,6 +187,12 @@ def compile_native_invocation_handler(*possible_homes): else: INCL_DIR = join(JDK_HOME, 'include', 'linux') LIB_LOCATION = 'jre/lib/{}/server/libjvm.so'.format(CPU) + FULL_LIB_LOCATION = join(JRE_HOME.decode(), LIB_LOCATION) + + if not exists(FULL_LIB_LOCATION): + # In that case, the Java version is very likely >=9. + # So we need to modify the `libjvm.so` path. + LIB_LOCATION = 'lib/server/libjvm.so' INCLUDE_DIRS = [ join(JDK_HOME, 'include'),