ninia / jep

Embed Python in Java
Other
1.32k stars 150 forks source link

Install JEP on Windows #368

Closed sunyu90325 closed 2 years ago

sunyu90325 commented 2 years ago

Hi, I'm trying to install and use JEP. My JAVA version is 64bit openj9. But I found I can only install JEP with 32bit Python. Otherwise, I will get error below:

Creating library build\lib.win-amd64-3.9\jep\jep.cp39-win_amd64.lib and object build\lib.win-amd64-3.9\jep\jep.cp39-win_amd64.exp pyembed.obj : error LNK2001: unresolved external symbol __imp_JNI_GetCreatedJavaVMs build\lib.win-amd64-3.9\jep\jep.cp39-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe' failed with exit code 1120

When I use the successfully installed version(python 32bit and java 64 bit), I got "Can't load IA 32-bit .dll on an AMD 64-bit platform" which is as expected.

Could you help to see what I can try to build JEP with 64-bit python and 64-bit java? I put my java information and python information as references.

Thanks a lot!

Java version openjdk version "1.8.0_242" OpenJDK Runtime Environment (build 1.8.0_242-b08) Eclipse OpenJ9 VM (build openj9-0.18.1, JRE 1.8.0 Windows 10 amd64-64-Bit Compressed References 20200122_564 (JIT enabled, AOT enabled) OpenJ9 - 51a5857d2 OMR - 7a1b0239a JCL - 8cf8a30581 based on jdk8u242-b08)

Python version Python 3.8.8rc1 (tags/v3.8.8rc1:dfd7d68, Feb 17 2021, 11:01:21) [MSC v.1928 64 bit (AMD64)] on win32

bsteffensmeier commented 2 years ago

I'm not very familiar with building on windows but if it is able to build a 32 bit version then it must be finding a 32bit version of libjvm.dll to link with. Are you changing the JAVA_HOME when switching between 32bit and 64bit? The error you are seeing when linking with 64bit python would make sense if the system can only find a 32bit libjvm.dll. I would be curious if you have multiple libjvm.dll on your system and I suspect it is finding the wrong one when building jep.

sunyu90325 commented 2 years ago

Thank you so much for your help! I figured it out. It's because JAVA_HOME is pointing to the x86 version of OPENJ9. After changing it, the build works, and JEP works too.