nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.83k stars 304 forks source link

webdis compile error #28

Closed SSPkrolik closed 13 years ago

SSPkrolik commented 13 years ago

I've got a large error output:

cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o webdis.o webdis.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o cmd.o cmd.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o worker.o worker.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o slog.o slog.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o server.o server.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o libb64/cencode.o libb64/cencode.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o acl.o acl.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o md5/md5.o md5/md5.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o http.o http.c http.c: In function ‘http_response_write’: http.c:138:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o client.o client.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o websocket.o websocket.c websocket.c: In function ‘ws_handshake_reply’: websocket.c:76:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o pool.o pool.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o conf.o conf.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/json.o formats/json.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/raw.o formats/raw.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/common.o formats/common.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/custom-type.o formats/custom-type.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/bson.o formats/bson.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/hiredis.o hiredis/hiredis.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/sds.o hiredis/sds.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/net.o hiredis/net.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/async.o hiredis/async.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/dict.o hiredis/dict.c hiredis/dict.c:53:21: warning: ‘dictGenHashFunction’ defined but not used [-Wunused-function] hiredis/dict.c:73:14: warning: ‘dictCreate’ defined but not used [-Wunused-function] hiredis/dict.c:160:12: warning: ‘dictReplace’ defined but not used [-Wunused-function] hiredis/dict.c:182:12: warning: ‘dictDelete’ defined but not used [-Wunused-function] hiredis/dict.c:238:13: warning: ‘dictRelease’ defined but not used [-Wunused-function] hiredis/dict.c:258:22: warning: ‘dictGetIterator’ defined but not used [-Wunused-function] hiredis/dict.c:268:19: warning: ‘dictNext’ defined but not used [-Wunused-function] hiredis/dict.c:288:13: warning: ‘dictReleaseIterator’ defined but not used [-Wunused-function] cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/dump.o jansson/src/dump.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/error.o jansson/src/error.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/hashtable.o jansson/src/hashtable.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/load.o jansson/src/load.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/strbuffer.o jansson/src/strbuffer.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/utf.o jansson/src/utf.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/value.o jansson/src/value.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/variadic.o jansson/src/variadic.c cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o http-parser/http_parser.o http-parser/http_parser.c cc -levent -pthread -o webdis webdis.o cmd.o worker.o slog.o server.o libb64/cencode.o acl.o md5/md5.o http.o client.o websocket.o pool.o conf.o formats/json.o formats/raw.o formats/common.o formats/custom-type.o formats/bson.o hiredis/hiredis.o hiredis/sds.o hiredis/net.o hiredis/async.o hiredis/dict.o jansson/src/dump.o jansson/src/error.o jansson/src/hashtable.o jansson/src/load.o jansson/src/strbuffer.o jansson/src/utf.o jansson/src/value.o jansson/src/variadic.o http-parser/http_parser.o worker.o: In function worker_main': worker.c:(.text+0xd): undefined reference toevent_base_new' worker.c:(.text+0x29): undefined reference to event_set' worker.c:(.text+0x35): undefined reference toevent_base_set' worker.c:(.text+0x3f): undefined reference to event_add' worker.c:(.text+0x6b): undefined reference toevent_base_dispatch' worker.o: In function worker_can_read': worker.c:(.text+0xd2): undefined reference toevent_set' worker.c:(.text+0xe5): undefined reference to event_base_set' worker.o: In functionworker_on_new_client': worker.c:(.text+0x1f5): undefined reference to event_set' worker.c:(.text+0x208): undefined reference toevent_base_set' worker.c:(.text+0x212): undefined reference to event_add' worker.o: In functionworker_monitor_input': worker.c:(.text+0x2b8): undefined reference to event_set' worker.c:(.text+0x2cb): undefined reference toevent_base_set' worker.o: In function worker_can_read': worker.c:(.text+0xf5): undefined reference toevent_add' worker.o: In function worker_monitor_input': worker.c:(.text+0x2e3): undefined reference toevent_add' server.o: In function server_start': server.c:(.text+0x217): undefined reference toevent_reinit' server.c:(.text+0x338): undefined reference to event_base_new' server.c:(.text+0x35a): undefined reference toevent_set' server.c:(.text+0x369): undefined reference to event_base_set' server.c:(.text+0x373): undefined reference toevent_add' server.c:(.text+0x37f): undefined reference to event_base_dispatch' http.o: In functionhttp_can_write': http.c:(.text+0x63): undefined reference to event_set' http.c:(.text+0x76): undefined reference toevent_base_set' http.o: In function http_schedule_write': http.c:(.text+0x3f1): undefined reference toevent_set' http.c:(.text+0x404): undefined reference to event_base_set' http.o: In functionhttp_response_write': http.c:(.text+0x6b1): undefined reference to event_set' http.c:(.text+0x6c4): undefined reference toevent_base_set' http.c:(.text+0x6ce): undefined reference to event_add' http.o: In functionhttp_response_write_chunk': http.c:(.text+0xc36): undefined reference to event_set' http.c:(.text+0xc49): undefined reference toevent_base_set' http.c:(.text+0xc53): undefined reference to event_add' http.o: In functionhttp_can_write': http.c:(.text+0x84): undefined reference to event_add' http.o: In functionhttp_schedule_write': http.c:(.text+0x40f): undefined reference to event_add' pool.o: In functionredisLibeventCleanup': pool.c:(.text+0x89): undefined reference to event_del' pool.c:(.text+0x95): undefined reference toevent_del' pool.o: In function pool_on_disconnect': pool.c:(.text+0x179): undefined reference toevent_set' pool.c:(.text+0x189): undefined reference to event_base_set' pool.o: In functionredisLibeventAttach': pool.c:(.text+0x266): undefined reference to event_set' pool.c:(.text+0x281): undefined reference toevent_set' pool.c:(.text+0x28c): undefined reference to event_base_set' pool.c:(.text+0x297): undefined reference toevent_base_set' pool.o: In function pool_can_connect': pool.c:(.text+0x3dd): undefined reference toevent_set' pool.c:(.text+0x3ed): undefined reference to event_base_set' pool.o: In functionpool_connect': pool.c:(.text+0x595): undefined reference to event_set' pool.c:(.text+0x5a5): undefined reference toevent_base_set' pool.c:(.text+0x5b6): undefined reference to event_add' pool.o: In functionredisLibeventAddWrite': pool.c:(.text+0x6a): undefined reference to event_add' pool.o: In functionredisLibeventAddRead': pool.c:(.text+0x77): undefined reference to event_add' pool.o: In functionredisLibeventDelWrite': pool.c:(.text+0xb8): undefined reference to event_del' pool.o: In functionredisLibeventDelRead': pool.c:(.text+0xc5): undefined reference to event_del' pool.o: In functionpool_on_disconnect': pool.c:(.text+0x19e): undefined reference to event_add' pool.o: In functionpool_can_connect': pool.c:(.text+0x402): undefined reference to `event_add' collect2: ld returned 1 exit status

make: *\ [webdis] Помилка 1

Seams like linker cannot find reference to libevent but I'm sure it's installed on my Ubuntu x86_64 (via Synaptic) - the library and dev-header. So I'm confused what else might it be. I think some errors may be caused because I've got not proper version of libevent installed. I use

I've got also

nicolasff commented 13 years ago

You're right that it can't find libevent.so. If you don't have libevent.so in /usr/lib, try to add -L/path/to/the/libevent/directory to $LDFLAGS in the Makefile. There is no space between the L and the path.

SSPkrolik commented 13 years ago

Well, that's actually where's the problem hiding. I've got libevent.so:

krolik@krolik-PC:~$ locate libevent.so /usr/lib/libevent.so krolik@krolik-PC:~$

As I wrote before, mb the problem is caused by wrong version. Here's what I have in my /usr/lib directory:

krolik@krolik-PC:~$ locate /usr/lib/libevent /usr/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2.1.3 /usr/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5.1.1 /usr/lib/libevent.a /usr/lib/libevent.so /usr/lib/libevent_core-2.0.so.5 /usr/lib/libevent_core-2.0.so.5.1.1 /usr/lib/libevent_core.a /usr/lib/libevent_core.so /usr/lib/libevent_extra-2.0.so.5 /usr/lib/libevent_extra-2.0.so.5.1.1 /usr/lib/libevent_extra.a /usr/lib/libevent_extra.so /usr/lib/libevent_openssl-2.0.so.5 /usr/lib/libevent_openssl-2.0.so.5.1.1 /usr/lib/libevent_openssl.a /usr/lib/libevent_openssl.so /usr/lib/libevent_pthreads-2.0.so.5 /usr/lib/libevent_pthreads-2.0.so.5.1.1 /usr/lib/libevent_pthreads.a /usr/lib/libevent_pthreads.so krolik@krolik-PC:~$

nicolasff commented 13 years ago

Can you check that libevent.so is not a broken symlink?

nicolasff commented 13 years ago

Wait. locate is using a local database, that might not be up-to-date. Please use ls and not locate.

SSPkrolik commented 13 years ago

Yeah. I understand. I've checked this before. It's really there. Please look below on ls results:

krolik@krolik-PC:/usr/lib$ ls | grep libevent libevent-1.4.so.2 libevent-1.4.so.2.1.3 libevent-2.0.so.5 libevent-2.0.so.5.1.1 libevent.a libevent_core-2.0.so.5 libevent_core-2.0.so.5.1.1 libevent_core.a libevent_core.so libevent_extra-2.0.so.5 libevent_extra-2.0.so.5.1.1 libevent_extra.a libevent_extra.so libevent_openssl-2.0.so.5 libevent_openssl-2.0.so.5.1.1 libevent_openssl.a libevent_openssl.so libevent_pthreads-2.0.so.5 libevent_pthreads-2.0.so.5.1.1 libevent_pthreads.a libevent_pthreads.so libevent.so krolik@krolik-PC:/usr/lib$

SSPkrolik commented 13 years ago

Some additional info:

I hope this will help you to locate the problem.

nicolasff commented 13 years ago

Please try ldd /usr/lib/libevent.so. Also, what does libevent.so point to?

SSPkrolik commented 13 years ago

Here it is:

krolik@krolik-PC:/usr/lib$ ldd libevent.so linux-vdso.so.1 => (0x00007fff1f1ff000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f22f77a1000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f22f7583000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f22f71dc000) /lib64/ld-linux-x86-64.so.2 (0x00007f22f7c12000)

nicolasff commented 13 years ago

Try changing -levent in the Makefile to -levent2. If that doesn't work, ask on stackoverflow.com, there might be someone who can help you set it up.

SSPkrolik commented 13 years ago

Well, I actually tried that, I mean '-levent2' in the very beginning, and got this error:

/usr/bin/ld: cannot find -levent2

Well, thank's a lot for your patience and time, and I'll follow your advice and try stackoverflow.

SSPkrolik commented 13 years ago

Hi, nicolasff. I've managed to solve the problem with help of a guy from stackoverflow. The reason it didn't link was in the order of parameters sent to linker. I put -levent into the end of the command line parameters and it worked. Here's a short diff, I think that all diff would be excessive:

10: LDFLAGS=-pthread 23: $(CC) $(LDFLAGS) -o $(OUT) $(OBJS) -levent

Thanks a lot again, now try to use the product! ;)

SSPkrolik commented 13 years ago

Diving into gcc manual said me that the order really matters for static linking.

nicolasff commented 13 years ago

Right, there is no static link here though.