postgresql - 在安装 libpqxx 的 ./configure 步骤中出错

标签 postgresql ubuntu g++ configure libpqxx

这有点远,但是: 我正在遵循本指南: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的压缩包了,所以你用wget命令下载压缩包的教程是非常过时。

您遇到的问题看起来与 this issue 有关并且似乎已在 this commit 中修复:

commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <jtvjtv@gmail.com>
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/

相关文章:

ruby - 进程自动终止

c++ - 删除后自动重建使用 -MMD 生成的依赖文件

c++ - 构建交叉编译器

postgresql - 无法将容器化应用程序连接到容器化 postgres,接收到拨号 tcp 连接被拒绝的错误

sql - 条件 "email ~* ' link1.com $'"是什么意思?

SQL 窗口函数过滤

google-chrome - 有什么办法可以在 Ubuntu 中不显示的情况下启动 Chrome 浏览器?

全局安装包的 Ubuntu 18.04 Yarn 二进制文件

c++ - 如何阻止 CMake 将特定于平台的标志传递给编译器?

php - 脚本中的 Netbeans SQL 语法突出显示? (例如 PHP)