Chinaunix首页 | 论坛 | 博客
  • 博客访问: 330846
  • 博文数量: 30
  • 博客积分: 3021
  • 博客等级: 少校
  • 技术积分: 408
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-01 11:32
文章分类

全部博文(30)

文章存档

2022年(1)

2015年(2)

2014年(1)

2013年(1)

2012年(2)

2011年(2)

2010年(3)

2009年(10)

2008年(8)

分类: LINUX

2009-09-24 17:34:55

config.log中同时有/usr/bin/ld: cannot find -lmysqlclient错误
系统版本如下
[root@opencms php-5.2.6]# uname -a
Linux opencms 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
安装php-5.2.6的时候,编译选项如下:
[root@opencms php-5.2.6]#./configure "--prefix=/usr/local/php" "--with-apxs2=/usr/local/apache/bin/apxs" "--with-config-file-path=/usr/local/php/etc" "--with-mysql"
报以下错误
configure: error: Try adding --with-zlib-dir= . Please check config.log for more information.
查看config.log,发现里面有下面提示:
configure:60044: gcc -o conftest -I/usr/include -g -O2 -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib conftest.c -lmysqlclient -lz -l resolv -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm 1>&5 /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status configure: failed program was: #line 60033 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mysql_errno(); int main() { mysql_errno() ; return 0; }
由于本系统时x86_64的,在/usr下有lib和lib64两个目录,现在提示是在/usr/lib/mysql下找mysql*文件,感觉不太对劲,于是
[root@opencms php-5.2.6]# cd /usr/lib
[root@opencms lib]# mv mysql/ mysql.bak/
[root@opencms lib]# ln -s /usr/lib64/mysql /usr/lib/mysql
重新编译php,一些正常。
不知道为什么会在两个目录下都出现mysql目录,用以下命令查看的时候发现了问题所在
[root@opencms lib]# rpm -qa | grep mysql
mysql-5.0.45-7.el5
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-devel-5.0.45-7.el5
mysql-5.0.45-7.el5
mysql-server-5.0.45-7.el5
mysql-connector-odbc-3.51.12-2.2
原来是同一个package出现了两次,版本也都是一样的,我估计是安装系统的人把32位和64位的mysql都安装了一遍。。。
于是执行卸载
[root@opencms lib]# rpm -e mysql
error: "mysql" specifies multiple packages
卸载不掉
通过rpm --help发现–allmatches应该可以解决这个问题:
–allmatches
Remove all versions of the package which match PACKAGE_NAME. Normally an error is issued if PACKAGE_NAME matches
multiple packages.
rpm -e --allmatches mysql-5.0.45-7.el5
卸载的时候又出现包依赖,最后使用
rpm -e -nodeps --allmatches mysql-5.0.45-7.el5
全部卸载完毕后重新安装x86_64的mysql,就只在/usr/lib64下出现mysql目录了。
可这时问题又出现了,报以下错误:
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
应该还是php编译的时候默认去找/usr/lib/mysql这个目录,重复刚才的步骤:
[root@opencms lib]# ln -s /usr/lib64/mysql /usr/lib/mysql
重新编译php,问题解决!
 

 
阅读(4248) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~