zoukankan      html  css  js  c++  java
  • Linux下编译安装PCRE库

    原文:http://chenzhou123520.iteye.com/blog/1817563

    最近在学习nginx,nginx rewrite依赖于PCRE库,所以需要在linux系统中编译安装PCRE库。具体步骤如下:

    1.下载PCRE包

    首先去官网下载pcre的安装包

    https://sourceforge.net/projects/pcre/files/pcre/

    2.把安装包上传到服务器,然后解压

    Shell代码  收藏代码
    1. [root@localhost local]# tar -zxvf pcre-8.32.tar.gz  

    解压之后在当前目录下生成了一个文件夹:pcre-8.32

    3.配置

    Shell代码  收藏代码
    1. [root@localhost pcre-8.32]# ./configure  

    配置完之后控制台会打印出pcre配置的摘要信息

    Shell代码  收藏代码
    pcre-8.32 configuration summary:  
      
        Install prefix .................. : /usr/local  
        C preprocessor .................. : gcc -E  
        C compiler ...................... : gcc  
        C++ preprocessor ................ : g++ -E  
        C++ compiler .................... : g++  
        Linker .......................... : /usr/bin/ld  
        C preprocessor flags ............ :   
        C compiler flags ................ : -O2 -fvisibility=hidden  
        C++ compiler flags .............. : -O2 -fvisibility=hidden -fvisibility-inlines-hidden  
        Linker flags .................... :   
        Extra libraries ................. :   
      
        Build 8 bit pcre library ........ : yes  
        Build 16 bit pcre library ....... : no  
        Build 32 bit pcre library ....... : no  
        Build C++ library ............... : yes  
        Enable JIT compiling support .... : no  
        Enable UTF-8/16/32 support ...... : no  
        Unicode properties .............. : no  
        Newline char/sequence ........... : lf  
        R matches only ANYCRLF ......... : no  
        EBCDIC coding ................... : no  
        EBCDIC code for NL .............. : n/a  
        Rebuild char tables ............. : no  
        Use stack recursion ............. : yes  
        POSIX mem threshold ............. : 10  
        Internal link size .............. : 2  
        Match limit ..................... : 10000000  
        Match limit recursion ........... : MATCH_LIMIT  
        Build shared libs ............... : yes  
        Build static libs ............... : yes  
        Use JIT in pcregrep ............. : no  
        Buffer size for pcregrep ........ : 20480  
        Link pcregrep with libz ......... : no  
        Link pcregrep with libbz2 ....... : no  
        Link pcretest with libedit ...... : no  
        Link pcretest with libreadline .. : no  
        Valgrind support ................ : no  
        Code coverage ................... : no  

    4.编译

    执行make操作:

    Shell代码  收藏代码
    1. [root@localhost pcre-8.32]# make  

     编译完后可以执行make check进行测试(这一步非必须)

    Shell代码  收藏代码
    1. Testing pcregrep version 8.32 2012-11-30  
    2. Testing pcregrep main features  
    3. Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library  
    4. Testing pcregrep newline settings  
    5. PASS: RunGrepTest  
    6. ==================  
    7. All 5 tests passed  
    8. ==================  
    9. make[2]: Leaving directory `/usr/local/pcre-8.32'  
    10. make[1]: Leaving directory `/usr/local/pcre-8.32'  
    11. [root@localhost pcre-8.32]#   

     上面的make check结果中有一句:

    Shell代码  收藏代码
    1. Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library  

     这是因为在前面步骤中执行./configuration配置时没有加上对utf-8的支持

    如果要加上对utf-8的支持可以在./configuration时加上参数:

    Shell代码  收藏代码
    1. [root@localhost pcre-8.32]# ./configure --enable-utf8  

     配置完后再重新make

    make完后再次执行make check结果如下:

    Shell代码  收藏代码
    Testing pcregrep version 8.32 2012-11-30  
    Testing pcregrep main features  
    Testing pcregrep UTF-8 features  
    Testing pcregrep newline settings  
    PASS: RunGrepTest  
    ==================  
    All 5 tests passed  
    ==================  
    make[2]: Leaving directory `/usr/local/pcre-8.32'  
    make[1]: Leaving directory `/usr/local/pcre-8.32'  
    [root@localhost pcre-8.32]#  

    5.安装

    执行make install操作:

    Shell代码  收藏代码
    1. [root@localhost pcre-8.32]# make install  

    make install结束后pcre编译安装流程就结束了。

  • 相关阅读:
    算法设计之hash---hash 函数、hash表
    图像处理之换脸---手把手教你使用 Deepfakes 换脸
    图像处理之搜图---实现以图搜图
    机器学习之python---Python实现逻辑回归(LogisticRegression)
    嵌入式开发之usb 转 net --- 支持持USB 网络适配器方案
    嵌入式开发之网卡--- Ethernet 以太网 MAC、MII、PHY、MDIO、IEEE802.3 详解
    机器学习之RNN ---LSTM原理及实现详解
    Docker的学习
    网络7层 4层 5层 协议
    netstat 查看端口、进程占用
  • 原文地址:https://www.cnblogs.com/shihaiming/p/6281628.html
Copyright © 2011-2022 走看看