我試圖在Centos上安裝libevent-2.0.12-stable,但是當我鍵入sudo make
時,發生錯誤(我在make
之前做過./configure
):make [2]:*** [libevent.la] Error 1
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -Wall -fno-strict-aliasing -pthread -version-info 6:1:1 -release 2.0 -o libevent.la -rpath /usr/local/libevent-2.0.12-stable/lib event.lo evthread.lo buffer.lo bufferevent.lo bufferevent_sock.lo bufferevent_filter.lo bufferevent_pair.lo listener.lo bufferevent_ratelim.lo evmap.lo log.lo evutil.lo evutil_rand.lo strlcpy.lo select.lo poll.lo epoll.lo signal.lo event_tagging.lo http.lo evdns.lo evrpc.lo -lrt
libtool: link: gcc -shared -fPIC -DPIC .libs/event.o .libs/evthread.o .libs/buffer.o .libs/bufferevent.o .libs/bufferevent_sock.o .libs/bufferevent_filter.o .libs/bufferevent_pair.o .libs/listener.o .libs/bufferevent_ratelim.o .libs/evmap.o .libs/log.o .libs/evutil.o .libs/evutil_rand.o .libs/strlcpy.o .libs/select.o .libs/poll.o .libs/epoll.o .libs/signal.o .libs/event_tagging.o .libs/http.o .libs/evdns.o .libs/evrpc.o -lrt -O2 -pthread -pthread -Wl,-soname -Wl,libevent-2.0.so.5 -o .libs/libevent-2.0.so.5.1.1
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/librt.a(clock_gettime.o): relocation R_X86_64_PC32 against undefined symbol `[email protected]@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libevent.la] Error 1
make[2]: Leaving directory `/home/lpchou/software/httpsqs/libevent-2.0.12-stable'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lpchou/software/httpsqs/libevent-2.0.12-stable'
make: *** [all] Error 2
任何人都可以幫忙嗎?謝謝。
更新
由@KnudLarsen提到我安裝libevent
成功後用rpm包,我嘗試使用make
安裝tokyocabinet
,但同樣的錯誤發生的情況:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libm.a(s_sin.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libm.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libtokyocabinet.so.9.10.0] Error 1
我試着在Recompiling with -fPIC方法,但不起作用。它似乎沒有一些依賴包,因爲我只是在另一個centos機器上安裝libevent和tokyocabinet,一切正常。
?那是CentOS的哪個版本? 'cat etc/redhat-release' ....(CentOS 6.x的libevent版本爲1.4.13).. CentOS 6的libevent-2.0.13-14.2.x86_64.rpm在Internet上可用:http:///rpm.pbone.net –
您是否閱讀並理解了「用-fPIC重新編譯」的部分? – tripleee
@KnudLarsen版本是6.2,我安裝了libevent-2.0.13-14.2.x86_64.rpm並且沒問題,但是當我安裝tokyocabinet時出現同樣的問題 – chou