Linux系统下安装PCRE及配置共享库教程
PCRE是一个用C语言编写的正则表达式函数库,比较轻量级,PCRE十分易用,同时功能也很强大,本文我们来看看在Linux如何安装PCRE及及配置共享库.
PCRE(Perl Compatible Regular Expressions)是一个轻量级的Perl函数库,包括 perl 兼容的正则表达式库,它比Boost之类的正则表达式库小得多,PCRE十分易用,同时功能也很强大,性能超过了POSIX正则表达式库和一些经典的正则表达式库.
安装PCRE:
1.PCRE目前最新版本为8.36,可以点这里进行下载.
2.使用tar -zxvf pcre-8.36.tar.gz进行解压.
3.运行 chmod -R 777 /pcre-8.36 对当前文件夹授予全部读写权限.
4.切换到/pcre-8.36目录下,运行 ./configure 进行pcre初始化配置,会在控制台打印出一大堆的输出信息.
5.执行make操作,进行编译.
- [root@server06pcre-8.36]#make
- rm-fpcre_chartables.c
- ln-s./pcre_chartables.c.distpcre_chartables.c
- makeall-am
- make[1]:Enteringdirectory`/opt/nginx/pcre-8.36'
- CClibpcre_la-pcre_byte_order.lo
- CClibpcre_la-pcre_compile.lo
- CClibpcre_la-pcre_config.lo
- CClibpcre_la-pcre_dfa_exec.lo
- CClibpcre_la-pcre_exec.lo
- CClibpcre_la-pcre_fullinfo.lo
- CClibpcre_la-pcre_get.lo
- CClibpcre_la-pcre_globals.lo
- CClibpcre_la-pcre_jit_compile.lo
- CClibpcre_la-pcre_maketables.lo
- CClibpcre_la-pcre_newline.lo
- CClibpcre_la-pcre_ord2utf8.lo
- CClibpcre_la-pcre_refcount.lo
- CClibpcre_la-pcre_string_utils.lo
- CClibpcre_la-pcre_study.lo
- CClibpcre_la-pcre_tables.lo
- CClibpcre_la-pcre_ucd.lo
- CClibpcre_la-pcre_valid_utf8.lo
- CClibpcre_la-pcre_version.lo
- CClibpcre_la-pcre_xclass.lo
- CClibpcre_la-pcre_chartables.lo
- CCLDlibpcre.la
- CClibpcreposix_la-pcreposix.lo
- CCLDlibpcreposix.la
- CXXlibpcrecpp_la-pcrecpp.lo
- CXXlibpcrecpp_la-pcre_scanner.lo
- CXXlibpcrecpp_la-pcre_stringpiece.lo
- CXXLDlibpcrecpp.la
- CCpcretest-pcretest.o
- CCpcretest-pcre_printint.o
- CCLDpcretest//phpfensi.com
- CCpcregrep-pcregrep.o
- CCLDpcregrep
- CXXpcrecpp_unittest-pcrecpp_unittest.o
- CXXLDpcrecpp_unittest
- CXXpcre_scanner_unittest-pcre_scanner_unittest.o
- CXXLDpcre_scanner_unittest
- CXXpcre_stringpiece_unittest-pcre_stringpiece_unittest.o
- CXXLDpcre_stringpiece_unittest
- make[1]:Leavingdirectory`/opt/nginx/pcre-8.36'
6.运行 [root@server06 pcre-8.36]# make install,进行安装,至此PCRE安装完成.
[root@server06 pcre-8.36]# make install
PCRE配置共享库.
问题信息:./nginx:error while loading shared libraries:libpcre.so.1: cannot open shared object file: No such file or directory
问题原因:没有安装PCRE库,或安装了PCRE库而没有配置PCRE共享库.
解决方案:配置PCRE共享库.
1.查找pcre库的位置.
- [root@server06~]#cd/lib
- [root@server06lib]#find/-typef-name*libpcre.so.*
- /lib64/libpcre.so.0.0.1
- /usr/local/lib/libpcre.so.1.2.4
- /opt/nginx/pcre-8.36/.libs/libpcre.so.1.2.4
2.将PCRE库进行软连接.
RedHat 64位机器读取的pcre文件为/lib64/libpcre.so.0.0.1文件.
- [root@server06~]#ln-s/usr/local/lib/libpcre.so.1/lib64/
- [root@server06~]#cd/usr/local/nginx/sbin/
- [root@server06sbin]#./nginx
如32位机器操作方式类型,可能软连接的地址为:
ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1。
热门评论