pam_mysql编译过程排错

Jaystrong 2020-06-02

1、报错configure: error: Cannot locate mysql client library. Please check your mysql installation安装一个包就可以了

dnf install MariaDB-devel

上面这个包名MariaDB-devel,取决于你得MySQL类型,我这里安装的是mariadb,因此我就安装MariaDB-devel就可以了。2、报错

[ pam_mysql-0.7RC1]# make
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/security -I/usr/include  -g -O2  -g -O2 -I/usr/include/mysql -I/usr/include/mysql/mysql     -c pam_mysql.c
mkdir .libs
 gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/security -I/usr/include -g -O2 -g -O2 -I/usr/include/mysql -I/usr/include/mysql/mysql -c pam_mysql.c  -fPIC -DPIC -o .libs/pam_mysql.o
pam_mysql.c: In function ‘pam_mysql_converse‘:
pam_mysql.c:3192:4: warning: passing argument 2 of ‘conv->conv‘ from incompatible pointer type [enabled by default]
    conv->appdata_ptr))) {
    ^
pam_mysql.c:3192:4: note: expected ‘const struct pam_message **‘ but argument is of type ‘struct pam_message **‘
/bin/sh ./libtool --mode=link gcc  -g -O2 -I/usr/include/mysql -I/usr/include/mysql/mysql      -o pam_mysql.la -rpath /lib/security/ -module -avoid-version pam_mysql.lo  -L/usr/lib64/ -lmariadb -lssl -lcrypto    
gcc -shared  .libs/pam_mysql.o  -L/usr/lib64/ -lmariadb -lssl -lcrypto  -Wl,-soname -Wl,pam_mysql.so -o .libs/pam_mysql.so
/usr/bin/ld: cannot find -lmariadb
collect2: error: ld returned 1 exit status
make: *** [pam_mysql.la] Error 1

以后遇到这种错误/usr/bin/ld: cannot find -lmariadb,有一个解决技巧。就找这一行错误的上面一行内容,也就是gcc -shared .libs/pam_mysql.o -L/usr/lib64/ -lmariadb -lssl -lcrypto -Wl,-soname -Wl,pam_mysql.so -o .libs/pam_mysql.so也就是运行这个命令时报错了,那咱们现在看如何解决这个错误。lmariadb,其实就是这个库名libmariadb.so开头的库名。直接放在/usr/lib64目录下的库,都是共享库,如果不是的话,则是/usr/lib64/xxx这样的路径来存放的,因此我们现在要做的就是下载这个库。

[ pam_mysql-0.7RC1]# dnf install MariaDB-shared

这样子就可以了,。安装完之后,你再单独执行报错的哪个命令gcc -shared .libs/pam_mysql.o -L/usr/lib64/ -lmariadb -lssl -lcrypto -Wl,-soname -Wl,pam_mysql.so -o .libs/pam_mysql.so,就不会报错了,此时可以继续make编译了。

相关推荐