【发布时间】:2014-11-05 16:31:05
【问题描述】:
我正在尝试在 Ubuntu 12.04.5 LTS 上构建 stanford NLP 的 python 界面。 需要两个步骤,第一个是:
- 通过在 3rdParty/jpype 中运行“rake setup”来编译 Jpype
这样做时我收到以下错误:
In file included from src/native/common/jp_monitor.cpp:17:0:
src/native/common/include/jpype.h:45:17: fatal error: jni.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
rake aborted!
Command failed with status (1): [cd JPype-0.5.4.1 && python setup.py build...]
错误消息显示我缺少jni.h,因此建议here 如果我运行命令dpkg-query -L openjdk-7-jdk | grep "jni.h" 得到/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h。
我相信这意味着我的系统上确实有jni.h,所以我现在很困惑。是什么导致了错误?你能提出任何解决办法吗?
感谢您的帮助!
更多见解
这是导致错误的指令:
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.7 -c src/native/common/jp_class.cpp -o build/temp.linux-x86_64-2.7/src/native/common/jp_class.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
In file included from src/native/common/jp_class.cpp:17:0:src/native/common/include/jpype.h:45:17: fatal error: jni.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
它来自python接口所需的JPype的编译。我不知道为什么,但它包含了我的文件系统中没有的路径(即-I/usr/lib/jvm/java-1.5.0-sun-1.5.0.08/include/linux)。
如何正确配置这些路径?
【问题讨论】:
标签: java python java-native-interface stanford-nlp openjdk