我点击此链接https://docs.bitnami.com/google/apps/wordpress/#how-to-install-the-memcached-module-using-the-libmemcached-library,将memcached安装到Google平台centos 7的bitnami nginx堆栈中。
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/home/lnmp/common
make
/home/lnmp
是我的bitnami安装路径
当我运行make
命令时,它将在下面显示错误日志
make -j2 all-am
make[1]: Entering directory `/home/lnmp/libmemcached-1.0.18'
CXXLD libhashkit/libhashkit.la
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-crc32.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-digest.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-function.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-has.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-hashkit.o: relocation R_X86_64_32S against hidden symbol `_Z21hashkit_one_at_a_timePKcmPv' can not be used when making a shared object
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-jenkins.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-md5.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-murmur3.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-rijndael.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-str_algorithm.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-strerror.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/bin/ld: libhashkit/.libs/libhashkit_libhashkit_la-aes.o: relocation R_X86_64_PC32 against symbol `calloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libhashkit/libhashkit.la] Error 1
make[1]: Leaving directory `/home/lnmp/libmemcached-1.0.18'
make: *** [all] Error 2
您可以在此链接libmemcached Makefile
中下载Makefile,以帮助我修改此文件。有人说relocation R_X86_64_32 against .rodata can not be used when making a shared object
错误是因为构建静态库需要-fPIC选项,需要添加CFLAGS += -fPIC
来修复它。但是这个Makefile太复杂了,我不知道如何添加它,并且该如何解决,有人可以帮助我吗?
答案 0 :(得分:1)
在配置文件中,
查找以下行:
for flag in -fPIE -pie; do
替换为
for flag in -fPIC -pic; do
./配置并重新制作