Published by winstonw on 23 May 2008 at 12:41 am
FreeBSD php-mysql 升級失敗的問題
最近在升幾台 FreeBSD 機器的 ports,結果發現有好幾台 php-mysql[i] 都升不過,一開始不以為意,想說可能是該 port 有錯誤,過幾天再升級就會好;不過…這次實在等太久了,於是就仔細地試著查一下是什麼原因。
本來用 portsupgrade 升級時的錯誤訊息大概是這樣的:
...
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.
===> Script "configure" failed unexpectedly.
Please report the problem to ale@FreeBSD.org [maintainer] and attach the
"/usr/ports/databases/php5-mysql/work/php-5.2.6/ext/mysql/config.log" including
the output of the failure of your make command. Also, it might be a good idea
to provide an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1
Stop in /usr/ports/databases/php5-mysql.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade.80506.2 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=php5-mysql-5.2.5_1 UPGRADE_PORT_VER=5.2.5_1 make
** Fix the problem and try again.
...
再往訊息裡的 log 檔 (“/usr/ports/databases/php5-mysql/work/php-5.2.6/ext/mysql/config.log”) 去找,發現了這個疑似是原因的問題:
...
configure:4201: result: no
configure:4411: checking for mysql_error in -lmysqlclient
configure:4446: cc -o conftest -O2 -fno-strict-aliasing -pipe -R/usr/local/lib/mysql -L/usr/local/lib/mysql conftest.c -lmysqlclient >&5
/usr/local/lib/mysql/libmysqlclient.so: undefined reference to `__h_error'
configure:4452: $? = 1
...
看起來就像是 MySQL client library (的版本?)有問題,導致出現undefined reference,於是我就亂試了
portupgrade -f mysql-client
沒想到之後就可以順利的把 php-mysql、php-mysqli 等 port 順利的編起來了,因為我 Google 了一下都沒有找到相關的解法,所以還是貼出來,希望能讓有需要的人搜尋到提供點幫助 ;-)