简体   繁体   中英

jpcap compilation/installation failing on Gumstix

( A bit of background can be found in my previous question here, if it assists someone in helping me: JamVm not running an application (that uses jpcap) on Gumstix ).

I am trying to run a packet sniffing java application on a Gumstix overo board. The application has been developed using Netbeans on windows 7. When I tried to run it on Gumstix (using JamVm), I got an error saying that a file libjpcap.so is missing. I then searched for jpcap package (or libjpcap.so) for angstrom distribution, and also for arm architecture (regardless of distro) but couldn't find anything.

Therefore, as suggested on the jpcap website ( http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/install.html ), I am now trying to compile the jpcap source code on my Gumstix board. In the makefile (/src/c/Makefile), I set JAVA_HOME to /usr/java/latest. When I execute 'make', I get a large number of errors. A few of them are shown below:

root@overo:/usr/src/jpcapTar/jpcap-0.7/src/c# make
gcc -shared -L. -I/usr/java/latest/include -I/usr/java/latest/include/linux\
         -I/usr/include\
        JpcapCaptor.c JpcapSender.c JpcapWriter.c\
          packet_arp.c packet_datalink.c packet_icmp.c packet_ip.c\
          packet_ipv6.c packet_tcp.c packet_udp.c\
        -o libjpcap.so -lpcap
JpcapCaptor.c:6:16: error: jni.h: No such file or directory
JpcapCaptor.c:7:17: error: pcap.h: No such file or directory
In file included from JpcapCaptor.c:35:
Jpcap_sub.h:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before '
*' token
Jpcap_sub.h:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before '
*' token
Jpcap_sub.h:55: error: 'PCAP_ERRBUF_SIZE' undeclared here (not in a function)
Jpcap_sub.h:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before '
JpcapHandler'
Jpcap_sub.h:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before '
UnknownHostException

Seeing that jni.h caused the first error message, I searched my linux box and but couldn't find jni.h. Is this missing file the cause of the errors? Have I forgotten to add some paths somewhere?

Any help would be highly appreciated. Thanks in advance.

(Answering my own question in the hope that it might help someone else)

For compiling jpcap on Gumstix, I first had to provide the following files and folders: 1) jni.h (I got it from the jamvm source code) 2) libpcap-1.1.1 source code (downloaded from tcpdump )

Now, in the jpcap make file (located in /jpcap-0.7/src/c/), I modified JAVA_DIR and PCAP_INCLUDE to point to the folder in which I had just downloaded libpcap and jni.h.

Jpcap still won't compile. It looks for a file named 'libpcap.so', whereas my gumstix has got 'libpcap.so.1'. Therefore, I created a symbolic link to point to this file:

ln --symbolic libpcap.so.1 libpcap.so

Running 'make' this time resulted in the file 'libjpcap.so' being created. Next I copied this file to /usr/lib/ and pointed LD_LIBRARY_PATH to this folder:

export LD_LIBRARY_PATH=/usr/lib/

The packet sniffing application started working after this. (I hope I haven't missed/forgotten any step.)

For this error:

JpcapCaptor.c:6:16: error: jni.h: No such file or directory 

and another -I and point to the jdkInstallRoot\\include directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM