[转]在 Mac OS X上编译 libimobiledevice 的方法

本文介绍如何为macOS编译libimobiledevice库,并直接将应用部署到iOS设备上,绕过iTunes。文章详细记录了整个编译过程及解决遇到的问题。

link: http://blog.boceto.fr/2012/05/05/libimobiledevice-for-macosx/

The objective of the day: Compiler libimobiledevice for macosx.

The objective is to be able to deploy the apps generated with jembe directly to your iphone or ipad without using itunes.

I will describe the whole compilation process. If you are only interested on the binary, go directly to the download section

I already write some post here to explain how to create the cross compiler and use it. I also write about the issues on compiling the dependencies. If you need to redo all the work, you can read these posts:

Start downloading the sources here.

Then, while trying to compile libimobiledevice, there are some more issues. So I go for the simplest solution:

  • Do not compile python binding (–without-cython)
  • configure complains on largefile ?! (–disable-largfile)
  • An issue with malloc and realloc! (ac_cv_func_realloc_0_nonnull and ac_cv_func_malloc_0_null)
  • A linker issue with inline function debug_buffer (You will have to remove the inline directive)
Then, everything should work ;)
1
2
3
export ac_cv_func_realloc_0_nonnull=yes
export ac_cv_func_malloc_0_nonnull=yes
PKG_CONFIG_PATH=/home/benoit/workspace/imobiledevice/binary/mac/lib/pkgconfig/ ../configure --host=i386-apple-darwin --target=i386-apple-darwin --prefix=/home/benoit/workspace/imobiledevice/binary/mac/ --without-cython --disable-largefile

Great… We already have some very interesting tools like idevicesyslog. But we also need the installer.
So download the ideviceinstaller sources and just compile. I don’t had any issue here.

You can test the binary here. It works fine, but you have to define the DYLD_LIBRARY_PATH to use it, because all links are absolute by default. You can view the problem using otool utility:

1
2
3
4
5
6
7
8
9
10
11
$ /opt/compiler/mac/bin/i386-apple-darwin-otool -L bin/ideviceinstaller
bin/ideviceinstaller:
  /home/benoit/workspace/imobiledevice/binary/mac/lib/libimobiledevice.3.dylib (compatibility version 4.0.0, current version 4.1.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11)
  /home/benoit/workspace/imobiledevice/usbmuxd/build/libusbmuxd/libusbmuxd.2.dylib (compatibility version 2.0.0, current version 1.0.8)
  /usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
  /usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
  /home/benoit/workspace/imobiledevice/libplist/build/src/libplist.1.dylib (compatibility version 1.0.0, current version 1.1.8)
  /home/benoit/workspace/imobiledevice/binary/mac/lib/libzip.2.dylib (compatibility version 4.0.0, current version 4.0.0)
  /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
  /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

So you will have to use install_name_tool to update the links. For exemple:

1
$ /opt/compiler/mac/bin/i386-apple-darwin-install_name_tool -change /home/benoit/workspace/imobiledevice/binary/mac/lib/libimobiledevice.3.dylib @executable_path/../lib/libimobiledevice.3.dylib bin/ideviceinstaller

At the end, you should have:

1
2
3
4
5
6
7
8
9
10
$ /opt/compiler/mac/bin/i386-apple-darwin-otool -L bin/ideviceinstaller bin/ideviceinstaller:
  @executable_path/../lib/libimobiledevice.3.dylib (compatibility version 4.0.0, current version 4.1.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11)
  @executable_path/../lib/libusbmuxd.2.dylib (compatibility version 2.0.0, current version 1.0.8)
  /usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
  /usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
  /home/benoit/workspace/imobiledevice/libplist/build/src/libplist.1.dylib (compatibility version 1.0.0, current version 1.1.8)
  @executable_path/../lib/libzip.2.dylib (compatibility version 4.0.0, current version 4.0.0)
  /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
  /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

That all. Download the imobiledevice binary!

 

转载于:https://www.cnblogs.com/Proteas/p/3511574.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值