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

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



On Tue, Feb 10, 2015 at 7:32 PM, Marco Graziano <marco@xxxxxxxxxxxxxxxx> wrote:
> 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

Not 2.1 actually, and in 2.1 it has "_" prefix, that why it didn't work:

$ nm -D /usr/lib/x86_64-linux-gnu/libevent.so | fgrep virtual
0000000000022bb0 T event_base_add_virtual_

$ nm -D /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5 | fgrep virtual
0000000000012fe0 T event_base_add_virtual

> 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
> 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:
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.