mysql - 使用 DLZ "/usr/bin/ld: cannot find -lmysqlclient"编译 Bind 时出现 CentOS 错误

标签 mysql makefile compilation centos bind

所以我正在尝试在 CentOS 7 上编译支持 DLZ ( mysql ) 的 Bind

做完之后

 ./configure --prefix=/usr --sysconfdir=/etc/bind --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-threads --enable-largefile --with-libtool --enable-shared --enable-static --with-openssl=/usr --with-gssapi=/usr --with-gnu-ld --with-dlz-postgres=no --with-dlz-mysql=yes --with-dlz-bdb=no --with-dlz-filesystem=yes  --with-dlz-stub=yes --enable-ipv6

make

我得到错误:

 /opt/bind/bind-9.11.0-P3/lib/isc/.libs/libisc.so ../../lib/isc/.libs/libisc.so -lcrypto -L/usr/lib/mysql -lmysqlclient -lcrypt -lm -ldl -lz -lpthread
 /usr/bin/ld: cannot find -lmysqlclient
 collect2: error: ld returned 1 exit status
 make[2]: *** [named] Error 1
 make[2]: Leaving directory `/opt/bind/bind-9.11.0-P3/bin/named'
 make[1]: *** [subdirs] Error 1
 make[1]: Leaving directory `/opt/bind/bind-9.11.0-P3/bin'
 make: *** [subdirs] Error 1

我已经让它在一个 CentOS 7 机器上运行,但是我在尝试让它运行时安装了各种古怪的东西。我实际上不知道它为什么在那台机器上编译,我希望能够复制这个过程。所以我创建了 CentOS 7 的全新安装,并尝试找出如何使用 DLZ 支持编译 Bind。绑定(bind) 9.11.0-P3。

我安装了 mariadb-libs,/usr/lib64/mysql 目录如下所示。

ll/usr/lib64/mysql/ 总数 16884 -rw-r--r--。 1 根根 2687 年 11 月 14 日 15:15 INFO_BIN -rw-r--r--。 1 root root 170 2016 年 9 月 12 日 INFO_SRC lrwxrwxrwx。 1 root root 17 Mar 29 16:40 libmysqlclient_r.so -> libmysqlclient.so lrwxrwxrwx。 1 root root 20 Mar 29 16:40 libmysqlclient.so -> libmysqlclient.so.18 lrwxrwxrwx。 1 root root 24 Mar 29 16:40 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0 -rwxr-xr-x。 1 根根 3135736 11 月 14 日 15:17 libmysqlclient.so.18.0.0 lrwxrwxrwx。 1 root root 15 Mar 29 16:40 libmysqld.so -> libmysqld.so.18 -rwxr-xr-x。 1 根根 14116296 11 月 14 日 15:17 libmysqld.so.18 -rwxr-xr-x。 1 根根 10474 11 月 14 日 15:14 mysqlbug -rwxr-xr-x。 1 root root 6758 11 月 14 日 15:15 mysql_config drwxr-xr-x。 2 root root 4096 Mar 29 16:40 插件

/usr/lib/mysql 目录如下所示。

ll/usr/lib/mysql/ 总计 0 drwxr-xr-x。 2 root root 6 Mar 29 21:36 插件

在/usr/lib/mysql 文件夹上的 Bind Compiles 的机器上看起来不同,当我在另一台机器上执行 yum whatprovides 时,我得到了这个结果:

yum whatprovides/usr/lib/mysql/libmysqlclient.so.18.0.0 加载的插件:fastestmirror 从缓存的主机文件加载镜像速度 * 基地:centos.mirror.ca.planethoster.net * 额外内容:centos.mirror.ca.planethoster.net * 更新:mirror.it.ubc.ca * webtatic: us-east.repo.webtatic.com 1:mariadb-libs-5.5.52-1.el7.i686 : MariaDB/MySQL 客户端所需的共享库 repo :基地 匹配自: 文件名:/usr/lib/mysql/libmysqlclient.so.18.0.0 1:mariadb-libs-5.5.52-1.el7.x86_64 : MariaDB/MySQL 客户端所需的共享库 repo :@base 匹配自: 文件名:/usr/lib/mysql/libmysqlclient.so.18.0.0

在全新安装中,我安装了这些 mariadb 软件包。

yum list mariadb*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.its.sfu.ca
 * extras: centos.bhs.mirrors.ovh.net
 * updates: mirror.its.sfu.ca
Installed Packages
mariadb.x86_64                               1:5.5.52-1.el7                @base
mariadb-bench.x86_64                         1:5.5.52-1.el7                @base
mariadb-devel.x86_64                         1:5.5.52-1.el7                @base
mariadb-embedded.x86_64                      1:5.5.52-1.el7                @base
mariadb-embedded-devel.x86_64                1:5.5.52-1.el7                @base
mariadb-libs.x86_64                          1:5.5.52-1.el7                @base
mariadb-server.x86_64                        1:5.5.52-1.el7                @base
mariadb-test.x86_64                          1:5.5.52-1.el7                @base
Available Packages

请帮我弄清楚如何在 CentOS 7 上安装支持 DLZ 的 Bind!

最佳答案

添加'LDFLAGS="-I/usr/include/mysql -L/usr/lib64/mysql"' 在 ./configure 命令上

像这样

./configure --prefix=/usr --sysconfdir=/etc/bind --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-threads --enable-largefile --with-libtool --enable-shared --enable-static --with-openssl=/usr --with-gssapi=/usr --with-gnu-ld --with-dlz-postgres=no --with-dlz-mysql=yes --with-dlz-bdb=no --with-dlz-filesystem=yes --with-dlz-stub=yes --enable-ipv6 LDFLAGS="-I/usr/include/mysql -L/usr/lib64/mysql"

关于mysql - 使用 DLZ "/usr/bin/ld: cannot find -lmysqlclient"编译 Bind 时出现 CentOS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43108910/

相关文章:

c++ - 为 Raspberry pi 2 预编译 amazon-kinesis-video-streams-producer-sdk-cpp

c - C 编译器会删除(合并)代码吗?

php - PHP MYSQL 表的分页

javascript - php jquery克隆输入字段插入到数据库的同一列中

php - 如何从两个表创建可靠的下拉列表

c - 编译时设置共享库前缀

jquery - MariaDB 10 无法识别 JSON* 函数

python - 如何纠正这个 python3.4 lxml 多核检测?

c++ - 防止 CMake 为仅可选 header 库生成的 makefile 在仅 header 模式下编译源文件

Java:从命令行运行的问题