Problems compiling JPype

I have a nice old nightmare with JPype. I have my dev env on Windows and therefore tried installing it there without any luck. Then I also tried Ubunto. Now I am a little desperate. I use Mingw32 since I tried to install VS2008, but he told me that I need to install XP SP2, but I'm in Vista. I tried VS2010, but no luck, I got the error "Could not find vcvarsall.bat". Anyway, I'm on Mingw32 now

I end up trying to use Neo4j and Python, so I need to use JPype. I found so many links to a network problem for MySQL, etc., but they do not help me with JPype.

If I could fix unix or windows, I could go so that help on any of them would be really appreciated.

Here are the versions ..

Windows: Vista 64 Python: 2.6 Mingw32 compiler: latest version of Jpype: 0.5.4.1 Java information: java version "1.6.0_13" Java (TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot (TM) 64 -bit server VM (build 11.3-b02, mixed mode)

I run:

python setup.py install --compiler = wingw32

and get the following conclusion.

Selecting a Windows profile launching installation running assembly running build_py running build_ext extension '_jpype' C: \ MinGW \ bin \ gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32 = 1 "-IC: \ Program Files (x86) \ Java \ jdk1.6.0_21 / include "" -IC: \ Program Files (x86) \ Java \ jdk1.6.0_21 / include / win32 "-Isrc / native / common / include -Isrc / native / python / include -Ic: \ Python26 \ include -Ic: \ Python26 \ PC -c src / native / common / jp_array.cpp -o build \ temp.win32-2.6 \ Release \ src \ native \ common \ jp_array.o / EHsc src / native / common /jp_array.cpp: In the member function 'void JPArray :: setRange (int, int, std :: vector &)': src / native / common / jp_array.cpp: 56: 13: warning: comparison between integer expression with signed and unsigned src / native / common / jp_array.cpp: 68: 4: warning: deprecated conversion from string constant to 'char *' src / native / co mmon / jp_array.cpp: In the member function 'void JPArray :: setItem (int, HostRef *)': src / native / common / jp_array.cpp: 80: 3: warning: deprecated conversion from string constant to 'char *' gcc: / EHsc: No such file or directory Error: 'gcc' command failed with exit status 1

So, on unix Ubunto, the problem is this:

Java Version: 1.6.0_18 JPype: 0.5.4.1 Python: 2.6

Java is on the way, and I already did apt-get install build-essentials, so you have the latest GCC, etc.

I will not embed all output as massive. There are as many bugs as I missed installing Java or the like, but I don't have them. After typing java, I will go to the version above. This is the beginning:

run installation running build run build_py running build_ext extension '_jpype' gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I / usr / lib / jvm / java-1.5. 0-sun-1.5.0.08 / include -I / usr / lib / jvm / java-1.5.0-sun-1.5.0.08 / include / linux -Isrc / native / common / include -Isrc / native / python / include - I / usr / include / python2.6 -c src / native / common / jp_javaenv_autogen.cpp -o build / temp.linux-i686-2.6 / src / native / common / jp_javaenv_autogen.o cc1plus: warning: command line option "- Wstrict-prototypes "is valid for Ada / C / ObjC, but not for C ++. The file is included from src / native / common / jp_javaenv_autogen.cpp: 21: src / native / common / include / jpype.h: 45: 17: error: jni.h: There is no such file or directory. The file is included from src / native / common / jp_javaenv_autogen.cpp: 21: src / native / common / include / jpype.h: 77: error: ISO C ++ prohibits declaring "jchar without type src / native / common / include / jpype.h: 77: error: expected 'or' ... before 'token src / native / common / include / jpype.h: 82: error: ISO C ++ prohibits declaring 'jchar without type src / native / common / include / jpype.h: 82: error: expected'; before 'token src / native / common / include / jpype.h: 86: error: ISO C ++ prohibits declaring' jchar without type src / native / common / include / jpype.h: 86: error: expected '; before & sign src / native / common / include / jpype.h: 88: error: expected '; before' private src / native / common / include / jpype.h: 89: error: ISO C ++ prohibits declaring 'jchar without src type /native/common/include/jpype.h: 89: error: expected '; before the '* token In the file included from src / native / common / include / jpype.h: 96, from src / native / common / jp_javaenv_autogen.cpp: 21:

And this is the end:

src / native / common / include / jp_monitor.h: 27: error: 'jobject does not name type src / native / common / jp_javaenv_autogen.cpp: 30: error:' jbyte does not name type src / native / common / jp_javaenv_autogen.cpp: 38: error: 'jbyte does not name type src / native / common / jp_javaenv_autogen.cpp: 45: error: variable or field' SetStaticByteField is invalidated src / native / common / jp_javaenv_autogen.cpp: 45: error: "jclass was not declared in this area src / native / common / jp_javaenv_autogen.cpp: 45: error: 'jfieldID was not declared in this area src / native / common / jp_javaenv_autogen.cpp: 45: error:' jbyte was not declared in this area Error: command ' gcc 'failed with exit status 1

+2
source share
3 answers

I had the same error on Linux. It worked for me just doing

export JAVA_HOME=/usr/lib/[*your_java_folder*] 

Take a look at the setup.py 45 line:

 def setupLinux(self): self.javaHome = os.getenv("JAVA_HOME") if self.javaHome is None : self.javaHome = '/usr/lib/jvm/java-1.5.0-sun-1.5.0.08' # Ubuntu linux 
+3
source
 gcc: /EHsc: No such file or directory error: command 'gcc' failed with exit status 1 

EHsc is a Microsoft toolchain-specific compiler. therefore you get this error. Are you mixing software chains somewhere, somehow - maybe some of the remaining files from a previous attempt? I would need to download JPype to verify the building using mingw32.

You know that you can download the JPype binary distribution for Python 2.6 and Pytho 2.5, though?

As for your * NIX assembly, you are missing Java / JNI development headers, so Java types for C are not available, and the compiler cannot recognize them. Install the dev package and make sure your toolchain can find them.

+1
source

Edit Setup.py and remove the / EHsc option.

+1
source

Source: https://habr.com/ru/post/1206266/


All Articles