nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
遂检查pcre的安装,由于是在测试安装脚本,遂检查安装是否成功,从脚本运行来看,是成功编译了的,后来又重新编译pcre
configure 正常
make 正常
make install 出错如下
test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include"
/usr/bin/install -c -m 644 pcre.h pcrecpparg.h pcre_stringpiece.h '/usr/local/include'
test -z "/usr/local/lib/pkgconfig" || /bin/mkdir -p "/usr/local/lib/pkgconfig"
/usr/bin/install -c -m 644 libpcre.pc libpcreposix.pc libpcrecpp.pc '/usr/local/lib/pkgconfig'
make install-data-hook
make[3]: Entering directory `/usr/local/src/itnihao_lnmp/nginx/pcre-8.30'
ln -s pcre_assign_jit_stack.3 /usr/local/share/man/man3/pcre16_assign_jit_stack.3
ln -s pcre_compile.3 /usr/local/share/man/man3/pcre16_compile.3
ln: creating symbolic link `/usr/local/share/man/man3/pcre16_compile.3': File exists
make[3]: *** [install-data-hook] Error 1
make[3]: Leaving directory `/usr/local/src/itnihao_lnmp/nginx/pcre-8.30'
make[2]: *** [install-data-am] Error 2
make[2]: Leaving directory `/usr/local/src/itnihao_lnmp/nginx/pcre-8.30'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/usr/local/src/itnihao_lnmp/nginx/pcre-8.30
处理办法
rm /usr/local/share/man/man3/pcre* -rf
make clean
make install 立即OK,说明刚才的prce安装是没有问题的
下面查看nginx的lipcre问题
find / -name libpcre.so.1
/usr/local/lib/libpcre.so.1
ldconfig -v|grep pcre
ldconfig: Path `/usr/local/lib' given more than once 报错了
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcre.so.1 -> libpcre.so.1.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
libpcre.so.0 -> libpcre.so.0.0.1
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/include
/usr/local/lib 提示多了这行,删除掉
ldconfig -v|grep pcre
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcre.so.1 -> libpcre.so.1.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
libpcre.so.0 -> libpcre.so.0.0.1
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
再次启动nginx,则OK
总结:上面的问题其实是pcre的动态库路径不对,其实无需编译pcre,为画蛇添足的步骤。pcre再次编译出问题是由于之前安装过的,写man目录文件失败导致。