[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Re: undefined reference to event_base_add_virtual in libevent 2.1



On Tue, Feb 10, 2015 at 7:47 PM, Marco Graziano <marco@xxxxxxxxxxxxxxxx> wrote:
> Sorry for the truncated email.
>
> Getting a linker error using libevent 2.1:
>
> marcog@marcog-VirtualBox:~/Cometa/cometa-mt/server$ make
> cc -Wall -g -I./include -L/usr/local/lib -levent -o cometa cometa.o
> request.o http_parser.o config.o rsyslog.o response.o routes.o api.o info.o
> webhooks.o websockets.o -l:libevent-2.1.so.5  -l:libevent_pthreads-2.1.so.5
> -lpthread -lcrypto -lm -ldl -lwebsock -lconfig -lssl -lworkqueue -lbeanstalk
> /usr/bin/ld: cometa.o: undefined reference to symbol
> 'event_base_add_virtual'
> /usr/local/lib/libevent-2.0.so.5: error adding symbols: DSO missing from
> command line
> collect2: error: ld returned 1 exit status
> make: *** [cometa] Error 1
>
> While everything is fine with libevent 2.0:
>
> marcog@marcog-VirtualBox:~/Cometa/cometa-mt/server$ make
> cc -Wall -g -I./include -L/usr/local/lib -levent -o cometa cometa.o

Could you test without "-levent" I guess that
/usr/local/lib/libevent.so is linked to 2.0
(Also please avoid top-posting.)

> request.o http_parser.o config.o rsyslog.o response.o routes.o api.o info.o
> webhooks.o websockets.o -l:libevent-2.0.so.5  -l:libevent_pthreads-2.0.so.5
> -lpthread -lcrypto -lm -ldl -lwebsock -lconfig -lssl -lworkqueue -lbeanstalk
>
> The symbol is defined in both libraries:
>
> marcog@marcog-VirtualBox:~$ nm  /usr/local/lib/libevent-2.1.so.5  | grep
> event_base_add_virtual
> 0000000000022b80 T event_base_add_virtual_
> marcog@marcog-VirtualBox:~$ nm  /usr/local/lib/libevent-2.0.so.5  | grep
> event_base_add_virtual
> 00000000000134f0 T event_base_add_virtual
>
> And the linker cache seems fine:
>
> marcog@marcog-VirtualBox:~/Cometa/cometa-mt/server$ ldconfig -p | grep
> libevent
> libevent_pthreads-2.1.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_pthreads-2.1.so.5
> libevent_pthreads-2.0.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_pthreads-2.0.so.5
> libevent_openssl-2.1.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_openssl-2.1.so.5
> libevent_extra-2.1.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_extra-2.1.so.5
> libevent_extra-2.0.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_extra-2.0.so.5
> libevent_core-2.1.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_core-2.1.so.5
> libevent_core-2.0.so.5 (libc6,x86-64) =>
> /usr/local/lib/libevent_core-2.0.so.5
> libevent-2.1.so.5 (libc6,x86-64) => /usr/local/lib/libevent-2.1.so.5
> libevent-2.0.so.5 (libc6,x86-64) => /usr/local/lib/libevent-2.0.so.5
>
> I am considering 2.1 because of a deadlock with a bufferevent implicit lock
> (using flags BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE)) with a pthread
> write lock.
>
> Any suggestion would be greatly appreciated.
>
> -Marco G.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.