LoginSignup
29
22

More than 5 years have passed since last update.

.aファイルなどのライブラリの中身を確認する

Last updated at Posted at 2016-03-24

iOSアプリを開発していて、duplicate symbolが発生してどこがduplicateしているか確認したかったので。

まずバイナリファイルのアーキテクチャを確認

$ lipo -info hoge.a
Architectures in the fat file: hoge.a are: armv7 armv7s i386 x86_64 arm64

armv7、armv7s、i386、x86_64、arm64でビルドされていることがわかったので、このアーキテクチャを元に分解する。

$ lipo -thin x86_64 hoge.a -output hoge_x86_64

.oファイルを検索

$ ar -t hoge_x86_64 | grep Huga.o
Huga.o

.oファイルを取り出す

$ ar -x hoge_x86_64 Huga.o

.oファイルの中身を確認(ディスアセンブル)

$ gobjdump -d Huga.o

gobjdumpが入ってない場合はインストールしてください。
macの場合はbrewでいけます。

$ brew install gobjdump

参考ページ
arコマンド:http://kazmax.zpp.jp/cmd/a/ar.1.html

確認すると言っても結局バイナリファイルなのでメソッド名程度しか確認できませんが( ´ー`)

29
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
22