欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【Linux】Linux下编译安装PCRE库

程序员文章站 2022-03-03 22:32:01
...

1、点击这里进行下载PCRE

2、如果是.tar.gz就用tar解压,如果是.zip就用unzip解压

3、运行 chmod -R 777 /pcre-8.36 对当前文件夹授予全部读写权限

4、切换到/pcre-8.36目录下,运行 ./configure 进行pcre初始化配置,会在控制台打印出一大堆的输出信息

[email protected]:~/pcre2-10.30$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
省略....
checking for libbz2... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
省略....
config.status: executing script-chmod commands
config.status: executing delete-old-chartables commands

pcre2-10.30 configuration summary:

    Install prefix ..................... : /usr/local
    C preprocessor ..................... : gcc -E
    省略....
    Code coverage ...................... : no
    Fuzzer support ..................... : no

5、执行make操作,进行编译

abloume@ubuntu:~/pcre2-10.30$ make
rm -f src/pcre2_chartables.c
ln -s /home/abloume/pcre2-10.30/src/pcre2_chartables.c.dist /home/abloume/pcre2-10.30/src/pcre2_chartables.c
make  all-am
make[1]: Entering directory '/home/abloume/pcre2-10.30'
  CC       src/libpcre2_8_la-pcre2_auto_possess.lo
  省略....
  CC       src/pcre2test-pcre2test.o
  CCLD     pcre2test
make[1]: Leaving directory '/home/abloume/pcre2-10.30'

6、运行 sudo make install 进行安装

abloume@ubuntu:~/pcre2-10.30$ sudo make install
make  install-am
make[1]: Entering directory '/home/abloume/pcre2-10.30'
make[2]: Entering directory '/home/abloume/pcre2-10.30'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   
 省略....
make[2]: Leaving directory '/home/abloume/pcre2-10.30'
make[1]: Leaving directory '/home/abloume/pcre2-10.30'