Mac上编译libimobiledevice库
0、准备工作:
使用brew或Mac Ports安装:libgnutls or openssl、 libplist 、libusb、libusbmuxd
1、下载代码:
下载地址:https://github.com/libimobiledevice/libimobiledevice
2、编译、安装
打开Mac终端,cd到代码保存目录,输入命令
./configure
make
sudo make install
3、使用
第二步编译成功后,打开终端,输入:
idevice_id -l
如果返回设备UDID,说明安装成功!
问题解决:
1、报错:
“./configure: line 15055: syntax error near unexpected token `libusbmuxd,'
./configure: line 15055: `PKG_CHECK_MODULES(libusbmuxd, libusbmuxd >= 0.1.4)'”
解决方案:参考(http://libiphone.lighthouseapp.com/projects/27916/tickets/233-add-required-pkgm4)拷贝pkg.m4到m4目录下。
2、报错:
Requested 'libusbmuxd >= 1.0.8' but version of libusbmuxd is UNKNOWN
解决方案:http://www.libimobiledevice.org/downloads/usbmuxd-1.0.8.tar.bz2 (install first)
3、报错:
Undefined symbols for architecture x86_64:
"debugbuffer", referenced from:
afcdispatch_packet in afc.o
afcreceive_data in afc.o
afcfile_lock in afc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libimobiledevice.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
解决方案:参考(https://github.com/libimobiledevice/libimobiledevice/issues/10),在https://github.com/libimobiledevice/libimobiledevice链接中,下载trustdialog branch代码。
4、Installing libxml2
下载libxml,地址:ftp://xmlsoft.org/libxml2/
解压,然后
./configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.3
/
make
sudo make install