macportsのdb46でshell command failed

MacBookAirをクリーンインストールしたあと、
macportsでgit-coreとかpython27とかインストールしようと思ったら
db46がインストールできなくて色々困った

パッと見のログではshell command failedとか言われてなんのことだかサッパリ。
内部を見てくとjni.hがないといわれていた。

$ cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_db46/build_unix
$ sudo /usr/bin/make -j2 all
<省略>
../dist/../libdb_java/db_java_wrap.c:123:17: error: jni.h: No such file or directory

どうやら10.6 update3でAppleJDKヘッダが/System以下のJDKから消えた模様。
Java for Mac OS X 10.6 Update 3 and 10.5 Update 8 Release Notes
L'eclat des jours(2010-10-24)

http://connect.apple.comから「Java for Mac OS X 10.6 Update 3 Developer Package」をいれたらOK。
詳しくは、artonさんの記事へ。

以下はスマートじゃない解決方法。

    • -

/Developer以下にはJDKのヘッダがあるので、/System以下のJDKにリンクを張ったらうまくいった。

$ sudo ln -s /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/.
$ sudo port clean --all db46
--->  Cleaning db46
Warning: Distfiles directory '/opt/local/var/macports/distfiles/db4/4.6.21_6' may contain distfiles needed for other ports, use the -f flag to force removal
$ sudo port install db46
--->  Computing dependencies for db46
--->  Fetching db46
--->  Attempting to fetch db-4.6.21.tar.gz from http://download-uk.oracle.com/berkeley-db/
--->  Verifying checksum(s) for db46
--->  Extracting db46
--->  Applying patches to db46
--->  Configuring db46
--->  Building db46
--->  Staging db46 into destroot
--->  Installing db46 @4.6.21_6
--->  Activating db46 @4.6.21_6
--->  Cleaning db46

もっとスマートなやり方はあるかもしれない。

ちょっとAppleが嫌いになった。