简体   繁体   中英

Error in ./configure step in installation of libpqxx

this is a bit of a long shot but: I'm following this guide: https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm

But when running ./configure I get the following error:

(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.

And the configure.log file looks like this:

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)

I don't believe I have any packages missing. I have the newest version of g++, psql and libpqxx installed.

I have updated and upgraded all packages on my system.

I have crawled the web for solutions to this error, but I have no clue what is wrong.

Do you have an idea where I can go from here?

There hasn't been a tarball release of libpqxx at the old spot in a long time, so the tutorial you used with its wget command to download the tarball is very outdated.

The issue you encountered looks related to this issue and appears to have been fixed in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM