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
- [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
- Drwxr-xr-x 7 1169 1169 4096 Nov :pcre-8.32
3. Configuration
Shell Code
- [Email protected] pcre-8.32]#./configure
The console prints a summary of the PCRE configuration after the configuration is complete
Shell Code
- 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 a bit pcre library ...: no
- Build + bit pcre library ...: no
- Build C + + library ......: Yes.
- Enable JIT Compiling support ....: No
- Enable utf-8/16/+ support...: no
- Unicode properties .....: No, No.
- Newline char/sequence .....: LF
- \ r matches only Anycrlf ...: no
- EBCDIC coding ...: No, no, no, no, no.
- EBCDIC code for NL .....: N/A.
- Rebuild char tables ......: No.
- Use stack recursion .....: Yes..
- POSIX mem threshold ........:
- Internal link Size .......: 2 .
- Match limit ..... 10000000 .:-------
- Match limit recursion .....: Match_limit
- Build shared libs ......: Yes, No.
- Build static Libs .....: Yes, and the.
- Use the JIT in Pcregrep ...: no, 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, no, no, no.
- Code coverage ...: No, no, no, no, no.
4. Compiling
To perform a make operation:
Shell Code
- [[email protected] pcre-8.32]# make
After compiling, you can perform a make check to test (this step is not required)
Shell Code
- Testing Pcregrep version 8.32 2012-11-
- Testing Pcregrep Main Features
- Skipping Pcregrep utf-8 Tests:no utf-8 support in PCRE library
- 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 '
- [Email protected] pcre-8.32]#
There is a sentence in the Make check result above:
Shell Code
- 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
- [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
- Testing Pcregrep version 8.32 2012-11-
- 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 '
- [Email protected] pcre-8.32]#
5. Installation
Perform the Make install operation:
Shell Code
- [[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