脳汁でコードを書く

Archive for the ‘os x’ Category

iPhone OS 3.1.2(JB) + XCode 3.2.1でアプリケーション開発

木曜日, 11 月 5th, 2009

これは夢のはなしです.

以下のようにすると, jailbreak済のiPhone OS 3.1.2とXCode 3.2.1でアプリのがやりとりできる, という夢をみました.

検証環境
OS: Snow Leopard
XCode: 3.2.1
iPhone: 3.1.2

まず, キーチェーンアクセスで証明書を作成

証明書アシスタンス > 証明書を作成.
名前はiPhone Developer
コード署名で作成する
デフォルトを無効化するのを忘れずに.
iPhone Developerの証明書をダブルクリックして,
信頼 > この証明書を使用するとき
で常に信頼する

Info.plistの編集

次に
/Developer/Platforms/iPhoneOS.platform/Info.plist.を編集
46, 79行目のXCiPhoneOSCodeSignContextをXCCodeSignContextに置換.

サンプルコードの確保

<http://developer.apple.com/iphone/library/samplecode/HelloWorld_iPhone/index.html

ここからHelloWorldをDL
適当に展開して, .xcodeprojをダブルクリック.
プロジェクトを設定する.
左上のHelloWorldを選択してCommand-i, ビルドタブを選択.
アーキテクチャ > ベースSDKをiPhoneデバイス3.1.2にする.
そうすると勝手にarmが選択される
とりあえずreleaseもdebugもそのようにする.
これでビルドすると, キーチェーンのnotificationがでるので常に許可を選択.
ビルドできた!

iPhone側の設定

CydiaのManage > Sources > Edit > Addから
iPhone OS 2.x系列なら
Cydiaのレポジトリに以下のURLを追加
http://www.iphone.org.hk/apt/
CydiaからMobileInstalttion Patchをインストール
iPhone OS 3.x系列なら
以下を追加
http://cydia.hackulo.us/
AppSync for OS 3.1をイストール
参考: http://www.iphonedownloadblog.com/2009/09/17/mobileinstallation-iphone-3-1/

macにiPhoneを接続して転送

macにiPhoneを接続

XCodeのウィンドウ > オーガナイザ

DevicesからiPhone選んで, Use for Developmentをクリック

XCodeでビルドして実行を行うと, GDB上での起動は失敗するけど, 転送できる.

snow leopardでsbclをbuildしてみる

日曜日, 10 月 4th, 2009

snow leopardでsbclのbuildにてこずったのでメモ

まずいまのstable版ではmakeが通らない.
以下のようなエラーが出る.

//entering make-target-1.sh
//building runtime system and symbol table file
rm -f *.[do] sbcl sbcl.nm sbcl.h core *.tmp
echo '#include "genesis/config.h"' >sbcl.h
echo '#include "genesis/constants.h"' >>sbcl.h
gcc -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.4 -I. -no-cpp-precomp  -c -o alloc.o alloc.c
In file included from alloc.c:21:
runtime.h: In function 'CONS':
runtime.h:151: warning: cast to pointer from integer of different size
runtime.h: In function 'SYMBOL':
runtime.h:157: warning: cast to pointer from integer of different size
runtime.h: In function 'FDEFN':
runtime.h:163: warning: cast to pointer from integer of different size
/var/folders/3K/3K4LXRIJHoq8UNahYP7P4U+++TI/-Tmp-//cck88adh.s:81:Incorrect register `%rbx' used with `l' suffix
/var/folders/3K/3K4LXRIJHoq8UNahYP7P4U+++TI/-Tmp-//cck88adh.s:578:Incorrect register `%rdx' used with `l' suffix
make: *** [alloc.o] Error 1

x86, x86_64にするとか1.0.30のバイナリをつかうとかいろいろ試してみたけど, 最終的にcvsの先端だとバグがfixされている模様

$ cvs -d :pserver:anonymous@sbcl.cvs.sourceforge.net:/cvsroot/sbcl co sbcl

そしたら, multi threadつかいたいのでsbcl/customize-target-features.lispというファイルを作る

(lambda (features)
      (flet ((enable (x)
               (pushnew x features))
             (disable (x)
               (setf features (remove x features))))
        ;; Threading support, available only on x86/x86-64 Linux, x86 Solaris
        ;; and x86 Mac OS X (experimental).
        (enable :sb-thread)))

次にsbcl/sbclcomprというのを作る

SBCL_HOME=/usr/local/lib/sbcl /usr/local/bin/sbcl $*

そんでもって

$ sh make.sh "sbclcompr"
$ sudo sh install.sh

なんかrun-tests.shが大量のエラーをはいてるけど, みなかったことにしよう…

追記:

sh run-tests.shの結果

Finished running tests.
Status:
 Expected failure:    float.pure.lisp / (SCALE-FLOAT-OVERFLOW BUG-372)
 Expected failure:    float.pure.lisp / (ADDITION-OVERFLOW BUG-372)
 Expected failure:    threads.pure.lisp / WITHOUT-INTERRUPTS+CONDITION-WAIT
 Expected failure:    callback.impure.lisp / UNDERFLOW-DETECTION
 Invalid exit status: clos-add-remove-method.impure.lisp
 Invalid exit status: clos-cache.impure.lisp
 Invalid exit status: clos-interrupts.impure.lisp
 Invalid exit status: compare-and-swap.impure.lisp
 Invalid exit status: debug.impure.lisp
 Expected failure:    external-format.impure.lisp / (CHARACTER-DECODE-LARGE
                                                     FORCE-END-OF-FILE)
 Invalid exit status: gc.impure.lisp
 Invalid exit status: hash.impure.lisp
 Expected failure:    packages.impure.lisp / USE-PACKAGE-CONFLICT-SET
 Expected failure:    packages.impure.lisp / IMPORT-SINGLE-CONFLICT
 Invalid exit status: profile.impure.lisp
 Invalid exit status: threads.impure.lisp
 Invalid exit status: timer.impure.lisp
 Invalid exit status: core.test.sh
test failed, expected 104 return code, got 1

Ogre on mac OS X

土曜日, 6 月 20th, 2009

日本ではあんまり知られていない気がするけど, Ogreという海外ではそれなりに有名なソフトウェアがある.

実はOkraというCLのバインディングがあって, それをつかってみたいのでまずはOgreをインストールしてみた.

mac上で動かしてみたのでそのメモ.

ubuntuとかはaptで入るっぽいよ

  1. Ogreの公式からDownload->SDK->OGRE 1.6.2 SDK for Mac OS XをDL
  2. いろいろ入っているので, 適当にOgreSDKディレクトリをコピー
  3. Samples/Samples.xcodeprojを開いてbuild
  4. いくつかのサンプルはシンボリックリンクを張り替える必要がある.

ln -s -f ../OgreCEGUIRenderer.framework ./

ln -s -f ../../OgreCEGUIRenderer.framework ./

にする