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

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!

 

posted @ 2014-01-09 01:04  Proteas  阅读(2804)  评论(0编辑  收藏  举报