centos6 – CentOS 6 – 让系统了解自定义lib路径和缺少基本链接

我正在尝试在CentOS6上编译libmemcached(1.0.7),并继续收到以下警告:

...
checking for event.h... no
configure: WARNING: Unable to find libevent
...

我手动编译libevent(2.0.19)并使用以下配置行构建它:

OPTIONS="--prefix=/usr/local/_custom/app/libevent"

所有编译和安装都很好,但我无法弄清楚如何使系统意识到lib文件在自定义/usr/local / _custom / app / libevent / libdir中.我偶然发现了一个article并且读到我可以通过在/etc/ld.so.conf.d/目录中添加一个自定义文件来让系统知道自定义lib路径:

# /etc/ld.so.conf.d/customApp.conf
/usr/local/_custom/app/libevent/lib

然后我发出了ldconfig命令,并通过发出以下命令确认包含了libevent:

ldconfig -p | ack -i libevent

看到libevent现在包含在ldconfig输出中,我想我可以编译libmemcached并满足上述警告.不幸的是没有.所以我再看一下ldconfig输出并注意到了这一点:

libevent_pthreads-2.0.so.5 (libc6,x86-64) => /usr/local/_custom/app/libevent/lib/libevent_pthreads-2.0.so.5
libevent_openssl-2.0.so.5 (libc6,x86-64) => /usr/local/_custom/app/libevent/lib/libevent_openssl-2.0.so.5
libevent_extra-2.0.so.5 (libc6,x86-64) => /usr/local/_custom/app/libevent/lib/libevent_extra-2.0.so.5
libevent_core-2.0.so.5 (libc6,x86-64) => /usr/local/_custom/app/libevent/lib/libevent_core-2.0.so.5
libevent-2.0.so.5 (libc6,x86-64) => /usr/local/_custom/app/libevent/lib/libevent-2.0.so.5

没有对基本链接的引用,例如,我希望看到这些链接(ls -la /usr/local / _custom / app / libevent / lib):

libevent.so -> libevent-2.0.so.5.1.7
libevent_openssl.so -> libevent_openssl-2.0.so.5.1.7
libevent_core.so -> libevent_core-2.0.so.5.1.7

所以要么我做错了,要么系统仍然不知道在哪里找到libevent.so.

– 更新#1 –

即使在尝试使用以下configure命令进行编译之后,我也无法在没有警告通知的情况下进行libmemcached编译:

./configure --prefix=/usr/local/_custom/app/libmemcached CFLAGS="-I/usr/local/_custom/app/libevent/include" LDFLAGS="-L/usr/local/_custom/app/libevent/lib"

我认为这肯定会有效,因为我直接将include和lib目录传递给configure命令.但事实并非如此.

最佳答案
当我注意到configure标志应该是的时候,我遇到了同样的问题并准备放弃libmemcached

CPPFLAGS="-I/usr/local/_custom/app/libevent/include"

代替

CFLAGS="-I/usr/local/_custom/app/libevent/include"

转载注明原文:centos6 – CentOS 6 – 让系统了解自定义lib路径和缺少基本链接 - 代码日志