I am trying to compile libmemcached (1.0.7) on CentOS6, and keep getting the following warning:
...
checking for event.h... no
configure: WARNING: Unable to find libevent
...
I manually compiled libevent (2.0.19) and built it using the following configure line:
OPTIONS="--prefix=/usr/local/_custom/app/libevent"
Everything compiled and installed fine, but I couldn't figure out how to make the system aware that the lib files are in the custom /usr/local/_custom/app/libevent/lib
dir. I stumbled upon an article and read that I can make the system aware of custom lib paths by adding a custom file to /etc/ld.so.conf.d/
directory:
# /etc/ld.so.conf.d/customApp.conf
/usr/local/_custom/app/libevent/lib
Then I issued the ldconfig
command and was able to confirm that libevent
was included by issuing this command:
ldconfig -p | ack -i libevent
Seeing that libevent was now included in the ldconfig output, I figured I would be able to compile libmemcached and satisfy the aforementioned warning. Unfortunately it did not. So I took another look at the ldconfig
output and noticed this:
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
There are no references to the base links, for example, I would expect to see links to these (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
So either I am doing something wrong, or the system still does not know where to look to find libevent.so
.
-- Update #1 --
I wasn't able to get libmemcached to compile without the warning notice, even after trying to compile using the following configure command:
./configure --prefix=/usr/local/_custom/app/libmemcached CFLAGS="-I/usr/local/_custom/app/libevent/include" LDFLAGS="-L/usr/local/_custom/app/libevent/lib"
I thought for sure this would work because I am directly passing the include and lib directories to the configure command. But it did not.
Sorry for my english first. my os: CentOS 6.3 mini without desktop x86_64, i haven't yum install libevent i met same problem many times in different environment Here is my installation process of libevent:
before my install libmemcached-1.0.10 i tried
and
the problem also happend. then i do some link like here:
it's done! i think libmemcached locate libevent.so and event.h has some hard code. wish my solution can help u.
I was going to suggest installing the
libevent-devel
package on the system. That will provide the header file listed in the error you posted, but the version may be older (1.4.13-1) than what you need for yourlibmemcached
.Looking at your sequence, I'd actually recommend removing the
config.cache
file in yourlibmemcached
source directory, then rerunning the./configure
forlibmemcached
. That should allow the process to recognize the changes you made to the library search paths.I had the same issue and was about to give up on libmemcached when I noticed that the configure flag should be
instead of
After speaking with a few seasoned Sysadmin guys from work, I opted to just do a
yum install memcached
. As with CentOS, one of the trade-offs is working with older versions of apps/libs, but CentOS maintainers will backport security fixes etc, so I figured I'll just go with the upstream version and save myself some headache.Well, I don't have a proper answer, but I did notice when my freshly compiled tmux on CentOS told me
I tried this, and it worked:
I'm not sure what the canonical/standard way of setting the system's LD_LIBRARY_PATH is, but it does not appear to be "horrible" per se if I stuck it into bashrc/zshrc.
Edit: Ah, here is one answer that elucidates the way to tell your system where the libraries live.