HOWTO: Compile jpcap 0.7 for amd64

March 18, 2009

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

tags: , ,
posted in Unix/Linux by BOYPT

Follow comments via the RSS Feed | Leave a comment | Trackback URL

3 Responses to HOWTO: Compile jpcap 0.7 for amd64

  1. unknown says:

    Thank youuuuuuuu! :)
    The package for amd64 works fine also in ubuntu 9.10.
    Please send it to jpcap developers!

  2. Henry says:

    Tanks a lot, I tested it, also in ubuntu 9.10.

  3. mrossij says:

    Thanks thanks thanks!!
    You resolved my three days of internet searching. Work in ubuntu 11.10 to!!!.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Page optimized by WP Minify WordPress Plugin

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org