我正在尝试在amazon linux ec2实例上安装opendkim。从源代码编译时我得到: configure:error:找不到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/
另外我的/etc/ld.so.conf包含
include ld.so.conf.d/*.conf
和我的/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暴露给命令行?或者我如何做"使用`-Wl,-rpath -Wl,LIBDIR'链接器标志"选项,或者一般来说,在链接到共享库时我做错了什么?任何帮助表示赞赏。谢谢!
答案 0 :(得分:0)
因此无法链接到库,但我能够解决依赖关系。来自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