Mountain Lion(Mac OS X 10.8)だと(mod|ngx)_small_lightでImlib2を有効にした状態でビルドしようとしたらこけたのでその対処メモ。
依存ライブラリのインストール
mod_small_lightはImageMagickとImlib2に、ngx_small_lightはその二つに加えてGDにも依存しているが、ビルドオプション次第で一部取り外し可能。
$ brew install imagemagick imlib2 gd
mod_small_lightのビルド
$ cd smalllight
$ ./configure --with-imlib2 --with-Wand --with-apxs=/usr/sbin/apxs
$ make
・
・
・
ld: library not found for -lX11
clang: error: linker command failed with exit code 1 (use -v to see invocation)
apxs:Error: Command failed with rc=65536
$
ngx_small_lightのビルド
$ cd ${ngx_small_light_src_dir}
$ ./setup --with-imlib2
$ cd {$nginx_src_dir}
$ ./configure --with-pcre --add-module=${ngx_small_light_src_dir}
・
・
・
checking for ngx_small_light dependencies ... not found
$
ngx_small_lightはこの出力だと何でこけたのかわからないな。まぁ、それは追々直すとして原因はmod_small_lightと同じでMountain LionにX11が含まれていないせい。
そもそもsmall_light的にはX11にリンクする必要などないのだがImlib2がX11に依存している関係でどうしてもこのエラーが出てしまう。なので以下のようにImlib2をX11から切り離してビルドする。
$ brew install imlib2 --without-x
これで上記のエラーは出なくなる。
ところでXQuartzをインストールすることでMountain LionでX11にリンクすることも可能だが、small_lightの場合、homebrewでインストールしたImageMagickを有効にしているとWand-configがエラーを吐く。
$ export DYLD_LIBRARY_PATH=/opt/X11/lib:$LD_LIBRARY_PATH
$ Wand-config --libs
dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /opt/X11/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
$
多分XQuartzに含まれているlibpngとImageMagickが使用しているlibpngにABI互換性がないのが原因。