Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/libdir. 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.

share|improve this question
    
you need to tell where the source files are - not the so lib files. into your script you see that event.h - tell to configure where the you put that file (the directory) –  silviud May 11 '12 at 2:37
    
As another data point, I was able to build libmemcached 1.10 on Centos 6.3 by installing libevent-devel. –  neal Aug 3 '12 at 15:35

5 Answers 5

up vote 0 down vote accepted

I had the same issue and was about to give up on libmemcached when I noticed that the configure flag should be

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

instead of

CFLAGS="-I/usr/local/_custom/app/libevent/include"
share|improve this answer
    
Whoa, and this worked? –  Mike Purcell Aug 22 '12 at 0:03
    
Yes, this worked. –  janjaapdriessen Aug 22 '12 at 20:41
    
Cool, thanks for the update! Accepted this answer. –  Mike Purcell Aug 22 '12 at 21:10

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:

tar zxvf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20-stable
./configure --prefix=/usr/local/libevent
make
make install

before my install libmemcached-1.0.10 i tried

./configure --prefix=/usr/local/libmemcached --with-lib-prefix=/usr/local/libevent --with-memcached=/usr/local/bin/

and

LIBEVENT_CPPFLAGS=/usr/local/libevent/include
LIBEVENT_LDFLAGS=/usr/local/libevent/lib 

the problem also happend. then i do some link like here:

ln -s /usr/local/libevent/include/* /usr/include/
ln -s /usr/local/libevent/lib/libevent* /usr/lib64/

it's done! i think libmemcached locate libevent.so and event.h has some hard code. wish my solution can help u.

share|improve this answer

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 your libmemcached.

Looking at your sequence, I'd actually recommend removing the config.cache file in your libmemcached source directory, then rerunning the ./configure for libmemcached. That should allow the process to recognize the changes you made to the library search paths.

share|improve this answer
    
Thanks I'll give it a shot. –  Mike Purcell May 11 '12 at 2:43
    
Did this work for you? –  ewwhite May 11 '12 at 15:24
    
Haven't tried it yet, going to try it today. Just curious, before I run the ./configure command I always run the make clean command, shouldn't make clean clear out any remnants of previous make attempts, i.e. the config.cache file? –  Mike Purcell May 11 '12 at 16:29
    
Except in situations where the makefile hasn't been generated yet... Or if your configure fails on a dependency... –  ewwhite May 11 '12 at 16:31
    
Ok, I tried the config.cache solution, but before/after ./configure there was no config.cache file to be found. I think you are correct, the header file need to be available, and did find it, but it is located in /usr/src/_custom/app/libevent/include which the system doesn't appear to be aware of, so maybe that's the problem. –  Mike Purcell May 11 '12 at 19:57

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.

share|improve this answer

Well, I don't have a proper answer, but I did notice when my freshly compiled tmux on CentOS told me

tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

I tried this, and it worked:

LD_LIBRARY_PATH=/usr/local/lib tmux

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.