libpqxx configure无法找到libpq-fe.h用于本地安装PostgreSQL

我正在运行具有受限sudo访问权限的Red Hat 6.6 Linux的计算集群上生成构建脚本。目前,我已经从GitHub上的源创建本地安装的PostgreSQL 10.10。在构建之后,将它们安装在/storage/home/work/build_env/postgres上,并且$PATH被更新,以便pg_config运行并pkg-config libpq --cflags返回

-I/storage/home/work/build_env/postgres/include

libpqxx已从GitHub源中克隆,但由于以下错误而被卡在配置中:

configure: using PostgreSQL headers at /storage/home/work/build_env/postgres/include
configure: using PostgreSQL libraries at /storage/home/work/build_env/postgres/lib
checking /storage/home/work/build_env/postgres/include  /libpq-fe.h usability... no
checking /storage/home/work/build_env/postgres/include  /libpq-fe.h presence... no
checking for /storage/home/work/build_env/postgres/include  /libpq-fe.h... no
configure: error:
Can't find libpq-fe.h in /storage/home/work/build_env/postgres/include  .  Are you sure the libpq
headers are installed correctly?  They should be in the directory returned by
"pg_config --includedir" or "pkg-config libpq --cflags".

If you do have libpq (the C-language client library for PostgreSQL) installed,make sure you have the related development materials--mainly its header files--
as well as the library binary.  Some system distributions keep the two in
seperate packages with names like "alibrary" and "alibrary-dev",respectively.
In that case,make sure you have the latter installed as well.

但是,在pkg-config返回的目录中,我看到以下内容:

[user@compute libpqxx]$ ls -al /storage/home/work/build_env/postgres/include | grep libpq
drwxrws---  2 user user_collab  4096 Nov  7 13:35 libpq
-rw-r--r--  1 user user_collab  2211 Nov  7 13:35 libpq-events.h
-rw-r--r--  1 user user_collab 22179 Nov  7 13:35 libpq-fe.h

是什么原因导致配置脚本找不到文件的问题?

snowzqnasa 回答:libpqxx configure无法找到libpq-fe.h用于本地安装PostgreSQL


错误实际上从日志中很明显,但也很细微。如问题中所述,文件存在于正确的路径;但是,该脚本中有多余的空格:

/storage/home/work/build_env/postgres/include  /libpq-fe.h 

应该在什么时候出现:

/storage/home/work/build_env/postgres/include/libpq-fe.h

这可以通过使用sed使用sed 's/ *$//g'剥离空白来纠正。这可以通过在本地更新配置脚本

来完成:
19006 -  with_postgres_include=$($PKG_CONFIG libpq --cflags | sed 's/^-I//')
19006 +  with_postgres_include=$($PKG_CONFIG libpq --cflags | sed 's/^-I//' | sed 's/ *$//g')

此问题为addressed in the libpqxx repository,因此规范的解决方案是在遇到问题时升级到源代码的最新版本。

本文链接:https://www.f2er.com/3142180.html

大家都在问