PG數據庫源碼在編譯之前,需要首先通過configure腳本,加入一些參數進行配置。例如:想要支持lz4壓縮,就需要在configure時,添加參數--with-lz4。
一般情況下,想要把相關功能都配置,詳細的configure命令為(本人是Linux系統):
./configure --enable-debug --with-python --with-perl --with-tcl --with-gssapi --with-pam --with-openssl --with-pam --without-ldap --with-libxml --with-libxslt --without-oci --enable-dtrace --enable-depend --enable-cassert --with-systemd CFLAGS="-O0 -DOPTIMIZER_DEBUG -g3 -gdwarf-2" --prefix=/usr/local/pgsql
在第一次執行的時候,一般會報很多錯,主要的原因,還是相關的庫,並沒有安裝。
總結遇到的相關問題如下:
【問題1】:
checking for dtrace... no
configure: error: dtrace not found
解決方法:
yum search dtrace
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
=============================================================================================== Matched: dtrace ===============================================================================================
systemtap-sdt-devel.i686 : Static probe support tools
systemtap-sdt-devel.x86_64 : Static probe support tools
找到了,就安裝,我是64位的,安裝第二個
yum install -y systemtap-sdt-devel.x86_64
【問題2】:
checking for flags to link embedded Perl... Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
no
configure: error: could not determine flags for linking embedded Perl.
This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not
installed.
解決方法:
yum install perl-ExtUtils-Embed -y
【問題3】:
configure: error: could not determine flags for linking embedded Perl.
This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not
installed.
解決方法:
yum install perl-ExtUtils-Embed
【問題4】:
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.
解決方法:
yum install readline readline-devel
【問題5】:
checking for inflate in -lz... no
configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.
解決方法:
yum install zlib zlib-devel
【問題6】:
checking for CRYPTO_new_ex_data in -lcrypto... no
configure: error: library 'crypto' is required for OpenSSL
解決方法:
yum install openssl openssl-devel
【問題7】:
checking for pam_start in -lpam... no
configure: error: library 'pam' is required for PAM
解決方法:
yum install pam pam-devel
【問題8】:
checking for xmlSaveToBuffer in -lxml2... no
configure: error: library 'xml2' (version >= 2.6.23) is required for XML support
解決方法:
yum install libxml2 libxml2-devel
【問題9】:
checking for xsltCleanupGlobals in -lxslt... no
configure: error: library 'xslt' is required for XSLT support
解決方法:
yum install libxslt libxslt-devel
【問題10】:
configure: error: Tcl shell not found
解決方法:
yum install tcl tcl-devel
【問題11】:
checking for ldap.h... no
configure: error: header file is required for LDAP
解決方法:
yum install openldap openldap-devel
【問題12】:
checking for Python.h... no
configure: error: header file <Python.h> is required for Python
解決方法:
yum install python python-devel (注意有的機器上需要指定python版本,例如python2-devel或python3.6-devel)
【問題13】:
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
解決方法:
yum install gcc-c++
【問題14】:
configure: error: Package requirements (liblz4) were not met:
No package 'liblz4' found