As was introduced in it’s project home, Jpcap is a Java library for capturing and sending network packets. However, this project hadn’t been updated for quite a long time, and NO any 64bit platform version was provided.
In the Google Discussion Group, “Tri” tried to compile jpcap in Ubuntu 8.04 64bit, and failed, giving such infomation:
/usr/bin/ld: /tmp/cc7mzY1t.o: relocation R_X86_64_32 against `a localsymbol’
can not be used when making a shared object; recompile with -fPIC
/tmp/cc7mzY1t.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libjpcap.so] Error 1
In fact this’s not a big problem, can be fixed easily.
Edit the Makefile, find such pragaph:(if you compile for Linux)
ifeq ($(PLATFORM), Linux)
JNI_INCLUDE2 = $(JAVA_DIR)/include/linux
COMPILE_OPTION = -shared -L.
SUFFIX = .so
Insert -fPIC to COMPILE_OPTION as reminded:
ifeq ($(PLATFORM), Linux)
JNI_INCLUDE2 = $(JAVA_DIR)/include/linux
COMPILE_OPTION = -fPIC -shared -L.
SUFFIX = .so
OK, try to make it, it should be done in seconds, and you get a 64 version of libjpcap.so.
The -fPIC option told the gcc emit position-independent codes for dynamic linking. I think this should be added whatever system you use, but somehow it works all right without -fPIC in 32bit Linux.
The java part of jpcap didn’t need to compile again anyway, for the java platform indepentdence.
Then, copy it to /usr/lib/libjpcap.so, and /usr/java/packages/lib/ext/jpcap.jar, I bet every thing goes fine.
I already packed a deb and it works perfectly in Ubuntu 8.10 amd64, it should also be compatible to the whole Debian serious. Also, I correct the deb depent form sun-jave6-jdk to sun-jave6-jre, in fact, it even works OK with OpenJDK.
Download it here : http://ptcoding.googlecode.com/files/jpcap0.7_amd64.deb
Thank youuuuuuuu! :)
The package for amd64 works fine also in ubuntu 9.10.
Please send it to jpcap developers!
Tanks a lot, I tested it, also in ubuntu 9.10.
Thanks thanks thanks!!
You resolved my three days of internet searching. Work in ubuntu 11.10 to!!!.
Hey
Where is this makefile so I can edit it ?
Regards