这有点遥不可及,但是:
我正在遵循本指南:https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
但是在运行./configure时,我得到以下错误:

(previous checking lines omitted for brevity)
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions...

sed: character class syntax is [[:space:]], not [:space:]
configure: error:
Linking a call to libpq failed in C++, even though it succeeded in C.  If your
C and C++ compilers are very different beasts, this may mean that we do not have
the right options for linking with it after all.

Read the config.log file for more detailed information.  Look for the last error
message, which may be several pages up from the end of the file.

configure.log文件如下所示:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libpqxx configure 4.0, which was
generated by GNU Autoconf 2.68.  Invocation command line was

  $ ./configure

## --------- ##
## Platform. ##
## --------- ##
(some lines omitted)
configure:3039: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3050: $? = 1
configure:3039: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
(some lines omitted)
configure:7629: gcc -E  conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
 #include <ac_nonexistent.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
(some lines omitted)
configure:8319: gcc -c -g -O2  -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
(some lines omitted)
configure:16424: g++ -o conftest -g -O2   -L/usr/lib/x86_64-linux-gnu conftest.cpp  >&5
/tmp/ccfFBf4K.o: In function `main':
/home/peter/libpqxx-4.0/conftest.cpp:44: undefined reference to `PQexec'
collect2: error: ld returned 1 exit status
(some liens omitted)

我相信我没有丢失任何包裹。我已经安装了最新版本的g++、psql和libpqxx。
我已经更新和升级了系统上的所有包。
我已经在网上搜寻这个错误的解决方案,但我不知道出了什么问题。
你知道我能从这里去哪里吗?

最佳答案

很长一段时间以来,旧站点上都没有libpqxx的tarball版本,因此您使用的教程及其wget命令下载tarball已经非常过时。
您遇到的问题看起来与this issue有关,似乎已在this commit中修复:

commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <[email protected]>
Date:   Thu Jun 1 11:39:08 2017 +0700

    Fix #13: not linking to libpq.

    This was that annoying interaction between autoconf, m4, GNU sed syntax,
    and the shell which broke the "remove redundant -lpq options" code in
    the configure script.

    Solution: forget about GNU sed's "[[:space:]]" syntax, and just look for
    a literal space.  There aren't going to be any tabs, newlines,
    non-breaking spaces, etc. there in even a moderately sane world.

关于postgresql - 安装libpqxx的./configure步骤出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52609616/

10-15 13:34