IOS Cross-compiling
1.android version Vqmon is already running, and it is now necessary to open the iOS version for porting work.
2. Note: 1) root privileges, iOS must jailbreak.
2) Dependent library: Pcap, Ffmpeg,libes, LIBXML2, Libz,
3) iphone jailbreak, remote SSH login
3. Open Environment:
xcode:6.1.1 mac-mini:10.1.9
clang: Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3SVN)
target:x86_64-apple-darwin13.3.0
Thread Model:posix
Sdk:
/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks
Iphoneos6.1.sdk
Iphoneos7.0.sdk
Iphoneos8.1.sdk
Choose 8.1
4. Written by makefile
ios_base_sdk=8.1ios_deploy_tgt=7.1devroot = $ (Shell xcode-select-p)/platforms/iphoneos.platform/ Developersdkroot = $ (devroot)/sdks/ iphoneos$ (IOS_BASE_SDK). SDKCC = clang- isysroot ${sdkroot} AR= $ (devroot)/usr/bin/arARCH=-arch Armv7-arch Armv7s-arch arm64-mios-version-min=7.0CFLAGS:=-g-o0-i. /Includexml_include=-i/usr/include/Libxml2xml_lib=-l/usr/lib-Lxml2cflags+ =-wall-g-o2-i. /include-i. /src-i"."-I."/users/chulk/iosvqmon/data/dependencies/include"-D_gnu_sourcecflags+=$ (xml_include) Ldflags=-LM-Lzldflags+=-l/usr/lib/Ldflags+=$ (xml_lib) Ldflags+= .. /bin/Libmt.aldflags+= .. /bin/Libes.aldflags+= .. /bin/Libpcap.aldflags+= .. /bin/Libffmpeg.astrip=STRIPRM=/bin/RM-Ftarget=Qosall: $ (TARGET) SOURCE=tcp.c dissector.c hash.c user_pcap.c util.c interface.c MAIN.C Objs= $ (source:%.c=obj/%. O) $ (TARGET): $ (OBJS) $ (CC) $ (ARCH)-G $ (OBJS) $ (ldflags)-o [email protected]CP-F $ (TARGET): /Binobj/%.o:%. C @mkdir-p obj $ (CC) $ (ARCH) $ (CFLAGS)-C $<-o [email protected]clean:RM-RF obj $ (OBJS) $ (TARGET)
The $ (Shell xcode-select-p) directory is:/applications/xcode.app/contents/developer
-isysroot ${sdkroot} switches the root directory to ${sdkroot} , which is / Applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos8.1.sdk. Subsequent operations/usr/lib,/usr/include are relative to this directory.
in/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/ There are different versions of the SDK, such as multiple version iphoneos6.1.sdk,iphoneos7.0.sdk,iphoneos8.1.sdk for multiple iphoneos in the directory.
/applications/xcode.app/contents/developer/platforms distinguish between different platforms, Macosx.platform, iphoneos.platform , Iphonesimulator.platform. Select Iphoneos.platform open platform here. Libz.dylib, libxml2.dylib ,libm.dylib Dynamic Library exists under
/usr/lib, so it can be called directly. Pcap, Ffmpeg,libes have to recompile!
ARCH =-arch Armv7-arch armv7s-arch arm64-mios-version-min=7.0-arch Specifies the supported CPU architectures. The -mios-version-min=7.0 indicates that only 7.0 (inclusive) version systems (IPHONEOS) are supported.
5. Compiling pcap
Run build-libpcap.sh directly to generate the Iphoneos version. The script needs to modify the version.
https://github.com/chrisballinger/openvpn-server-ios/blob/master/build-libpcap.sh
6. Compiling ffmpeg, ES
7 Note:
"Unsupported architecture" error occurred during make because the Pcap header file path is incorrect, referring to other directories in the system, which do not match, should refer to the generated cross-compiled version.
Android version Vqmon porting iOS edition