开发者

Android NDK: Trying to port JnetPcap

I found a traffic monitoring application for Android, Shark: http://sourceforge.net/projects/prueba-android/ which is based on JnetPcap and has a file with all the source files and the appropriate Android.mk files. I put the jni directory in the samples file of the Android-NDK and I tried to build it using ndk-build -C. During the compilation occurs some errors. Here is the error log I take:

make: Entering directory `/home/thanasis/android-ndk-r5b/samples    /jnetpcap_pure/jni'
Compile thumb  : jnetpcap <= util_crc16.c
Compile thumb  : jnetpcap <= util_crc32.c
Compile++ thumb  : jnetpcap <= jnetpcap.cpp
Compile++ thumb  : jnetpcap <= packet_flow.cpp
Compile++ thumb  : jnetpcap <= packet_jheader.cpp
Compile++ thumb  : jnetpcap <= jnetpcap_pcap_header.cpp
Compile++ thumb  : jnetpcap <= nio_jbuffer.cpp
Compile++ thumb  : jnetpcap <= winpcap_stat_ex.cpp
Compile++ thumb  : jnetpcap <= winpcap_send_queue.cpp
Compile++ thumb  : jnetpcap <= winpcap_ext.cpp
Compile++ thumb  : jnetpcap <= jnetpcap_ids.cpp
Compile++ thumb  : jnetpcap <= jnetpcap_dumper.cpp
Compile++ thumb  : jnetpcap <= jnetpcap_utils.cpp
Compile++ thumb  : jnetpcap <= util_in_cksum.cpp
Compile++ thumb  : jnetpcap <= jnetpcap_beta.cpp
Compile++ thumb  : jnetpcap <= nio_jmemory.cpp
Compile++ thumb  : jnetpcap <= packet_jsmall_scanner.cpp
Compile++ thumb  : jnetpcap <= packet_protocol.cpp
Compile++ thumb  : jnetpcap <= nio_jnumber.cpp
Compile++ thumb  : jnetpcap <= packet_jheader_scanner.cpp
Compile++ thumb  : jnetpcap <= packet_jscan.cpp
Compile++ thumb  : jnetpcap <= util_checksum.cpp
Compile++ thumb  : jnetpcap <= packet_jpacket.cpp
Compile++ thumb  : jnetpcap <= winpcap_ids.cpp
Compile++ thumb  : jnetpcap <= util_debug.cpp
Compile++ thumb  : jnetpcap <= jnetpcap_bpf.cpp
Compile thumb  : pcap <= bpf_dump.c
Compile thumb  : pcap <= bpf_filter.c
Compile thumb  : pcap <= bpf_image.c
Compile thumb  : pcap <= etherent.c
Compile thumb  : pcap <= fad-gifc.c
Compile thumb  : pcap <= gencode.c
yacc  /home/thanasis/android-ndk-r5b/samples/jnetpcap_pure    /jni/libpcap/grammar.y 
mv -f y.tab.c /home/thanasis/android-ndk-r5b/samples/jnetpcap_pure    /jni/libpcap/grammar.c
Compile thumb  : pcap <= grammar.c
Compile thumb  : pcap <= inet.c
Compile thumb  : pcap <= nametoaddr.c
Compile thumb  : pcap <= optimize.c
Compile thumb  : pcap <= pcap.c
Compile thumb  : pcap <= pcap-linux.c
Compile thum开发者_如何学Cb  : pcap <= savefile.c
Compile thumb  : pcap <= scanner.c
Compile thumb  : pcap <= version.c
StaticLibrary  : libpcap.a
StaticLibrary  : libstdc++.a
SharedLibrary  : libjnetpcap.so
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/obj/local    /armeabi/libpcap.a(gencode.o): In function `pcap_compile':
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/jni/libpcap    /gencode.c:389: undefined reference to `pcap_parse'
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/obj/local    /armeabi/libpcap.a(grammar.o): In function `yyparse':
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure    /jni/y.tab.c:1941: undefined reference to `yylex'
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/obj/local    /armeabi/libpcap.a(scanner.o): In function `pcap_lex':
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure    /jni/scanner.l:342: undefined reference to `pcap_lval'
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/obj/local    /armeabi/libpcap.a(scanner.o): In function `pcap_lex':
/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure    /jni/<stdout>:3554: undefined reference to `pcap_lval'
collect2: ld returned 1 exit status
make: *** [/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure    /obj/local/armeabi/libjnetpcap.so] Error 1
make: Leaving directory `/home/thanasis/android-ndk-r5b    /samples    /jnetpcap_pure/jni' 

here are the Andoid.mk files: /home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/jni/Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS)

LOCAL_MODULE := jnetpcap

LOCAL_SRC_FILES :=\
jnetpcap.cpp\
packet_flow.cpp\
packet_jheader.cpp\
jnetpcap_pcap_header.cpp\
nio_jbuffer.cpp\
winpcap_stat_ex.cpp\
winpcap_send_queue.cpp\
winpcap_ext.cpp\
jnetpcap_ids.cpp\
jnetpcap_dumper.cpp\
jnetpcap_utils.cpp\
util_in_cksum.cpp\
jnetpcap_beta.cpp\
nio_jmemory.cpp\
packet_jsmall_scanner.cpp\
packet_protocol.cpp\
nio_jnumber.cpp\
packet_jheader_scanner.cpp\
packet_jscan.cpp\
util_checksum.cpp\
packet_jpacket.cpp\
winpcap_ids.cpp\
util_debug.cpp\
util_crc16.c\
util_crc32.c\
jnetpcap_bpf.cpp

LOCAL_C_INCLUDES :=\
$(NDK_ROOT)/platforms/android-8/arch-arm/usr/include\
$(LOCAL_PATH)/libpcap

LOCAL_CFLAGS := -DLIBPCAP_VERSION=0x097

LOCAL_STATIC_LIBRARIES := libpcap

include $(BUILD_SHARED_LIBRARY)

include $(LOCAL_PATH)/libpcap/Android.mk

/home/thanasis/android-ndk-r5b/samples/jnetpcap_pure/jni/libpcap/Android.mk:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:=\
bpf_dump.c\
bpf/net/bpf_filter.c\
bpf_image.c\
etherent.c\   
fad-gifc.c\
gencode.c\
grammar.c\
inet.c\
nametoaddr.c\
optimize.c\
pcap.c\
pcap-linux.c\
savefile.c\
scanner.c\
version.c

LOCAL_CFLAGS:=-O2 -g
LOCAL_CFLAGS+=-DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dlinux -D__GLIBC__ -D_GNU_SOURCE

LOCAL_MODULE:= libpcap

include $(BUILD_STATIC_LIBRARY)

Can anyone help me please?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜