解决/usr/bin/ld: cannot find -lmysqlclient错误

类似/usr/bin/ld: cannot find -xxxx的错误有很多, 首先我们可以最简单的判断一下:

这类情况一般是由于缺乏某某库文件, 又或者可能是由于已存在的库问题版本不对造成的

一般都是解决的办法就是安装缺乏的devel包就可以解决, 当然还有其他的未知因素, 我们看一个实例:

我在一台装centos5.2 x86_64的系统上配置php环境, 提示这个错误

/usr/bin/ld: cannot find -lmysqlclien

于是我安装了

#  yum -y install mysql-devel

结果提示依旧, 我根据提示查看config.log

/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient

她还是去找/usr/local/mysql/lib/libmysqlclient.so, 我来把这个错的换成对了, 刚才装了mysql-devel, 那么在/usr/lib64下就多了一个mysql的目录

# cd /usr/local/mysql
# mv lib lib.bak
# ln -s /usr/lib64/mysql /usr/local/mysql/lib (给他做个软链接)

然后再次编译安装php, 一切正常!

原文地址:https://www.cnblogs.com/furzoom/p/7710252.html