-1

I'm trying to install libevent-2.0.12-stable on Centos, but when i type sudo make,error happens(I did ./configure before make):

/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 `__errno_location@@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

Can anyone help? Thanks.

Update

After i install libevent successfully with rpm package as mentioned by @KnudLarsen, i try to install tokyocabinet using make, however same error happens:

/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

I tried methods in Recompiling with -fPIC, but doesn't work. It seems there lacks some dependent packages, for i just install libevent and tokyocabinet in another centos machine and everything works fine.

Community
  • 1
  • 1
chou
  • 344
  • 3
  • 17
  • ? Which version of CentOS would that be ? `cat etc/redhat-release` .... ( CentOS 6.x has libevent version 1.4.13 .) .. libevent-2.0.13-14.2.x86_64.rpm for CentOS 6 is available in the Internet : http://rpm.pbone.net – Knud Larsen Jun 22 '16 at 17:30
  • Did you read and understand the part which says `recompile with -fPIC`? – tripleee Jun 23 '16 at 03:05
  • @KnudLarsen The version is 6.2, i install the libevent-2.0.13-14.2.x86_64.rpm and it's ok, but then i get the same problem when i install tokyocabinet – chou Jun 23 '16 at 10:03
  • @tripleee i do notice the recompile with -fPIC. But since i'm beginner, i don't know what does this mean, what should i do? Try 'sudo make -fPIC' ? – chou Jun 23 '16 at 10:06
  • About libm.a : You are supposed to have (the -fPIC compiled) /usr/lib64/libm.so ... from glibc-devel : I.e. `# yum install gcc-c++` will get you everything you need for gcc to work fully. – Knud Larsen Jun 24 '16 at 15:00

1 Answers1

0

CentOS 6.8 - 64bits :

tokyocabinet-1.4.32 builds OK : libtokyocabinet.so.8.23.0, libtokyocabinet.a

tokyocabinet-1.4.48 is also OK : libtokyocabinet.so.9.11.0, libtokyocabinet.a

... So I guess you have to install / reinstall your build requirements for gcc :

yum reinstall gcc-c++ glibc-devel glibc-headers kernel-headers

... to have the right files /usr/lib64/ and /usr/include/.

? Which version of tokyocabinet are you trying to build ? And where did you get it ?



Knud Larsen
  • 5,753
  • 2
  • 14
  • 19
  • the version is 1.4.47, after i reinstall gcc-c++ glibc-devel glibc-headers kernel-headers and try to reinstall tokyocabinet, same error happens. I guess it's not the version problem. – chou Jun 25 '16 at 01:31
  • When type 'ls -l', there is libm.so in /usr/lib64/ ,but it is a link to '../../lib64/libm.so.6', does it matter? – chou Jun 27 '16 at 04:27
  • @chou. Yes, so it is : /usr/lib64/libm.so -> ../../lib64/libm.so.6 – Knud Larsen Jun 27 '16 at 16:00
  • Yes, here ../../lib64/libm.so.6 is /lib64/libm.so.6 – chou Jun 28 '16 at 11:24