libimobiledevice 安装试用

mac 系统实在是有点贵,网上找了找看能不能通过添加系统库来实现在 windows/ubuntu 上实现来获取 iphone 等 ios 系统相关的信息,从而发现了 libimobiledevice 库, 可以通过使用其中的协议接口来对设备进行数据读写操作。具体安装方式如下:
<b> 注意: 如下操作都在 cygwin 中进行的</b>

  1. plist 库安装
sudo apt-get install libxml2-dev python-dev python-pip
sudo pip install cython
git clone https://github.com/libimobiledevice/libplist.git
cd libplist
./autogen.sh
make
sudo make install
  1. libusbmuxd 库安装
git clone https://github.com/libimobiledevice/libusbmuxd.git
cd libusbmuxd
./autogen.sh
make
sudo make install

<b>[问题]</b> 可能会出现如下错误之后:

checking for libplist... no
configure: error: Package requirements (libplist >= 1.11) were not met:
No package 'libplist' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables libplist_CFLAGS
and libplist_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

可以通过如下方式解决

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

注意上述路径是指在 libplist 库中 src/*.pc 文件安装的目录

  1. libimobiledevice 库安装
git clone https://github.com/libimobiledevice/libimobiledevice.git
cd libimobiledevice
./autogen.sh
make
sudo make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

这时候我们能执行 idevice_id,ideviceinfo,idevicename 等命令。

  1. usbmuxd 库安装
git clone https://github.com/libimobiledevice/usbmuxd.git
cd usbmuxd
./autogen.sh
make
sudo make install

该库必须安装,否则没法使用上述命令,该库的作用就是提供 usb 通讯通道, 该部分依赖 usb 开发包 libusb-dev 因此,需要用 cygwin 安装包进行安装

  1. ideviceinstaller 安装
git clone https://github.com/libimobiledevice/ideviceinstaller.git
cd ideviceinstaller
./autogen.sh
make
sudo make install

主要用来 ipa 包安裝等相關工具。
<b>[问题]</b> 出现如下错误:

$ make
make  all-recursive
make[1]: Entering directory '/cygdrive/d/workspace/libimobiledevice/ideviceinstaller'
Making all in src
make[2]: Entering directory '/cygdrive/d/workspace/libimobiledevice/ideviceinstaller/src'
  CC       ideviceinstaller-ideviceinstaller.o
ideviceinstaller.c: In function ‘main’:
ideviceinstaller.c:864:9: error: implicit declaration of function ‘asprintf’ [-Werror=implicit-function-declaration]
    if ((asprintf(&pkgname, "%s/%s", PKG_PATH, basename(ipcc)) > 0) && pkgname) {
         ^
cc1: all warnings being treated as errors
make[2]: *** [Makefile:430: ideviceinstaller-ideviceinstaller.o] Error 1
make[2]: Leaving directory '/cygdrive/d/workspace/libimobiledevice/ideviceinstaller/src'
make[1]: *** [Makefile:395: all-recursive] Error 1
make[1]: Leaving directory '/cygdrive/d/workspace/libimobiledevice/ideviceinstaller'
make: *** [Makefile:326: all] Error 2

解决办法如下:

刪除 src/Makefile 文件内的 GLOBAL_CFLAGS 中的 -Werror
上一篇:[阅读笔记]fsnotify源码阅读


下一篇:前端三要素-CSS