JPype编译问题 [英] JPype compile problems

查看:86
本文介绍了JPype编译问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和JPype有一个正确的老噩梦。我在Windows上有我的开发环境,因此尝试在那里安装它没有运气。然后我尝试了Ubunto也没有运气。我现在有点绝望了。我使用Mingw32,因为我尝试安装VS2008,但它告诉我我必须安装XP SP2,但我在Vista上。我试过VS2010,但没有运气,我得到'错误:无法找到vcvarsall.bat'错误。无论如何,我现在在Mingw32

I'm having a right old nightmare with JPype. I have got my dev env on Windows and so tried installing it there with no luck. I then tried on Ubunto also with no luck. I'm getting a bit desperate now. I am using Mingw32 since I tried installing VS2008 but it told me I had to install XP SP2 but I am on Vista. I tried VS2010 but no luck, I got the 'error: Unable to find vcvarsall.bat' error. Anyway, I am now on Mingw32

最终我试图使用Neo4j和Python因此我需要使用JPype。我在网上找到了很多关于MySQL等问题的引用,但它们对我没有帮助。

Ultimately I am trying to use Neo4j and Python hence my need to use JPype. I have found so many references to the problem on the net for MySQL etc but they don't help me with JPype.

如果我可以修复unix或windows,我可以开始这样的帮助,将非常感谢。

If I could fix unix or windows I could get going so help on either will be really appreciated.

这是版本..

Windows:Vista 64
Python:2.6
编译器Mingw32:最新版本
Jpype:0.5.4.1
Java信息:
java版本1.6.0_13
Java(TM)SE运行时环境(版本1.6.0_13-b03 )
Java HotSpot(TM)64位服务器VM(版本11.3-b02,混合模式)

Windows: Vista 64 Python: 2.6 Compiler Mingw32: latest version Jpype: 0.5.4.1 Java info: 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)

我运行:

python setup.py install --compiler = wingw32

python setup.py install --compiler=wingw32

并获得以下输出。

选择Windows配置文件
运行安装
运行build
运行build_py
运行build_ext
构建'_jpype'扩展名
C:\MinGW \\ \\ bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32 = 1-IC:\ Program Files(x86)\ Java \ _ddk1.6.0_21 / include - IC:\程序文件(x86)\ Java \ _ddk1.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\\\
ative\common\jp_array.o / EHsc
src / native / common / jp_array.cpp:在成员函数'void JPArray :: setRange (int,int,std :: vector&)':
src / native / common / jp_array.cpp:56:13:警告:有符号和无符号整数表达式之间的比较
src / native / common / jp_array.cpp:68:4:警告:不推荐将字符串常量转换为'char *'
src / native / common / jp_array.cpp:在成员函数'void JPArray :: setItem(int,HostRef *)'中:
src / native / common / jp_array.cpp:80:3:警告:不推荐将字符串常量转换为'char *'
gcc:/ EHsc:没有这样的文件或目录
错误:命令'gcc'失败,退出状态为1

Choosing the Windows profile running install running build running build_py running build_ext building '_jpype' extension 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 member function 'void JPArray::setRange(int, int, std::vector&)': src/native/common/jp_array.cpp:56:13: warning: comparison between signed and unsigned integer expressions src/native/common/jp_array.cpp:68:4: warning: deprecated conversion from string constant to 'char*' src/native/common/jp_array.cpp: In 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: command 'gcc' failed with exit status 1

所以在unix Ubunto上问题如下:

So on unix Ubunto the problem is as follows:

Java版本:1.6.0_18
JPype:0.5.4.1
Python:2.6

Java version: 1.6.0_18 JPype: 0.5.4.1 Python: 2.6

Java在路径中,我做了apt-get install build - 刚才有最新的GCC等。

Java is in the path and I did apt-get install build-essentials just now so have latest GCC etc.

我不会粘贴所有输出,因为它很大。这么多的错误就像我错过了Java或类似的安装,但我没有。输入java将我带入上面的版本。这是开始:

I won't paste all the output as it's massive. So many errors it's like I have missed the install of Java or similar but I haven't. typing java takes me into version above. This is the beginning:

运行安装
运行build
运行build_py
运行build_ext
构建'_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:警告:命令行选项-Wstrict-prototypes是适用于Ada / C / ObjC但不适用于C ++
src / native / common / jp_javaenv_autogen.cpp中包含的文件:21:
src / native / common / include / jpype.h:45:17 :错误:jni.h:没有这样的文件或目录
在src / native / common / jp_javaenv_autogen.cpp中包含的文件中:21:
src / native / common / include / jpype.h:77:错误:ISO C ++禁止声明'jchar',没有类型
src / nati ve / common / include / jpype.h:77:错误:在''标记之前预期','或'...'
src / native / common / include / jpype.h:82:错误:ISO C ++禁止声明'jchar'没有类型
src / native / common / include / jpype.h:82:错误:预期';'在'
'之前'$ $ $ $ src / native / common / include / jpype.h:86:错误:ISO C ++禁止声明'jchar'没有类型
src / native / common / include / jpype.h:86:错误:期望';'之前'&'令牌
src / native / common / include / jpype.h:88:错误:预期';'在'private'之前
src / native / common / include / jpype.h:89 :错误:ISO C ++禁止声明'jchar'没有类型
src / native / common / include / jpype.h:89:错误:期望';'之前'*'令牌
包含在文件中来自src / native / common / include / jpype.h:96,来自src / native / common / jp_javaenv_autogen.cpp的
:21:

running install running build running build_py running build_ext building '_jpype' extension 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++ In file included from src/native/common/jp_javaenv_autogen.cpp:21: src/native/common/include/jpype.h:45:17: error: jni.h: No such file or directory In file included from src/native/common/jp_javaenv_autogen.cpp:21: src/native/common/include/jpype.h:77: error: ISO C++ forbids declaration of ‘jchar’ with no type src/native/common/include/jpype.h:77: error: expected ‘,’ or ‘...’ before ‘’ token src/native/common/include/jpype.h:82: error: ISO C++ forbids declaration of ‘jchar’ with no type src/native/common/include/jpype.h:82: error: expected ‘;’ before ‘’ token src/native/common/include/jpype.h:86: error: ISO C++ forbids declaration of ‘jchar’ with no type src/native/common/include/jpype.h:86: error: expected ‘;’ before ‘&’ token src/native/common/include/jpype.h:88: error: expected ‘;’ before ‘private’ src/native/common/include/jpype.h:89: error: ISO C++ forbids declaration of ‘jchar’ with no type src/native/common/include/jpype.h:89: error: expected ‘;’ before ‘*’ token In file included from src/native/common/include/jpype.h:96, from src/native/common/jp_javaenv_autogen.cpp:21:

这是结束:

src / native / common / include / jp_monitor。 h:27:错误:'jobject'没有命名类型
src / native / common / jp_javaenv_autogen.cpp:30:错误:'jbyte'没有命名类型
src / native / common / jp_javaenv_autogen.cpp:38:错误:'jbyte'没有命名类型
src / native / common / jp_javaenv_autogen.cpp:45:错误:变量或字段'SetStaticByteField'声明为void
src / native / common / jp_javaenv_autogen.cpp:45:错误:'jclass'未在此范围内声明
src / native / common / jp_javaenv_autogen.cpp:45:错误:'jfieldID'未在此范围内声明
src / native / common / jp_javaenv_autogen.cpp:45:错误:'jbyte'未在此范围内声明
错误:命令'gcc'失败,退出状态为1

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

推荐答案

我在Linux上遇到了同样的错误。它对我来说只是执行

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

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

查看setup.py第45行:

Look at setup.py line 45:

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

这篇关于JPype编译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆