我使用以下批次在 Windows 10 上使用 Visual Studio 2015 构建和测试 SOCI 3.2:
SET PREFIX=..\soci-3.2.3-install
SET POSTGRES_DIR=E:\PostgreSQL\9.5
cmake^
-G "NMake Makefiles"^
-DCMAKE_BUILD_TYPE=Release^
-DCMAKE_INSTALL_PREFIX=%PREFIX%^
-DSOCI_TESTS=ON^
-DWITH_ODBC=OFF^
-DWITH_POSTGRESQL=ON^
-DPOSTGRESQL_INCLUDE_DIR="%POSTGRES_DIR%\include"^
-DPOSTGRESQL_LIBRARIES="%POSTGRES_DIR%\lib\libpq.lib"^
-DSOCI_POSTGRESQL_TEST_CONNSTR="host=localhost port=5432 dbname=postgres user=eagui"^
..\soci-3.2.3
nmake
nmake test
我还在soci-3.2.3\core\soci-platform.h
构建之前注释了第 27 行,以避免由一个 VC 头文件引起的宏重新定义错误。我确保E:\PostgreSQL\9.5\bin
添加到PATH
. 命令提示符具有管理员权限。
运行批处理后,我从测试中得到以下输出:
...
3/4 Test #3: soci_postgresql_test .............***Failed 1.37 sec
Start 4: soci_postgresql_test_static
4/4 Test #4: soci_postgresql_test_static ......***Failed 0.17 sec
50% tests passed, 2 tests failed out of 4
Total Test time (real) = 1.63 sec
The following tests FAILED:
3 - soci_postgresql_test (Failed)
4 - soci_postgresql_test_static (Failed)
Errors while running CTest
NMAKE : fatal error U1077: 'echo' : return code '0x8'
Stop.
我已将 PostgreSQL 服务器配置为接受信任连接。postgres
数据库和eagui
用户存在于服务器中。
知道为什么 PostgreSQL 的测试没有通过以及如何修复它吗?