环境
centos5.7 x86_64 系统上安装postfix !
错误
"/usr/bin/ld: cannot find -lmysqlclient"
类似/usr/bin/ld: cannot find -xxxx的错误有很多,
最简单的判断一下:是否安装相应的mysql-devel包
发现mysql-devel 包已经安装了
- # rpm -qa | grep mysql
- mysql-devel-5.0.77-4.el5_6.6
- mysql-server-5.0.77-4.el5_6.6
- mysql-devel-5.0.77-4.el5_6.6
- mysql-5.0.77-4.el5_6.6
- php-mysql-5.1.6-27.el5_5.3
- mysql-5.0.77-4.el5_6.6
仔细再次查看错误信息,发现都是 /usr/lib/mysql/
- [postfix-2.6.13]$ make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ' 'AUXLIBS=-L/usr/lib/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto'
- /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
- /usr/bin/ld: cannot find -lmysqlclient
- collect2: ld returned 1 exit status
- make: *** [master] Error 1
- make: *** [update] Error 1
- [postfix-2.6.13]$ cat conf/makedefs.out
- # Do not edit -- this file documents how Postfix was built for your machine.
- SYSTYPE = LINUX2
- AR = ar
- ARFL = rv
- RANLIB = ranlib
- SYSLIBS = -L/usr/lib/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto -ldb -lnsl -lresolv
- CC = gcc $(WARN) -DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS
- OPT = -O
- DEBUG = -g
- AWK = awk
- STRCASE =
- EXPORT = AUXLIBS='-L/usr/lib/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto' CCARGS='-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ' OPT='-O' DEBUG='-g'
- WARN = -Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
- -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
- -Wunused -Wno-missing-braces
解决方法,指定为/usr/lib64/mysql
- [postfix-2.6.13]$ make clea
- [postfix-2.6.13]$ make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto'
- [postfix-2.6.13]$ cat conf/makedefs.out
- # Do not edit -- this file documents how Postfix was built for your machine.
- SYSTYPE = LINUX2
- AR = ar
- ARFL = rv
- RANLIB = ranlib
- SYSLIBS = -L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto -ldb -lnsl -lresolv
- CC = gcc $(WARN) -DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS
- OPT = -O
- DEBUG = -g
- AWK = awk
- STRCASE =
- EXPORT = AUXLIBS='-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto' CCARGS='-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ' OPT='-O' DEBUG='-g'
- WARN = -Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
- -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
- -Wunused -Wno-missing-braces
- make && make isntall
结束
仔细再次查看错误信息阿!