FrontPage

boost 1.49.0 をiOS用にビルドする

Matt.Galloway さんのブログより拝借 http://iphone.galloway.me.uk/2010/09/compiling-boost-1-44-for-iphone/

# <grab source from boost.org>
# download boost_1_49_0.tar.gz and extract any directory
cd boost_1_49_0
./bootstrap.sh
 
# Set this to whatever you want to build against
SDK_VERSION="4.2"
 
# Install for device:
./bjam --prefix=${HOME}/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk/usr toolset=darwin architecture=arm target-os=iphone macosx-version=iphone-${SDK_VERSION} define=_LITTLE_ENDIAN link=static install
 
# Install for simulator
./bjam --prefix=${HOME}/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk/usr toolset=darwin architecture=x86 target-os=iphone macosx-version=iphonesim-${SDK_VERSION} link=static install

1.49.0では、SDK4.2までのサポートのようで、5.1にしたらエラーになった。

cmakeのインストール (1.41.0限定)

http://www.cmake.org/cmake/resources/software.html

  1. boost.orgよりCMake対応のソースをSVNのリポジトリから/usr/local/srcにチェックアウトする
    $ cd /usr/local/src
    $ mkdir boost
    $ svn co http://svn.boost.org/svn/boost/branches/CMake/release
    $ mv release boost-1.41.0-cmake
  2. Xcode 用のプロジェクトファイルを生成するために、以下のコマンドを順番に実行する。
    $ cd boost-1.41.0-cmake
    $ cmake -GXcode .
    $ cmake -DCMAKE_IS_EXPERIMENTAL=YES_I_KNOW .
  3. Xcodeから Boost.xcodeprojを開く
    $ open Boost.xcodeproj
  4. ビルド設定をする
    「プロジェクト」→「プロジェクト設定を編集」でウインドウが開く
    「一般」タグ内の「すべての構成のベースSDK」を「iOS x.x」に設定する
  5. 使用したいスタティックライブラリをビルドする
    メインウインドウの左上のボタンで「アクティブSDK」「アクティブな構成」を適当に設定
    メインウインドウの左のペインの「ターゲット」リストから、ビルドしたいライブラリを見つけてビルドする。
    sharedライブラリはビルドエラーになる。"*.static"のプロジェクトのみビルド可能~ Debugビルドの場合、lib/Debug/libboost_XXXX-mt.aが生成される。

boostのスタティックライブラリのリンク時の問題

xxx has different visiblity (default) in ... という warning が大量に出る

  1. boostのプロジェクトをXcodeで開く
  2. ターゲットにある各モジュールのスタティックライブラリをダブルクリックしてプロジェクトの設定画面を出す
  3. 下の方にある"OTHER_CPLUSPLUSFLAGS"に"-fvisibility=hidden"を追加する。

Deviceでビルドしたときにスタティックライブラリがリンクエラーになる場合

http://blog.slidetorock.com/linking-a-static-library-with-xcode-322-and-s

デバイスに転送したPNGファイルが読めない

http://akisute.com/2009/10/iphonepnglibpng.html


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS