On 19. apr. 2010, at 08.45, Harry Duin wrote:

> I got this to work today as follows:
> 
> 1. got latest libevent from: http://www.monkey.org/~provos/libevent/
> 2. build libevent as follows:
>    (cd in libevent directory first)
>    a. configure --prefix=/home/hduin/ots/libevent-1.4.13-build

If you add: --disable-shared

>    b. make install
> 3. in latest memcached directory:
>    a. configure --with-libevent=/home/hduin/ots/libevent-1.4.13-build
>    b. edit Makefile and add -static to LDFLAGS and -lrt to LIBS
> definitions
>    c. make
> 
> Based on these steps, I thought for sure that the following configure
> would work so I would not need to edit the Makefile, but this did not
> work.

It would have worked because it would not find a shared version of the library. 
Modern linkers will try to use a shared object if it finds one unless you tell 
it to use a static one.

Cheers,

Trond



> The configure fails on this: LIBS="-lrt" LDFLAGS="-static" ./
> configure --with-libevent=/home/hduin/ots/libevent-1.4.13-build
> 
> Oh well, I got the static build!
> 
> Harry
> 
> On Apr 16, 2:38 pm, Trond Norbye <[email protected]> wrote:
>> On 16. apr. 2010, at 10.48, Harry Duin wrote:
>> 
>>> After adding -lrt I still see these errors:
>> 
>> Did you remove -levent??
>> 
>> I did this by adding --disable-shared when building libevent, and then 
>> memcached with
>> ./configure --with-libevent=<xxx> LDFLAGS=-lrt
>> 
>> Cheers
>> 
>> Trond
>> 
>> 
>> 
>>> memcached-memcached.o: In function `main':
>>> /home/hduin/ots/memcached-1.4.5/memcached.c:4548: warning: Using
>>> 'getpwnam' in statically linked applications requires at runtime the
>>> shared libraries from the glibc version used for linking
>>> memcached-memcached.o: In function `server_socket':
>>> /home/hduin/ots/memcached-1.4.5/memcached.c:3817: warning: Using
>>> 'getaddrinfo' in statically linked applications requires at runtime
>>> the shared libraries from the glibc version used for linking
>>> memcached-memcached.o: In function `update_event':
>>> memcached.c:(.text+0x36a): undefined reference to `event_del'
>>> memcached.c:(.text+0x387): undefined reference to `event_set'
>>> memcached.c:(.text+0x392): undefined reference to `event_base_set'
>>> memcached.c:(.text+0x3a4): undefined reference to `event_add'
>>> memcached-memcached.o: In function `clock_handler':
>>> memcached.c:(.text+0x43a): undefined reference to `event_set'
>>> memcached.c:(.text+0x44b): undefined reference to `event_base_set'
>>> memcached.c:(.text+0x458): undefined reference to `event_add'
>>> memcached.c:(.text+0x46c): undefined reference to `event_del'
>>> memcached-memcached.o: In function `conn_close':
>>> memcached.c:(.text+0xc79): undefined reference to `event_del'
>>> memcached-memcached.o: In function `conn_new':
>>> memcached.c:(.text+0x1fe0): undefined reference to `event_set'
>>> memcached.c:(.text+0x1fed): undefined reference to `event_base_set'
>>> memcached.c:(.text+0x2003): undefined reference to `event_add'
>>> memcached-memcached.o: In function `main':
>>> memcached.c:(.text+0x4f02): undefined reference to `event_init'
>>> memcached.c:(.text+0x5233): undefined reference to `event_base_loop'
>>> memcached-thread.o: In function `setup_thread':
>>> /home/hduin/ots/memcached-1.4.5/thread.c:193: undefined reference to
>>> `event_init'
>>> /home/hduin/ots/memcached-1.4.5/thread.c:200: undefined reference to
>>> `event_set'
>>> /home/hduin/ots/memcached-1.4.5/thread.c:202: undefined reference to
>>> `event_base_set'
>>> /home/hduin/ots/memcached-1.4.5/thread.c:204: undefined reference to
>>> `event_add'
>>> memcached-thread.o: In function `worker_libevent':
>>> /home/hduin/ots/memcached-1.4.5/thread.c:245: undefined reference to
>>> `event_base_loop'
>>> collect2: ld returned 1 exit status
>> 
>>> On Apr 16, 10:59 am, Trond Norbye <[email protected]> wrote:
>>>> On 16. apr. 2010, at 06.27, Harry Duin wrote:
>> 
>>>>> I want to build a statically linked version of memcached, but am not
>>>>> able to accomplish this. I got the dynamically linked version to build
>>>>> right away. To get the static build, I did this:
>> 
>>>>> 1. configure --with-libevent=/data/webserver_pkgs/target/dist/
>>>>> libevent/
>>>>> 2. update Makefile to add the parameter -static to the LDFLAGS
>> 
>>>> Add -lrt to LDFLAGS :)
>> 
>>>> Trond
>> 
>>>> --
>>>> Subscription 
>>>> settings:http://groups.google.com/group/memcached/subscribe?hl=en- Hide 
>>>> quoted text -
>> 
>> - Show quoted text -

Reply via email to