libpcap的可以被编译为iPhone / ARMv6的? [英] Can libpcap be compiled for iPhone/armv6?
问题描述
试图编译它使用pcap.h.基本程序我已经成立了,它使用iPhone SDK 3.1.3为iPhone 3GS在我的Mac OSX框中环境。我还安装了libpcap的到〜/ libpcap的,所以我可以告诉GCC到哪里寻找使用-I标志的标头。然而,它不能用LD警告说,该文件是所需的架构没有。
Trying to compile a basic program which uses pcap.h. I've set up the environment on my Mac OSX box which uses the iPhone 3.1.3 SDK for an iPhone 3GS. I've also installed libpcap to ~/libpcap so I can tell gcc where to look for the headers using the -I flag. However, it fails with an ld warning saying the file is not of the required architecture.
我用下面的行编译:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -I /Users/abnev/libpcap/include -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk -o pcap pcap.c -lpcap
错误的产生幸福是:
Error's being generated are:
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libpcap.dylib, file is not of required architecture
Undefined symbols:
"_pcap_geterr", referenced from:
_main in ccOL3e0B.o
_main in ccOL3e0B.o
"_pcap_open_live", referenced from:
_main in ccOL3e0B.o
"_pcap_next", referenced from:
_main in ccOL3e0B.o
"_pcap_lookupdev", referenced from:
_main in ccOL3e0B.o
"_pcap_setfilter", referenced from:
_main in ccOL3e0B.o
"_pcap_lookupnet", referenced from:
_main in ccOL3e0B.o
"_pcap_close", referenced from:
_main in ccOL3e0B.o
"_pcap_compile", referenced from:
_main in ccOL3e0B.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
我现在认为我需要重新编译libpcap的为ARMv6体系结构(iPhone),但检查的./configure选项于事无补。我试图谷歌对围绕这一点,但很少有在那里。
I assume now that I need to recompile libpcap for the armv6 architecture (iPhone) but checking the ./configure options doesn't help. I've attempted to Google around for this but there is very little out there.
推荐答案
pcap.c
未在源libpcap的,它的有一个的源文件到libpcap的。你必须编译所有的源文件并将其建设成一个库。
pcap.c
isn't the source to libpcap, it's one of the source files to libpcap. You'd have to compile all the source files and build them into a library.
做
CFLAGS="-I /Users/abnev/libpcap/include -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk" ./configure
的可能的生成Makefile,将交叉编译libpcap的适用于iOS。
might produce a Makefile that would cross-compile libpcap for iOS.
我presume要安装libpcap的,或者使用内置的应用吧,在越狱的iPhone,至少如果你要来捕获数据包,因为你需要以root访问权限的libpcap的是能够为了打开一个BPF设备,以便能够捕获
I presume you will be installing libpcap, or the application built using it, on a jailbroken iPhone, at least if you're going to be capturing packets, because you would need root access in order for libpcap to be able to open a BPF device in order to be able to capture.
这篇关于libpcap的可以被编译为iPhone / ARMv6的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!