0

centos 6 64位安装tokoycabinet1.4.48 make时遇到的错误

在centos6 64bit安装tokoycabinet1.4.48时候,./configure 直接编译没有错误。在make的时候报如下错误:


gcc -g -O2 -std=c99 -Wall -fPIC -fsigned-char -O2 -shared -Wl,-soname,libtokyodystopia.so.1 -o libtokyodystopia.so.1.15.0 \
tcqdb.o dystopia.o tcwdb.o laputa.o myconf.o -L. -L/usr/local/lib -L/root/lib -L/usr/local/lib -ltokyocabinet -lbz2 -lz -lpthread -lm -lc
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value

这是因为操作系统版本问题导致lib64库下面的依赖tokoy cabinet没有找到。我的解决方法如下:

1.正常运行configure指令,再次运行前最好运行一次make clean清除缓存。

2.重新运行configure后,编辑生成的Makefile文件

将第33-63行后的内容修改如下


33 # Install destinations
34 prefix = /usr/local
35 exec_prefix = ${prefix}
36 datarootdir = ${prefix}/share
37 INCLUDEDIR = ${prefix}/include
38 LIBDIR = /usr/lib64
39 BINDIR = ${exec_prefix}/bin
40 LIBEXECDIR = ${exec_prefix}/libexec
41 DATADIR = ${datarootdir}/$(PACKAGE)
42 MAN1DIR = ${datarootdir}/man/man1
43 MAN3DIR = ${datarootdir}/man/man3
44 PCDIR = ${exec_prefix}/lib/pkgconfig
45 DESTDIR =
46
47 # Building configuration
48 CC = gcc
49 CPPFLAGS = -I. -I$(INCLUDEDIR) -I/root/include -I/usr/local/include -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__ \
50   -D_TC_PREFIX="\"$(prefix)\"" -D_TC_INCLUDEDIR="\"$(INCLUDEDIR)\"" \
51   -D_TC_LIBDIR="\"$(LIBDIR)\"" -D_TC_BINDIR="\"$(BINDIR)\"" -D_TC_LIBEXECDIR="\"$(LIBEXECDIR)\"" \
52   -D_TC_APPINC="\"-I$(INCLUDEDIR)\"" -D_TC_APPLIBS="\"-L$(LIBDIR) -ltokyocabinet -lbz2 -lz -lrt -lpthread -lm -lc \""
53 CFLAGS = -g -O2 -std=c99 -Wall -fPIC -fsigned-char -O2
54 LDFLAGS = -L. -L$(LIBDIR) -L/root/lib -L/usr/lib64
55 CMDLDFLAGS =
56 LIBS = -lbz2 -lz -lrt -lpthread -lm -lc
57 LDENV = LD_RUN_PATH=/lib64:/usr/lib64:$(LIBDIR):$(HOME)/lib64:
58 RUNENV = LD_LIBRARY_PATH=.:/lib64:/usr/lib64:$(LIBDIR):$(HOME)/lib64:
59 POSTCMD = true
60
61
62
63 #================================================================

保存后运行make&&make install 完成。

Filed in: 杂技 Tags: ,

Recent Posts

Bookmark and Promote!

Leave a Reply

You must be Logged in to post comment.

© 2020 陈李粮. All rights reserved. XHTML / CSS Valid.
.