开发者

Android NDK: Compiling errors using libpcap for Android - functions "not declared in this scope"

I'm trying to port Jnetpcap (a java wrapper for libpcap with JNI) to Android. I've managed to compile libpcap as a static library using the source code in this repository: https://github.com/android/platform_external_libpcap and I obtained libpcap.a

When trying to compile Jnetpcap as a sha开发者_C百科red library (and linking with libpcap.a) I'm getting errors because some libpcap's functions "weren't declared in this scope". Those functions are: pcap_create(), pcap_activate(), pcap_can_set_rfmon(), pcap_set_buffer_size(), pcap_set_promisc(), pcap_set_snaplen() and pcap_set_timeout().

Those functions exist in the original version of libpcap (the one which the packet libpcap-dev provides) but seems that the android's version doesn't have them. The same source files of Jnetpcap can be compiled for intel x86 and x64 platforms without problems.

Am I doing something wrong? Are those functions really missing?

I hope any of you guys know how to fix this. Thanks.


Unfortunately it looks like that version 0.9.8 of libpcap doesn't support these functions. Versions >= 1.0.0 contains them. So right now you have 2 possibilities. Compile newer version of libpcap by modification Android.mk for old version a little to include new files. Or downgrade jnetpcap to version that support old libpcap. Libpcap 0.9.8 if from 2007 so you should choose jnetpcap from around this year as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜