1、问题

源码编译PostgreSQL12.14+pgpool-II-4.3.2安装pgpool报错如下:

[pg12@cdh03 ~]$ ./configure --prefix=/home/pg12/pgpool
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
/home/pg12/pgpool-II-4.3.2/missing: Unknown `--is-lightweight' option
Try `/home/pg12/pgpool-II-4.3.2/missing --help' for more information
checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no
checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC
checking if gcc -std=gnu99 PIC flag -fPIC -DPIC works... yes
checking if gcc -std=gnu99 static flag -static works... no
checking if gcc -std=gnu99 supports -c -o file.o... yes
checking if gcc -std=gnu99 supports -c -o file.o... (cached) yes
checking whether the gcc -std=gnu99 linker (/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking for pg_config... no
checking for PQexecPrepared in -lpq... no
configure: error: libpq is not installed or libpq is old

官方文档如下:

Specifies the top directory where PostgreSQL's client libraries are installed. Default value is the path provided by pg_config command.

  根据官方文档介绍pgpool编译时需要指定安装PostgreSQL数据库的顶部目录,默认值是pg_config命令提供的路径。操作环境PostgresSQL的psql目录是:/home/pg12/soft/bin/psql ,所以数据库的顶部目录是:/home/pg12/soft。

2、解决办法

第一种方法 编译pgpool时指定postgresql安装路径

[pg12@cdh03 ~]$ cd pgpool-II-4.3.2
[pg12@cdh03 pgpool-II-4.3.2]$ ./configure --prefix=/home/pg12/pgpool --with-pgsql=/home/pg12/soft
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
.................
config.status: creating src/watchdog/Makefile
config.status: creating src/include/config.h
config.status: src/include/config.h is unchanged
config.status: executing libtool commands

[pg12@cdh03 pgpool-II-4.3.2]$ make && make install
make[3]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/libs/pcp'
make[3]: Entering directory `/home/pg12/pgpool-II-4.3.2/src/libs'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/libs'
make[2]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/libs'
Making all in watchdog
make[2]: Entering directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[3]: Entering directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[2]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[1]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src'
make[1]: Entering directory `/home/pg12/pgpool-II-4.3.2'
make[2]: Entering directory `/home/pg12/pgpool-II-4.3.2'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/pg12/pgpool-II-4.3.2'
make[1]: Leaving directory `/home/pg12/pgpool-II-4.3.2'

第二种方法 配置postgresql安装路径到编译pgpool用户环境变量中

[pg12@cdh03 ~]$ vi ~/.bash_profile
PATH=$PATH:$HOME/.local/bin:$HOME/bin:/home/pg12/soft/bin
export PATH

[pg12@cdh03 ~]$ source ~/.bash_profile 

然后,不用指定postgresql安装路径,直接编译。

[pg12@cdh03 pgpool-II-4.3.2]$ ./configure --prefix=/home/pg12/pgpool
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
.................
config.status: creating src/watchdog/Makefile
config.status: creating src/include/config.h
config.status: src/include/config.h is unchanged
config.status: executing libtool commands

[pg12@cdh03 pgpool-II-4.3.2]$ make && make install
make[3]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/libs/pcp'
make[3]: Entering directory `/home/pg12/pgpool-II-4.3.2/src/libs'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/libs'
make[2]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/libs'
Making all in watchdog
make[2]: Entering directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[3]: Entering directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[2]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src/include'
make[1]: Leaving directory `/home/pg12/pgpool-II-4.3.2/src'
make[1]: Entering directory `/home/pg12/pgpool-II-4.3.2'
make[2]: Entering directory `/home/pg12/pgpool-II-4.3.2'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/pg12/pgpool-II-4.3.2'
make[1]: Leaving directory `/home/pg12/pgpool-II-4.3.2'