windows - 在libpq中没有找到PQexec()函数

标签 windows postgresql libpqxx

我在 Windows 上安装了 git bash,并且正在尝试安装 libpqxx在我的系统上。

我正在使用 g++ 编译器。

在我的 git bash 终端中,我进入 libpqxx 安装目录并运行 ./configure 一切顺利,它找到了 PostgreSQL 安装目录等。直到它显示 fatal error :

Did not find the PQexec() function in libpq.  This is the litmus test for a
working libpq installation.

这是执行的完整输出:

$ ./configure
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ supports C++11 features by default... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking for style of include used by make... none
checking whether make supports nested variables... no
checking dependency style of g++... none
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking build system type... x86_64-pc-mingw32
checking host system type... x86_64-pc-mingw32
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... c:/mingw/mingw32/bin/ld.exe
checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /c/MinGW/bin/nm -B
checking the name lister (/c/MinGW/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-pc-mingw32 file names to x86_64-pc-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-pc-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for c:/mingw/mingw32/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /c/MinGW/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... c:/mingw/mingw32/bin/ld.exe
checking if the linker (c:/mingw/mingw32/bin/ld.exe) is GNU ld... yes
checking whether the g++ linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC
checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (c:/mingw/mingw32/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether make sets $(MAKE)... (cached) no
checking for mkdir... /usr/bin/mkdir
checking for pkg-config... no
checking for doxygen... no
checking for dot... no
checking for xmlto... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking maintainer mode...
checking C++14 deprecation attribute... yes
checking for C++17 std::optional support... no
checking for experimental C++17 std::optional support... yes
checking for poll(2)... no
checking sys/select.h usability... no
checking sys/select.h presence... no
checking for sys/select.h... no
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for library containing select... no
checking for main in -lws2_32... yes
checking g++ visibility attribute... yes
checking whether the compiler supports function __attribute__((__const__))... yes
checking g++ pure attribute... yes
checking for pg_config... /c/PostgreSQL/pg10/bin/pg_config
configure: using PostgreSQL headers at C:/POSTGR~1/pg10/include
configure: using PostgreSQL libraries at C:/POSTGR~1/pg10/lib
checking C:/POSTGR~1/pg10/include/libpq-fe.h usability... yes
checking C:/POSTGR~1/pg10/include/libpq-fe.h presence... yes
checking for C:/POSTGR~1/pg10/include/libpq-fe.h... yes
checking for ability to compile source files using libpq... yes
checking for PQexec in -lpq... no
configure: error:
Did not find the PQexec() function in libpq.  This is the litmus test for a
working libpq installation.

A source file using the PQexec() function did compile without problems, and the
libpq library is available for linking, but for some reason a call to PQexec()
failed to link properly to the libpq library.  This may be because the libpq
library file is damaged, or in some incorrect format, or if your libpq is much
more recent than libpqxx version 6.0, perhaps libpq has undergone a
radical ABI change.

The last parts of config.log may give you a clue as to what really went wrong,
but be warned that this is no easy reading.  Look for the last error message
occurring in the file.

我正在使用全新安装的 PostgreSQL,因此它是最新版本。 有什么想法可能会发生这种情况以及如何解决此问题吗?

最佳答案

您可能想查看config.log,但明显的解释是libpq.dll不在您的PATH上或者您正在尝试使用 32 位 libpq.dll 构建 64 位 libpqxx,反之亦然。

关于windows - 在libpq中没有找到PQexec()函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47385900/

相关文章:

c++ - 是否有 Windows 安全持久存储 API?

python - 使用 Python 在 Postgresql 中存储 Json 对象数组

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

c++ - 检查 libpqxx (postgres) 中的连接是否仍处于事件状态

c++ - Libpqxx 连接池

java - 用于 Android 开发的 Light IDE

c# - 为什么它不将 Bool 变量传递给另一个类?

c++ - SFML - 创建光标和打印输入?

php - 如何使用 PostgreSQL 数据库建立网站?

postgresql - 生成带有前缀和前导零的系列 (postgresql)