这有点远,但是: 我正在遵循本指南: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/