Closed zhenchuan closed 10 years ago
Thanks for reporting. Please post your complete compile_bridge.sh.
thanks for your reply. the complete compile_bridge.sh as bellows.
# [ "X${JAVA_HOME}" = "X" ] && JAVA_HOME=/usr/lib/jvm/java-6-openjdk DBDIR=../../../Db
cd library gcc -O2 -march=x86-64 -lm -shared -I${JAVA_HOME}/include ../src/native/whitedbDriver.c ${DBDIR}/dbmem.c ${DBDIR}/dballoc.c ${DBDIR}/dbdata.c ${DBDIR}/dblock.c ${DBDIR}/dbindex.c ${DBDIR}/dbtest.c ${DBDIR}/dblog.c ${DBDIR}/dbhash.c ${DBDIR}/dbcompare.c ${DBDIR}/dbquery.c ${DBDIR}/dbutil.c ${DBDIR}/dbmpool.c ${DBDIR}/dbschema.c ${DBDIR}/dbjson.c ${DBDIR}/../json/yajl_all.c -o libwhitedbDriver.so
and is there any jni benchmark data ?
I have no idea what is causing that error. But apparently compile succeeds and link fails with something related to the JAVA_HOME path, so you can try the following (I've split the compile and link phases):
#!/bin/sh
#
[ "X${JAVA_HOME}" = "X" ] && JAVA_HOME=/usr/lib/jvm/java-6-openjdk
DBDIR=../../../Db
cd library
gcc -O2 -march=x86_64 -I${JAVA_HOME}/include -c ../src/native/whitedbDriver.c ${DBDIR}/dbmem.c ${DBDIR}/dballoc.c ${DBDIR}/dbdata.c ${DBDIR}/dblock.c ${DBDIR}/dbindex.c ${DBDIR}/dbtest.c ${DBDIR}/dblog.c ${DBDIR}/dbhash.c ${DBDIR}/dbcompare.c ${DBDIR}/dbquery.c ${DBDIR}/dbutil.c ${DBDIR}/dbmpool.c
gcc -lm -shared whitedbDriver.o dbmem.o dballoc.o dbdata.o dblock.o dbindex.o dbtest.o dblog.o dbhash.o dbcompare.o dbquery.o dbutil.o dbmpool.o -o libwhitedbDriver.so
Regarding the jni, there isn't any benchmark data other that the YCSB test from last year. We're not actively developing or even supporting the Java bindings, as we don't have Java expertise and the manpower to do that.
thanks, that may be works, a typo of your script gcc -O2 -march=x86_64
x86-64
but a different error occurs:
➜ jni git:(master) ✗ vim compile_bridge.sh
➜ jni git:(master) ✗ ./compile_bridge.sh
Undefined symbols for architecture x86_64:
"_wg_find_document", referenced from:
_check_and_merge_by_kv in dbquery.o
_wg_make_json_query in dbquery.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Sorry, my mistake. Please try this one instead:
#!/bin/sh
#
[ "X${JAVA_HOME}" = "X" ] && JAVA_HOME=/usr/lib/jvm/java-6-openjdk
DBDIR=../../../Db
cd library
gcc -O2 -march=x86-64 -c -I${JAVA_HOME}/include ../src/native/whitedbDriver.c ${DBDIR}/dbmem.c ${DBDIR}/dballoc.c ${DBDIR}/dbdata.c ${DBDIR}/dblock.c ${DBDIR}/dbindex.c ${DBDIR}/dbtest.c ${DBDIR}/dblog.c ${DBDIR}/dbhash.c ${DBDIR}/dbcompare.c ${DBDIR}/dbquery.c ${DBDIR}/dbutil.c ${DBDIR}/dbmpool.c ${DBDIR}/dbschema.c ${DBDIR}/dbjson.c ${DBDIR}/../json/yajl_all.c
gcc -lm -shared whitedbDriver.o dbmem.o dballoc.o dbdata.o dblock.o dbindex.o dbtest.o dblog.o dbhash.o dbcompare.o dbquery.o dbutil.o dbmpool.o dbschema.o dbjson.o yajl_all.o -o libwhitedbDriver.so
many thanks. it works!
first,i have to change the compile.sh and compile_bridge.sh by setting
gcc -O2 -march=pentium4
togcc -O2 -march=x86-64
➜ jni git:(master) ✗ java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
➜ jni git:(master) ✗ ./compile_java.sh ➜ jni git:(master) ✗ ./compile_bridge.sh ld: can't map file, errno=22 file '/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/include/darwin' for architecture x86_64 collect2: error: ld returned 1 exit status