Hi, I'm getting some errors when linking SOCI. My CMake command line is:
cmake -G "MinGW Makefiles" -DCMAKE_VERBOSE_MAKEFILE=on -DBOOST_ROOT="D:\work\project\libraries\boost_1_54_0" -DWITH_BOOST=on -DSOCI_STATIC=on -DSOCI_TESTS=on -DWITH_DB2=off -DWITH_FIREBIRD=off -DWITH_MYSQL=off -DWITH_ODBC=off -DWITH_ORACLE=off -DWITH_SQLITE3=off -DWITH_POSTGRESQL=on -DSOCI_POSTGRESQL=on -DPOSTGRESQL_INCLUDE_DIR="D:\work\PostgreSQL\include" -DPOSTGRESQL_LIBRARIES="D:\work\PostgreSQL\lib\libpq.lib" -DSOCI_POSTGRESQL_TEST_CONNSTR:STRING="dbname=mydb user=postgres" ../soci-3.2.1 The result after running this is: onfiguring SOCI: -- SOCI_VERSION = 3.2.1 -- SOCI_ABI_VERSION = 3_2 -- SOCI_PLATFORM_NAME = win32 -- SOCI_COMPILER_NAME = mingw-4.7.2 -- SOCI_STATIC = on -- SOCI_TESTS = on -- Looking for SOCI dependencies: -- Boost: -- Boost_RELEASE_VERSION = 1.54.0 -- Boost_INCLUDE_DIR = D:/work/project/libraries/boost_1_54_0 -- Boost_LIBRARIES = -- MySQL: disabled, since WITH_MYSQL=OFF -- ODBC: disabled, since WITH_ODBC=OFF -- Oracle: disabled, since WITH_ORACLE=OFF -- PostgreSQL: -- POSTGRESQL_INCLUDE_DIR = D:/work/PostgreSQL/include -- POSTGRESQL_LIBRARIES = D:/work/PostgreSQL/lib/libpq.lib -- POSTGRESQL_VERSION = unknown -- SQLite3: disabled, since WITH_SQLITE3=OFF -- Firebird: disabled, since WITH_FIREBIRD=OFF -- DB2: disabled, since WITH_DB2=OFF -- Configuring SOCI core library: -- SOCI_CORE_TARGET = soci_core -- SOCI_CORE_TARGET_OUTPUT_NAME = soci_core_3_2 -- SOCI_CORE_DEPENDENCIES = -lpthread D:/work/project/libraries/boost_1_54_0/stage/lib/libboost_date_time-mgw47-mt-1_54.a -- WITH_BOOST = on -- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3_2" SOCI_LIB_PREFIX="libsoci_" SOCI_LIB_SUFFIX=".dll" -- Configuring SOCI database backends: -- Empty - SOCI backend skeleton for development of new backend -- SOCI_EMPTY = ON -- SOCI_EMPTY_TARGET = soci_empty -- SOCI_EMPTY_TARGET_OUTPUT_NAME = soci_empty_3_2 -- SOCI_EMPTY_HEADERS = soci-empty.h -- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3_2" HAVE_BOOST=1 HAVE_BOOST_DATE_TIME=1 -- SOCI_EMPTY_TEST_CONNSTR = dummy -- PostgreSQL - SOCI backend for PostgreSQL database engine -- SOCI_POSTGRESQL = on -- SOCI_POSTGRESQL_TARGET = soci_postgresql -- SOCI_POSTGRESQL_TARGET_OUTPUT_NAME = soci_postgresql_3_2 -- SOCI_POSTGRESQL_HEADERS = soci-postgresql.h common.h -- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3_2" HAVE_BOOST=1 HAVE_BOOST_DATE_TIME=1 HAVE_POSTGRESQL=1 -- SOCI_POSTGRESQL_NOPARAMS = OFF -- SOCI_POSTGRESQL_NOBINDBYNAME = OFF -- SOCI_POSTGRESQL_NOPREPARE = OFF -- SOCI_POSTGRESQL_TEST_CONNSTR = dbname=mydb user=postgres The result and error after I type 'mingw32-make' is: Linking CXX shared library ..\..\bin\libsoci_postgresql_3_2.dll cd /d D:\work\project\libraries\soci_build\backends\postgresql && "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\soci_postgresql.dir\link.txt --verbose=1 "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\soci_postgresql.dir/objects.a D:\work\dev\MinGW\bin\ar.exe cr CMakeFiles\soci_postgresql.dir/objects.a @CMakeFiles\soci_postgresql.dir\objects1.rsp D:\work\dev\MinGW\bin\g++.exe -shared -o ..\..\bin\libsoci_postgresql_3_2.dll -Wl,--out-implib,..\..\lib\libsoci_postgresql_3_2.dll.a -Wl,--major-image-version,3,--minor-image-version,2 -Wl,--whole-archive CMakeFiles\soci_postgresql.dir/objects.a -Wl,--no-whole-archive ..\..\lib\libsoci_core_3_2.dll.a D:\work\PostgreSQL\lib\libpq.lib -lpthread D:\work\project\libraries\boost_1_54_0\stage\lib\libboost_date_time-mgw47-mt-1_54.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x5e): undefined reference to `lo_close' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0xf4): undefined reference to `lo_lseek' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x1db): undefined reference to `lo_lseek' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x27e): undefined reference to `lo_read' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x393): undefined reference to `lo_lseek' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x436): undefined reference to `lo_write' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x54c): undefined reference to `lo_lseek' CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj):blob.cpp:(.text+0x5ef): undefined reference to `lo_write' d:/work/dev/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: CMakeFiles\soci_postgresql.dir/objects.a(blob.cpp.obj): bad reloc address 0xe in section `.text$_ZN4soci7details12blob_backendC2Ev[__ZN4soci7details12blob_backendC2Ev]' collect2.exe: error: ld returned 1 exit status backends\postgresql\CMakeFiles\soci_postgresql.dir\build.make:355: recipe for target 'bin/libsoci_postgresql_3_2.dll' failed mingw32-make[2]: *** [bin/libsoci_postgresql_3_2.dll] Error 1 mingw32-make[2]: Leaving directory 'D:/work/project/libraries/soci_build' CMakeFiles\Makefile2:401: recipe for target 'backends/postgresql/CMakeFiles/soci_postgresql.dir/all' failed mingw32-make[1]: *** [backends/postgresql/CMakeFiles/soci_postgresql.dir/all] Error 2 mingw32-make[1]: Leaving directory 'D:/work/project/libraries/soci_build' Makefile:128: recipe for target 'all' failed mingw32-make: *** [all] Error 2 Here's what I've tried to resolve the problem: The undefined references seem to indicate that the PostgreSQL library isn't being found although I've verified many times that the paths in the POSTGRESQL_INCLUDE_DIR and POSTGRESQL_LIBRARIES are valid. I've also attempted to add the following to SOCI's CMakeLists.txt file to make sure they are present but this didn't fix the problem. set(CMAKE_EXE_LINKER_FLAGS "-llibpq.lib") set(CMAKE_EXE_LINKER_FLAGS "-LD:\\work\\PostgreSQL\\lib") The empty Boost_LIBRARIES concerned me but it seems to find the correct library (libboost_date_time-mgw47-mt-1_54.a) in SOCI_CORE_DEPENDENCIES and when compiling. Additionally I set WITH_BOOST to off for a number of attempts to see if that fixed the problem but it didn't. Any help with allowing me to compile and then link the SOCI libraries would be appreciated. Thanks Mike ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
