采用Android NDK编译libpcap的 [英] Compile libpcap using Android NDK
问题描述
首先,让我这样一个普通的问题道歉,但我真的失去了这里。我已经做了很多尝试让libpcap的编制为Android,我没有看到任何图案或值得写下任何进展。
Firstly, let me apologize by such a generic question, but I'm really lost here. I've been doing a lot of attempts to get libpcap compiled for Android, and I don't see any pattern or any progress worth writing down.
我有一个非常简单的嗅探器(即在MIPS Linux的正常工作),使用libpcap的,所以我想对自己的哦,好吧......根本不算什么......我只编译libpcap的为Android(到最后,Android是只是一个Linux的)... 的这里的地方的问题开始。我对如何使用 NDK的构建
和 Android.mk
和所有的基础设施,以编译libpcap的不知道。
I have a very simple sniffer (that works fine in a MIPS linux) that uses libpcap, so I thought to myself oh, ok... no biggie... I'll just compile libpcap for Android (in the end, Android is just a Linux)... and here's where the problems started. I have no idea on how to compile libpcap using ndk-build
and the Android.mk
and all that infrastructure.
我已经在Android NDK目录中。这NDK已建成的工具链(我有很多目录下的〜/文档/项目/ Android_NDK /工具链/
),但没有工具链有 libpcap的
可用。
I have the Android NDK in a directory. That NDK has the toolchains built (I have a lot of directories under ~/Documents/Projects/Android_NDK/toolchains/
) but none of the toolchains has libpcap
available.
我试过用两种不同版本的libpcap或者......分支:
I've tried with two different libpcap version or... branches:
Android的一个,这是一个我想使用,
https://android.googlesource.com/platform/external/libpcap/
The Android one, which is the one I'd like to use, https://android.googlesource.com/platform/external/libpcap/
和定期之一:
http://www.tcpdump.org/release/libpcap-1.5.3 .tar.gz格式
所有的尝试我做已经非常成功。我已经看到了问题的Android NDK:使用一个链接pre-编译静态库这是类似的,但我仍然得到各种误差
All tries I've done have been very unsuccessful. I've seen the question Android NDK: Link using a pre-compiled static library which is similar, but I'm still getting various errors.
我已经下载了这些PCAP库自己的目录。也许是这个问题?我需要把Android的libpcap的一些目录中NDK根目录下,并重新创建工具链?
I have downloaded those pcap libraries to their own directories. Maybe is that the problem? Do I need to put the Android libpcap in some directory within the NDK root directory and re-create the toolchains?
我使用NDK-R9上的MacOSX 10.9.2 64位。
I'm using NDK-r9 on a MacOSX 10.9.2 64bit.
感谢您提前。
推荐答案
最后!!
在非现有的头之类的东西惹恼之后,我发现这问题,这指出了一个SVN回购(的 http://sourceforge.net/p/prueba-android/$c$c/HEAD/tree/trunk/jni/ )与libpcap的已编译!
After getting annoyed by the non existing headers in and stuff like that, I found this question, that pointed to a SVN repo (http://sourceforge.net/p/prueba-android/code/HEAD/tree/trunk/jni/) with a libpcap that compiled!
如果有人想在我的Android.mk和目录结构的样子更多详情,请添加评论,我会延长这个答案。
If someone else wants additional details on how my Android.mk and directory structure looks like, please add a comment and I'll extend this answer.
这篇关于采用Android NDK编译libpcap的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!