我正在尝试在amazon linux ec2实例上安装opendkim。从源代码编译时,我得到:
配置:错误:未找到strlcpy/strlcat
所以我从源代码安装了libbsd。安装后,我可以转到strlcat和strlcpy的手册页,但我无法访问这些功能。我已验证是否已安装共享库。libbsd安装的输出声明使用4个选项之一:

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

我跑了
export LD_RUN_PATH=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib/

另外,my/etc/ld.so.conf还包含
 include ld.so.conf.d/*.conf

而my/etc/ld.so.conf.d/libbsd.conf包含
/usr/local/lib/libbsd

最后检查我的libbsd库nm-d/usr/local/lib/libbsd.so包含:
000000000000de30 T strlcat
000000000000ded0 T strlcpy

所以我的问题是,如何向命令行公开strlcat和strlcpy?或者如何使用“use the'-wl,-rpath-wl,libdir'linker flag”选项,或者通常我在链接到共享库时做错了什么?如有任何帮助,我们将不胜感激。谢谢!

最佳答案

所以无法链接到库,但我能够解决依赖关系。CentOS的二进制RPM安装完美:

sudo wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libbsd-0.6.0-3.el7.x86_64.rpm
 sudo yum localinstall ./libbsd-0.6.0-3.el7.x86_64.rpm

sudo wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libbsd-devel-0.6.0-3.el7.x86_64.rpm
sudo yum localinstall ./libbsd-devel-0.6.0-3.el7.x86_64.rpm

10-02 05:55