
photo credit: sporras
※ 2010.6.3 追記
現在は問題なくインストールできるようです。
MacPorts (Snow Leopard)を使ってPHP5.2.13をインストールしようとしたら次のようなエラーが発生してしまいました。
$ sudo port -d install php52 +apache2 +mysql5 +pear
(中略)
Undefined Undefinedsymbols:
"_zif_setlocale", symbolsreferenced:
from :
" _zif_setlocale " , _basic_functionsreferenced infrom :basic_functions.o
ld:
symbol ( s) not found
_basic_functions in basic_functions.o
ld: symbol(s) not found
collect2: collect2: ld returned 1 exit status
ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [libs/libphp5.bundle] Error 1
色々調べてみたところ、gettextというパッケージが悪さをしていることが判明しました。
どうやら、gettextのバージョンを0.18から0.17に下げる必要があるみたい。
以下のコマンドを実行し、gettextをダウングレードします。
(参考:【port / MacPorts】古いバージョンのパッケージをインストールする方法 sakatam blog)
$ sudo port deactivate gettext
$ cd ~/Downloads
$ svn co -r 30842 http://svn.macports.org/repository/macports/trunk/dports/devel/gettext
$ cd gettext
$ sudo port install
gettextをダウングレードしたので、gettextパッケージに依存しているすべてのパッケージをリビルドする必要があります。
autoconfが依存するgawkというパッケージに関しては、MacPortsでインストールされるのが少し古いバージョンなので、アンインストールしてシステムにデフォルトでインストールされているものが使われるようにします。
$ sudo port deactivate gawk
$ sudo port clean gawk
$ sudo port -n upgrade --force autoconf
他のパッケージもリビルドしていきます。
$ sudo port -n upgrade --force libidn
$ sudo port -n upgrade --force curl
これでインストールの準備は完了、と言いたいところですが、まだしなければいけないことがあります。
このままMacPortsでインストールを実行するとautoconfの部分でエラーが発生してしまうので、手動でautoconfを実行しなければなりません。
MacPortsでインストールしたautoconfを使っていることがエラーの原因なので、システムにデフォルトでインストールされているautoconfを使ってコンフィグレーションファイルを作成します。
$ sudo port clean php52
$ sudo port -d configure php52 +apache2 +mysql5 +pear
$ cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_php52/work/php-5.2.13/
$ sudo autoconf
さらに、手動で./configureも実行してしまいます。
# めちゃくちゃ長いコマンドです。MacPortsによる自動インストールの時に実行されるコマンドと全く同じものです。
# このコマンドはphp52パッケージインストール時に指定するvariantsによって変わってきます。(下の例は僕の場合)
# 実際のコマンドは「port -d configure php52 <variants> 」を実行した時の出力で確認することができます。
$ sudo ./configure --prefix=/opt/local --mandir=/opt/local/share/man --infodir=/opt/local/share/info --with-config-file-path=/opt/local/etc/php5 --with-config-file-scan-dir=/opt/local/var/db/php5 --enable-calendar --with-iconv=/opt/local --enable-exif --enable-ftp --enable-wddx --with-zlib=/opt/local --with-bz2=/opt/local --without-sqlite --without-pdo-sqlite --with-libxml-dir=/opt/local --with-gettext=/opt/local --with-libexpat-dir=/opt/local --with-xmlrpc --enable-soap --enable-bcmath --enable-mbstring --enable-dba --enable-zip --with-openssl=/opt/local --with-mhash=/opt/local --with-mcrypt=/opt/local --with-mime-magic --with-xsl=/opt/local --with-curl=/opt/local --with-pcre-regex=/opt/local --with-gd --with-jpeg-dir=/opt/local --with-png-dir=/opt/local --enable-gd-native-ttf --with-freetype-dir=/opt/local --with-ldap=/usr --with-kerberos=/usr --with-iodbc=/usr --with-apxs2=/opt/local/apache2/bin/apxs --with-mysql=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_php52/work/mysql5 --with-pdo-mysql=/opt/local/bin/mysql_config5 --with-mysql-sock=/opt/local/var/run/mysql5/mysqld.sock --with-mysqli=/opt/local/bin/mysql_config5 --with-pear=/opt/local/lib/php
これでようやくPHPをインストールする準備が整いました。
以下のコマンドを実行して、PHP 5.2.13をインストールします。
$ sudo port -d install php52 +apache2 +mysql5 +pear
$ sudo cp /opt/local/etc/php5/php.ini-dist /opt/local/etc/php5/php.ini
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" /opt/local/apache2/modules/libphp5.so
エラーが表示されなければ、無事インストール完了です。
autoconfのあたりが少々スマートじゃないですが、一時的な対応策ということでよしということにしておきます。
早く、gettextの開発者が対応してくれるといいですね!
それでは!