Installing pcre and configuring shared libraries under Linux systems tutorial

Source: Internet
Author: User
Tags regular expression

PCRE (Perl compatible Regular Expressions) is a lightweight Perl library of functions, including Perl-compatible regular expression libraries. It is much smaller than regular expression libraries such as boost. Pcre is very easy to use and powerful, with more performance than POSIX regular expression libraries and some classic regular expression libraries.

Install Pcre

1. Pcre is currently the latest version of 8.36, you can click here to download.

2. Use TAR-ZXVF pcre-8.36.tar.gz for decompression.

3. Run Chmod-r 777/pcre-8.36 Grant all read and write permissions to the current folder.

4. Switch to/pcre-8.36 directory, run./configure pcre initialization configuration, will print a large pile of output information in the console.

5. Perform the make operation and compile.

[Root@server06 pcre-8.36]# make
Rm-f PCRE_CHARTABLES.C
Ln-s./pcre_chartables.c.dist PCRE_CHARTABLES.C
Make All-am
MAKE[1]: Entering directory '/opt/nginx/pcre-8.36 '
CC Libpcre_la-pcre_byte_order.lo
CC Libpcre_la-pcre_compile.lo
CC Libpcre_la-pcre_config.lo
CC Libpcre_la-pcre_dfa_exec.lo
CC Libpcre_la-pcre_exec.lo
CC Libpcre_la-pcre_fullinfo.lo
CC Libpcre_la-pcre_get.lo
CC Libpcre_la-pcre_globals.lo
CC Libpcre_la-pcre_jit_compile.lo
CC Libpcre_la-pcre_maketables.lo
CC Libpcre_la-pcre_newline.lo
CC Libpcre_la-pcre_ord2utf8.lo
CC Libpcre_la-pcre_refcount.lo
CC Libpcre_la-pcre_string_utils.lo
CC Libpcre_la-pcre_study.lo
CC Libpcre_la-pcre_tables.lo
CC Libpcre_la-pcre_ucd.lo
CC Libpcre_la-pcre_valid_utf8.lo
CC Libpcre_la-pcre_version.lo
CC Libpcre_la-pcre_xclass.lo
CC Libpcre_la-pcre_chartables.lo
CCLD libpcre.la
CC Libpcreposix_la-pcreposix.lo
CCLD libpcreposix.la
CXX Libpcrecpp_la-pcrecpp.lo
CXX Libpcrecpp_la-pcre_scanner.lo
CXX Libpcrecpp_la-pcre_stringpiece.lo
Cxxld libpcrecpp.la
CC PCRETEST-PCRETEST.O
CC PCRETEST-PCRE_PRINTINT.O
CCLD Pcretest
CC PCREGREP-PCREGREP.O
CCLD Pcregrep
CXX PCRECPP_UNITTEST-PCRECPP_UNITTEST.O
Cxxld Pcrecpp_unittest
CXX PCRE_SCANNER_UNITTEST-PCRE_SCANNER_UNITTEST.O
Cxxld Pcre_scanner_unittest
CXX PCRE_STRINGPIECE_UNITTEST-PCRE_STRINGPIECE_UNITTEST.O
Cxxld Pcre_stringpiece_unittest
MAKE[1]: Leaving directory '/opt/nginx/pcre-8.36 '

6. Run [root@server06 pcre-8.36]# make install, install, this pcre installation is complete.

[Root@server06 pcre-8.36]# make install

Pcre Configure shared libraries

Problem information:

./nginx:error while loading shared libraries:libpcre.so.1:cannot open Shared object file:no such file or directory

Problem reason: The Pcre library is not installed, or the Pcre library is installed without the Pcre shared library configured.

Solution: Configure the Pcre shared library.

1. Find the location of the Pcre library.

[Root@server06 ~]# Cd/lib
[Root@server06 lib]# Find/-type f-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. The Pcre library is soft connected.

The Pcre file read by the RedHat 64-bit machine is a/lib64/libpcre.so.0.0.1 file.

[Root@server06 ~]# ln-s/usr/local/lib/libpcre.so.1/lib64/
[Root@server06 ~]# cd/usr/local/nginx/sbin/
[Root@server06 sbin]#./nginx

If the type of 32-bit machine is operated, the address of the soft connection may be

Ln-s/lib/libpcre.so.0.0.1/lib/libpcre.so.1.

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.