2011-08-01 45 views
1

webdisを使用しますが、リンクステージでエラーが発生します。 Webdisは、redisデータベースのWebフェイスです。あなたはここにそれを見つけることができます:http://webd.iswebdisをコンパイルしようとしたときにエラーが発生しました

私のシステム構成は次のとおりです。

[email protected]:~/Projects/webdis$ make 
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 to `event_base_new' 
worker.c:(.text+0x29): undefined reference to `event_set' 
worker.c:(.text+0x35): undefined reference to `event_base_set' 
worker.c:(.text+0x3f): undefined reference to `event_add' 
worker.c:(.text+0x6b): undefined reference to `event_base_dispatch' 
worker.o: In function `worker_can_read': 
worker.c:(.text+0xd2): undefined reference to `event_set' 
worker.c:(.text+0xe5): undefined reference to `event_base_set' 
worker.o: In function `worker_on_new_client': 
worker.c:(.text+0x1f5): undefined reference to `event_set' 
worker.c:(.text+0x208): undefined reference to `event_base_set' 
worker.c:(.text+0x212): undefined reference to `event_add' 
worker.o: In function `worker_monitor_input': 
worker.c:(.text+0x2b8): undefined reference to `event_set' 
worker.c:(.text+0x2cb): undefined reference to `event_base_set' 
worker.o: In function `worker_can_read': 
worker.c:(.text+0xf5): undefined reference to `event_add' 
worker.o: In function `worker_monitor_input': 
worker.c:(.text+0x2e3): undefined reference to `event_add' 
server.o: In function `server_start': 
server.c:(.text+0x217): undefined reference to `event_reinit' 
server.c:(.text+0x338): undefined reference to `event_base_new' 
server.c:(.text+0x35a): undefined reference to `event_set' 
server.c:(.text+0x369): undefined reference to `event_base_set' 
server.c:(.text+0x373): undefined reference to `event_add' 
server.c:(.text+0x37f): undefined reference to `event_base_dispatch' 
http.o: In function `http_can_write': 
http.c:(.text+0x63): undefined reference to `event_set' 
http.c:(.text+0x76): undefined reference to `event_base_set' 
http.o: In function `http_schedule_write': 
http.c:(.text+0x3f1): undefined reference to `event_set' 
http.c:(.text+0x404): undefined reference to `event_base_set' 
http.o: In function `http_response_write': 
http.c:(.text+0x6b1): undefined reference to `event_set' 
http.c:(.text+0x6c4): undefined reference to `event_base_set' 
http.c:(.text+0x6ce): undefined reference to `event_add' 
http.o: In function `http_response_write_chunk': 
http.c:(.text+0xc36): undefined reference to `event_set' 
http.c:(.text+0xc49): undefined reference to `event_base_set' 
http.c:(.text+0xc53): undefined reference to `event_add' 
http.o: In function `http_can_write': 
http.c:(.text+0x84): undefined reference to `event_add' 
http.o: In function `http_schedule_write': 
http.c:(.text+0x40f): undefined reference to `event_add' 
pool.o: In function `redisLibeventCleanup': 
pool.c:(.text+0x89): undefined reference to `event_del' 
pool.c:(.text+0x95): undefined reference to `event_del' 
pool.o: In function `pool_on_disconnect': 
pool.c:(.text+0x179): undefined reference to `event_set' 
pool.c:(.text+0x189): undefined reference to `event_base_set' 
pool.o: In function `redisLibeventAttach': 
pool.c:(.text+0x266): undefined reference to `event_set' 
pool.c:(.text+0x281): undefined reference to `event_set' 
pool.c:(.text+0x28c): undefined reference to `event_base_set' 
pool.c:(.text+0x297): undefined reference to `event_base_set' 
pool.o: In function `pool_can_connect': 
pool.c:(.text+0x3dd): undefined reference to `event_set' 
pool.c:(.text+0x3ed): undefined reference to `event_base_set' 
pool.o: In function `pool_connect': 
pool.c:(.text+0x595): undefined reference to `event_set' 
pool.c:(.text+0x5a5): undefined reference to `event_base_set' 
pool.c:(.text+0x5b6): undefined reference to `event_add' 
pool.o: In function `redisLibeventAddWrite': 
pool.c:(.text+0x6a): undefined reference to `event_add' 
pool.o: In function `redisLibeventAddRead': 
pool.c:(.text+0x77): undefined reference to `event_add' 
pool.o: In function `redisLibeventDelWrite': 
pool.c:(.text+0xb8): undefined reference to `event_del' 
pool.o: In function `redisLibeventDelRead': 
pool.c:(.text+0xc5): undefined reference to `event_del' 
pool.o: In function `pool_on_disconnect': 
pool.c:(.text+0x19e): undefined reference to `event_add' 
pool.o: In function `pool_can_connect': 
pool.c:(.text+0x402): undefined reference to `event_add' 
collect2: ld returned 1 exit status 
make: *** [webdis] Помилка 1 

私はlibevent.soとlibevent-devのヘッダ私は/ usr/libにインストールされている:私が作るないとき

* Ubuntu Oneiric Ocelot (11.10 Alpha) 
* Gcc 4.6 
* Linux kernel 3.0.0-7 

が、私は次の出力を得ます私はまたMakefileのLDFLAGS変数で-leventの代わりに-levent2を試しましたが、まだ進歩がありませんでした。私の問題の解決策は何ですか?

ありがとうございます。

答えて

4

あなたは後リンカのコマンドラインでオブジェクトファイルの名前を-leventコマンドラインオプションを配置する必要があります。 -lフラグのGCCのドキュメントから:

-llibrary 
-l library 
    Search the library named library when linking. (The second 
    alternative with the library as a separate argument is only for 
    POSIX compliance and is not recommended.) 

    It makes a difference where in the command you write this option; 
    the linker searches and processes libraries and object files in the 
    order they are specified. Thus, foo.o -lz bar.o searches library z 
    after file foo.o but before bar.o. If bar.o refers to functions in 
    z, those functions may not be loaded. 
+0

感謝がたくさんあります。それは本当に問題を解決するのに役立った。 –

+0

これは実際には共有されていない静的ライブラリに対してのみ重要です。 –

関連する問題