我试图在CentOS6上编译libmemcached(1.0.7),并不断收到以下警告:
... checking for event.h... no configure: WARNING: Unable to find libevent ...
我手动编译libevent(2.0.19)并使用以下configuration行构build它:
OPTIONS="--prefix=/usr/local/_custom/app/libevent"
一切编译和安装好,但我不知道如何使系统知道这些lib文件在自定义/usr/local/_custom/app/libevent/lib目录中。 我偶然发现一篇文章,并通过添加一个自定义文件到/etc/ld.so.conf.d/目录来让系统知道自定义libpath:
# /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命令。 但事实并非如此。
我有同样的问题,当我注意到configuration标志应该是放弃libmemcached
CPPFLAGS="-I/usr/local/_custom/app/libevent/include"
代替
CFLAGS="-I/usr/local/_custom/app/libevent/include"
对不起,我的英语第一。 我的操作系统:CentOS 6.3迷你没有桌面x86_64,我没有百胜安装libevent我遇到了同样的问题多次在不同的环境这里是我libevent的安装过程:
tar zxvf libevent-2.0.20-stable.tar.gz cd libevent-2.0.20-stable ./configure --prefix=/usr/local/libevent make make install
在我安装libmemcached-1.0.10之前,我试过了
./configure --prefix=/usr/local/libmemcached --with-lib-prefix=/usr/local/libevent --with-memcached=/usr/local/bin/
和
LIBEVENT_CPPFLAGS=/usr/local/libevent/include LIBEVENT_LDFLAGS=/usr/local/libevent/lib
问题也随之而来。 然后我做一些像这样的链接:
ln -s /usr/local/libevent/include/* /usr/include/ ln -s /usr/local/libevent/lib/libevent* /usr/lib64/
完成! 我认为libmemcachedfindlibevent.so和event.h有一些硬编码。 希望我的解决scheme可以帮助你。
我打算build议在系统上安装libevent-devel软件包。 这将提供您发布的错误中列出的头文件,但版本可能比您的libmemcached所需的版本更旧(1.4.13-1)。
看看你的序列,我实际上build议删除libmemcached源目录中的config.cache文件,然后重新运行./configure for libmemcached 。 这应该允许进程识别您对库searchpath所做的更改。
在和几位经验丰富的系统pipe理员下class后,我select了yum install memcached 。 和CentOS一样,权衡之一是使用老版本的apps / libs,但是CentOS的维护人员会回溯安全修复程序等等,所以我想我只会去上游版本,省去一些头痛的问题。
那么,我没有一个正确的答案,但我注意到,当我在CentOS上新编译的tmux告诉我
tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
我试了这个,它工作:
LD_LIBRARY_PATH=/usr/local/lib tmux
我不确定设置系统的LD_LIBRARY_PATH的规范/标准方式是什么,但是如果我将其固定到bashrc / zshrc中,它本身并不“可怕”。
编辑:啊, 这里有一个答案,阐明如何告诉你的系统图书馆的生活方式。