即時編譯JNI project.here期間的問題,我遇到的細節: [R在/ usr /斌/勞工處:找不到-ljvm:編譯JNI項目
[email protected]:/home/kaiwii/svn# make
gcc -shared build/utimebufClass.o build/contextClass.o build/fsClass.o build/javafuse_jni.o build/statClass.o build/statvfsClass.o build/fileinfoClass.o build/conninfoClass.o -o build/libjavafuse.so
gcc -g -Wall `pkg-config --cflags fuse` -Iinclude -I/usr/java/jdk1.6.0_31/include -I/usr/java/jdk1.6.0_31/include/linux `pkg-config --libs fuse` -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm -Lbuild -ljavafuse src/javafuse.c -o javafuse
src/javafuse.c: In function ‘javafuse_readdir’:
src/javafuse.c:2194:22: warning: cast from pointer to integer of different size
src/javafuse.c:2195:25: warning: cast from pointer to integer of different size
src/javafuse.c:2207:15: warning: cast to pointer from integer of different size
src/javafuse.c:2208:18: warning: cast to pointer from integer of different size
src/javafuse.c:2256:16: warning: cast from pointer to integer of different size
src/javafuse.c:2257:19: warning: cast from pointer to integer of different size
src/javafuse.c:2271:15: warning: cast to pointer from integer of different size
src/javafuse.c:2272:18: warning: cast to pointer from integer of different size
src/javafuse.c: In function ‘javafuse_releasedir’:
src/javafuse.c:2332:12: warning: assignment from incompatible pointer type
src/javafuse.c: In function ‘javafuse_fsyncdir’:
src/javafuse.c:2420:12: warning: assignment from incompatible pointer type
/usr/bin/ld: cannot find -ljvm
collect2: ld returned 1 exit status
make: *** [javafuse] 錯誤 1
[email protected]:/home/kaiwii/svn# ldconfig
[email protected]:/home/kaiwii/svn# gedit /etc/ld.so.conf
[email protected]:/home/kaiwii/svn# make
gcc -shared build/utimebufClass.o build/contextClass.o build/fsClass.o build/javafuse_jni.o build/statClass.o build/statvfsClass.o build/fileinfoClass.o build/conninfoClass.o -o build/libjavafuse.so
gcc -g -Wall `pkg-config --cflags fuse` -Iinclude -I/usr/java/jdk1.6.0_31/include -I/usr/java/jdk1.6.0_31/include/linux `pkg-config --libs fuse` -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm -Lbuild -ljavafuse src/javafuse.c -o javafuse
src/javafuse.c: In function ‘javafuse_readdir’:
src/javafuse.c:2194:22: warning: cast from pointer to integer of different size
src/javafuse.c:2195:25: warning: cast from pointer to integer of different size
src/javafuse.c:2207:15: warning: cast to pointer from integer of different size
src/javafuse.c:2208:18: warning: cast to pointer from integer of different size
src/javafuse.c:2256:16: warning: cast from pointer to integer of different size
src/javafuse.c:2257:19: warning: cast from pointer to integer of different size
src/javafuse.c:2271:15: warning: cast to pointer from integer of different size
src/javafuse.c:2272:18: warning: cast to pointer from integer of different size
src/javafuse.c: In function ‘javafuse_releasedir’:
src/javafuse.c:2332:12: warning: assignment from incompatible pointer type
src/javafuse.c: In function ‘javafuse_fsyncdir’:
src/javafuse.c:2420:12: warning: assignment from incompatible pointer type
/usr/bin/ld: cannot find -ljvm
collect2: ld returned 1 exit status
make: *** [javafuse] 錯誤 1
而且清酒的該libjvm.so在/ usr/lib中已經AREADY exisited,我直接作出一個CONF文件/ etc/ld.so.conf.d/my.conf:
/usr/lib
/usr/local/lib
,然後我使用命令LDCONFIG。 但不幸的是,我仍然遇到同樣的問題。 任何想法THX
well.libjvm.so實際上不在/ usr/lib中,而是在/usr/java/jdk1.6.0中_31/jre/lib/i386/server.And gedit包含/usr/java/jdk1.6.0_31/jre/lib/i386/server中的conf文件,其中包含/ usr/java/jdk1.6.0_31/jre/lib /i386/server.use命令,ldconfig和reboot.but它仍然提示相同的錯誤。 – 2012-03-31 07:14:43
謝謝......它的工作原理......實際上我直接使用了這個 - 「gcc -g -I /usr/lib/jvm/java-6-sun-1.6.0.26/include -I/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux -L /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/server -ljvm CallJVM.c「,a.out是創建。然後,我需要將它與libjvm.so鏈接到服務器文件夾中,如後所述。 – Rorschach 2013-04-02 13:43:48
安裝python javabridge模塊時發現類似問題:/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld:can not找到-ljvm。我創建了一個符號鏈接:cd/usr/lib; ln -s /usr/lib64/jvm/java-1_6_0-ibm-1.6.0/jre/lib/amd64/default/libjvm.so libjvm.so – 2014-02-18 13:40:05