Linux under compile and install Pcre Library

Source: Internet
Author: User

Note: If you do not have root privileges, use--prefix to specify the installation path

./configure--prefix=/home/work/tools/pcre-8.xx

======================================================

Recently learning Nginx,nginx rewrite relies on the Pcre library, so you need to compile and install the Pcre library in a Linux system. The steps are as follows:

1. Download the Pcre Package

First go to the official website to download the PCRE installation package

If you are using FTP, for: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

If HTTP is the way: http://sourceforge.net/projects/pcre/files/pcre/

Currently the latest version for 8.32,linux corresponds to the installation package name: Pcre-8.32.tar.gz.

2. Upload the installation package to the server and unzip

Shell Code
    1. [Email protected] local]# tar-zxvf pcre-8.32.tar.gz

After decompression, a folder is generated in the current directory: pcre-8.32

Shell Code
    1. Drwxr-xr-x 7 1169 1169 4096 Nov :pcre-8.32

3. Configuration

Shell Code
    1. [Email protected] pcre-8.32]#./configure

The console prints a summary of the PCRE configuration after the configuration is complete

Shell Code
  1. pcre-8.32 Configuration Summary:
  2. Install prefix .....:/usr/local ........
  3. C preprocessor ...: gcc-e, ....... £ º
  4. C compiler ...: gcc, .....-------
  5. C + + Preprocessor .....: g++-E.
  6. C + + compiler ..........: g++
  7. Linker ...:/usr/bin/ld, ......---------
  8. C preprocessor flags ......:
  9. C compiler flags .........:-o2-fvisibility=hidden
  10. C + + compiler flags ......:-o2-fvisibility=hidden-fvisibility-inlines-hidden
  11. Linker flags .............:
  12. Extra libraries ...........:
  13. Build 8 bit pcre library ...: Yes
  14. Build a bit pcre library ...: no
  15. Build + bit pcre library ...: no
  16. Build C + + library ......: Yes.
  17. Enable JIT Compiling support ....: No
  18. Enable utf-8/16/+ support...: no
  19. Unicode properties .....: No, No.
  20. Newline char/sequence .....: LF
  21. \ r matches only Anycrlf ...: no
  22. EBCDIC coding ...: No, no, no, no, no.
  23. EBCDIC code for NL .....: N/A.
  24. Rebuild char tables ......: No.
  25. Use stack recursion .....: Yes..
  26. POSIX mem threshold ........:
  27. Internal link Size .......: 2 .
  28. Match limit ..... 10000000 .:-------
  29. Match limit recursion .....: Match_limit
  30. Build shared libs ......: Yes, No.
  31. Build static Libs .....: Yes, and the.
  32. Use the JIT in Pcregrep ...: no, No.
  33. Buffer size for Pcregrep ...: 20480
  34. Link Pcregrep with Libz ...: no
  35. Link Pcregrep with libbz2 ...: no
  36. Link pcretest with Libedit ...: no
  37. Link pcretest with Libreadline. : No
  38. Valgrind support ...: No, no, no, no.
  39. Code coverage ...: No, no, no, no, no.

4. Compiling

To perform a make operation:

Shell Code
    1. [[email protected] pcre-8.32]# make

After compiling, you can perform a make check to test (this step is not required)

Shell Code
  1. Testing Pcregrep version 8.32 2012-11-
  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. [Email protected] pcre-8.32]#

There is a sentence in the Make check result above:

Shell Code
    1. Skipping Pcregrep utf-8 Tests:no utf-8 support in PCRE library

This is because the./configuration configuration did not add support for utf-8 in the previous step.

If you want to add support for Utf-8, you can add parameters to the./configuration:

Shell Code
    1. [Email protected] pcre-8.32]#/configure--enable-utf8

When you're done configuring and then re-make

The make check results are performed again after make:

Shell Code
  1. Testing Pcregrep version 8.32 2012-11-
  2. Testing Pcregrep Main Features
  3. Testing Pcregrep utf-8 features
  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. [Email protected] pcre-8.32]#

5. Installation

Perform the Make install operation:

Shell Code
    1. [[email protected] pcre-8.32]# make install

After the make install finishes, the Pcre compilation installation process is over.

Linux under compile and install Pcre Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.