源码下载地址:https://github.com/libimobiledevice/libimobiledevice


闲来无事,更新了一下libimobiledevice源代码,重新编译~


// 初次尝试

➜  libimobiledevice git:(master) ./autogen.sh [--enable-static 静态编译]
.
.
.
.
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libusbmuxd... no
configure: error: Package requirements (libusbmuxd >= 1.0.9) were not met:

Package 'libxml-2.0', required by 'libplist', not 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 libusbmuxd_CFLAGS
and libusbmuxd_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

// 非常遗憾,报错了~~

// 首先我确定本机是安装了最新版的libxml2,brew查看一下

➜  ~ brew list libxml2
/usr/local/Cellar/libxml2/2.9.4/bin/xml2-config
/usr/local/Cellar/libxml2/2.9.4/bin/xmlcatalog
/usr/local/Cellar/libxml2/2.9.4/bin/xmllint
/usr/local/Cellar/libxml2/2.9.4/include/libxml2/ (47 files)
/usr/local/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib
/usr/local/Cellar/libxml2/2.9.4/lib/cmake/libxml2/libxml2-config.cmake
/usr/local/Cellar/libxml2/2.9.4/lib/pkgconfig/libxml-2.0.pc
/usr/local/Cellar/libxml2/2.9.4/lib/ (3 other files)
/usr/local/Cellar/libxml2/2.9.4/share/aclocal/libxml.m4
/usr/local/Cellar/libxml2/2.9.4/share/doc/ (153 files)
/usr/local/Cellar/libxml2/2.9.4/share/gtk-doc/ (55 files)
/usr/local/Cellar/libxml2/2.9.4/share/man/ (4 files)

// 按照提示设置一下环境变量

➜  libimobiledevice git:(master) export PKG_CONFIG_PATH=/usr/local/Cellar/libxml2/2.9.4/lib/pkgconfig/:$PKG_CONFIG_PATH

// 再次执行命令

➜  libimobiledevice git:(master) ./autogen.sh
Configuration for libimobiledevice 1.2.1:
-------------------------------------------

  Install prefix: .........: /usr/local
  Debug code ..............: no
  Python bindings .........: no
  SSL support backend .....: OpenSSL

  Now type 'make' to build libimobiledevice 1.2.1,
  and then 'make install' for installation.

// 再次报错

➜  libimobiledevice git:(master) make
../src/idevice.h:30:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.
make[2]: *** [debug.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

// 在~.bash_profile 加入以下环境变量

export PATH=/usr/local/opt/openssl/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:$LD_LIBRARY_PATH
export CPATH=/usr/local/opt/openssl/include:$LD_LIBRARY_PATH

// 再次执行

➜  libimobiledevice git:(master) make
  CCLD     idevicenotificationproxy
  CC       idevicecrashreport-idevicecrashreport.o
  CCLD     idevicecrashreport
Making all in docs
make[2]: Nothing to be done for `all'.

// 顺利编译


// 安装

➜  libimobiledevice git:(master) ✗ make install
Making install in common


// 测试一下:

➜  ~ ideviceinfo -k DeviceName
PiaoPiao iPhone6


搞定收工!!


若在make这一步出现如下错误:

Undefined symbols for architecture x86_64:
  "_ERR_remove_thread_state", referenced from:
      _internal_idevice_deinit in idevice.o
      _idevice_connection_enable_ssl in idevice.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

可尝试下面方法:

CFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib ./autogen.sh [--enable-static 静态编译]


你可能感兴趣的文章

评论区

已有3位网友发表了看法:

1L theodore  2016-11-07 14:34:54 回复
请问,可以详细说下
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
_internal_idevice_deinit in idevice.o
_idevice_connection_enable_ssl in idevice.o
ld: symbol(s) not found for architecture x86_64
这个报错的解决方案嘛?谢谢。
2L 非虫  2016-11-18 14:24:28 回复
我发现“brew install libimobiledevice”可以直接安装。
2L piaoyun  2016-11-22 10:35:16 回复
@非虫 是的 brew 可以直接安装~ 不过可能版本不是最新的~
我主要是为了修改源码后自己编译~

发表评论

必填

选填

选填

必填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。