【程序运行时找不到库文件】nginx: error while loading shared libraries: libpcre.so.1
2014-11-29 17:56
561 查看
【程序运行时候找不到库文件】
19 Oct 2013 Written by Chandan Kumar
Published in Nginx
DISQUS_COMMENTS
Tweet
inShare
Share on Thumblr
【解决办法:1.找下你需要的库是否存在:查找下usr/local/lib
2.如果存在这个库的话,通过设置LD_LIBRARY_PATH=/usr/local/lib: 这个环境变量,把库的路径加进去
3.重新编译程序运行看看。
原理:
系统对动态库查找规则:
/lib
/usr/lib
到环境变量LD_LIBRARY_PATH指定的路径中查找
/etc/profile 下面有显示路径 环境变量,每个目录用 : 分割 window目录分割用 ;
【1.在文件/etc/profile改 2.export LD_LIBRARY_PATH=:.:~(当前用户主目录):..:~soft01(soft01用户的主目录)】
】
$./nginx
./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
$
If you are getting above error while starting nginx, you can fix by following.
This generally happens due to following three reasons.
You don’t have PCRE installed
Nginx was not complied & installed using pcre
PCRE library is not set in LD_LIBRARY_PATH
There are multiple ways to fix this issue. The best way I believe is using troubleshooting skills. Let’s understand the error and fix it accordingly.
nginx: error while loading shared libraries: libpcre.so.1
nginx is looking for file libpcre.so.1 which comes under PCRE library and usually installed on UNIX.
Let’s find libpcre.so.1 using find command
$find / -name libpcre.so.1 /usr/local/lib/libpcre.so.1 $
Ok, so I do have this file which means PCRE is already installed and will proceed with next troubleshooting step.
Note: If you don’t get find results then you got to install PCRE. You can either install using yum install pcre on Linux/CentOS
or can ask system administrator to install it.
Now, let’s set LD_LIBRARY_PATH as we could see libpcre.so.1 is available under /usr/local/lib
$export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Start nginx now, you should be able to start.
相关文章推荐
- 对于开发板上运行的程序缺少动态库文件的解决error while loading shared libraries
- Liunx 运行用 Intel MKL 库文件的程序出错 “error while loading shared libraries libmkl_intel.so” 解决办法
- Nginx: error while loading shared libraries: libpcre.so.1解决
- /opt/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object
- Nginx: error while loading shared libraries: libpcre.so.1解决
- 解决linux运行某程序时提示error while loading shared libraries: abc.so cannot open shared object file
- 针对Ubuntu下运行可执行文件出现的error while loading shared libraries: xxx.so的解决办法
- Nginx: error while loading shared libraries: libpcre.so.1解决
- Nginx 启动出错 error while loading shared libraries: libpcre.so.1
- ./nginx: error while loading shared libraries: libpcre.so.1
- Nginx: error while loading shared libraries: libpcre.so.1
- Nginx启动出错 error while loading shared libraries: libpcre.so.1
- Nginx: error while loading shared libraries: libpcre.so.1解决
- 启动nginx 报错 error while loading shared libraries: libpcre.so.1: cannot open shared object file
- Nginx启动错误:error while loading shared libraries: libpcre.so.1
- nginx启动报错 nginx: error while loading shared libraries: libpcre.so.1
- Nginx: error while loading shared libraries: libpcre.so.1
- ubuntu 运行可执行文件时出现问题:error while loading shared libraries
- Nginx: error while loading shared libraries: libpcre.so.1
- Tengine/Nginx 启动出错 error while loading shared libraries: libpcre.so.1