On Thu, Aug 18, 2011 at 9:09 AM, 然 安 <[email protected]> wrote:

> Hi, Trond. If I link with a dynamic version of libevent,  I needn't reset
> the LD_LIBRARY_PATH variable when I start the memcached. But, if I link with
> a dynamic version of libmemcached, I must reset the LD_LIBRARY_PATH variable
> when I execute my application program. Could you tell me the secret? Thank
> you very much!
>


Install libevent in a directory searched by your runtime linker, or add the
link flags to set a search path that includes the directory you install
libevent. With Sun Studio tools on Solaris you would do this by adding:
-R/path/to/the/libevent/lib/directory I'm not sure what gcc use, but I think
it's something like -Wl,-rpath,/path/to/libevent.so (Google should help you
find the correct syntax ;))

Cheers,

Trond




> --- *11年8月17日,周三, Trond Norbye <[email protected]>* 写道:
>
>
> 发件人: Trond Norbye <[email protected]>
> 主题: Re: install memcached with libevent?
> 收件人: [email protected]
> 日期: 2011年8月17日,周三,下午1:11
>
>
>
>
> On Wed, Aug 17, 2011 at 5:29 AM, 然 安 
> <[email protected]<http://cn.mc157.mail.yahoo.com/mc/[email protected]>
> > wrote:
>
>   If I compiled memcached with dynamic libevent library, I must have the
> libevet library in the correct directory each time when I start the
> memcached. I can't start a memcached server on the other computer only with
> the compiled executive memcached file.
>
>
> Static linking aslo means that if you ever find a bug in libevent you would
> have to recompile _all_ of the applications that use libevent to have them
> run with a version without the bug, and your operating system can't share
> the memory pages for the code implementing libevent between all processes
> using libevent...
>
>
>
> When I compiled memcached with a static libevent library, it told me to
> configure the libevent library path using --with--libevent. In fact, I have
> done it in the same way. My linux version is Red Hat Enterprise Linux AS
> release 4 (Nahant Update 3) and kernel version is 2.6.9_5-7-0-0.
>
>
>
> When you link with a static version of libevent you need to provide all of
> the libraries used by libevent on your platform in the link flags. I don't
> use RHEL, so I don't know which "backend" it use (or which library it needs
> for that). I guess the easiest for you would be to add "-lrt" to LDFLAGS
> before running configure (probably needed by the timers in there), and then
> look in config.log to see which symbols it can't find when it tries to link
> with libevent (and add them LDFLAGS).
>
> Trond
>
>


-- 
Trond Norbye

Reply via email to