0
回答
linux 下的jni,ld总找不到libjvm,我已经加了呀
科大讯飞通用文字识别100000次/天免费使用。立即申请   

java: oracle hotspot jvm 7

g++: 4.7.1

ld: 2.22

构建命令:

g++ a.cpp -I/opt/jdk/include -I/opt/jdk/include/linux -L/opt/jdk/jre/lib/i386 -L/opt/jdk/jre/lib/i386/server -ljava -ljvm -lverify

可以成功执行构建,无报错,执行提示找不到libjvm

系统配置 arch linux,如下,已经执行了ldconfig ,从新make了下,jdk路径都没问题

ldconfig 已经找到了libjava,为何ldd a.out却显示找不到?

#ldd a.out
        linux-gate.so.1 (0xb7790000)
        libjava.so => not found
        libjvm.so => /opt/jdk/jre/lib/i386/server/libjvm.so (0xb6b60000)
        libverify.so => not found
....


# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/opt/jdk/jre/lib/i386
/opt/jdk/jre/lib/i386/server

# ldconfig -v | grep java
ldconfig: Path `/usr/lib' given more than once
        libjavaplugin_jni.so -> libjavaplugin_jni.so
        libjava_crw_demo.so -> libjava_crw_demo.so
        libjava.so -> libjava.so
        libjavaplugin_nscp.so -> libjavaplugin_nscp.so
        libjavaplugin_oji.so -> libjavaplugin_oji.so
        libjavaplugin_nscp_gcc29.so -> libjavaplugin_nscp_gcc29.so

举报
Xingjian_Xu
发帖于6年前 0回/2K+阅
顶部