MySQL Forums
Forum List  »  Source, Builds, Binaries

Re: C++ connector DLL built but cannot CMake testapps
Posted by: Filip Leze
Date: November 05, 2021 01:44AM

Thanks to your help Bjorn:
- I can build the connector DLL
- I can CMake the testapp

but now building the testapp (X DevAPI test) returns an error:

--------------------------------------
$ cmake --build .
[ 50%] Building CXX object CMakeFiles/devapi_test.dir/devapi_test.cc.obj
[100%] Linking CXX executable run/devapi_test.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/devapi_test.dir/objects.a(devapi_test.cc.obj):devapi_test.cc:(.text+0x930): undefined reference to `mysqlx::abi2::r0::DbDoc::begin()'
--------------------------------------


When I see:
undefined reference to `mysqlx::abi2


This seems to be related to the ABI version, therefore I tried to build the connector following recommendation of some posts, adding to the CMake:


add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)


With that modification the build of the connector fails at the end:

--------------------------------------
...

[100%] Linking CXX shared library libmysqlcppconn8-2.dll
Merging SHARED library: C:\msys64\home\Filip\MySQL_CONNCPP_SOURCE\libmysqlcppconn8-2.dll
- xapi/libxapi.a
- devapi/libdevapi.a
- common/libcommon.a
- cdk/core/libcdk.a
- cdk/mysqlx/libcdk_mysqlx.a
- cdk/protocol/mysqlx/libcdk_proto_mysqlx.a
- cdk/protocol/mysqlx/zlib/libzlib.a
- cdk/protocol/mysqlx/lz4/liblz4.a
- cdk/protocol/mysqlx/zstd/libzstd.a
- cdk/parser/libcdk_parser.a
- cdk/foundation/libcdk_foundation.a
- C:/msys64/mingw64/lib/libssl.dll.a
- C:/msys64/mingw64/lib/libcrypto.dll.a
- cdk/libopenssl-applink.a
- cdk/protocol/mysqlx/protobuf/protobuf-3.11.4/cmake/libprotobuf-lited.a
Merge options:
- using gcc tools
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cdk/protocol/mysqlx/libcdk_proto_mysqlx.a(protocol.cc.obj): in function `cdk::protocol::mysqlx::log_handler_init(_RTL_RUN_ONCE*, void*, void**)':
.\cdk\protocol\mysqlx/protocol.cc:125: undefined reference to `google::protobuf::SetLogHandler(void (*)(google::protobuf::LogLevel, char const*, int, std::string const&))'

----------------------------------------

To recap so far:
- I can build the connector DLL but I cannot build the testapp (undefined reference to `mysqlx::abi2).

- I have the following CMake to build the connector successfully:

cmake . -DCMAKE_INSTALL_PREFIX=/home/Filip/MySQL_CONNCPP_INSTALL -DWITH_SSL=/mingw64/bin -DWITH_BOOST=/mingw64/bin -DBOOST_ROOT=/mingw64/bin -G "MSYS Makefiles"

- I have the following CMake for the testapp:

cmake -DWITH_SSL=/mingw64/bin -DWITH_BOOST=/mingw64/bin -DBOOST_ROOT=/mingw64/bin -G "MSYS Makefiles" -DWITH_CONCPP=/home/Filip/MySQL_CONNCPP_INSTALL .

This CMake goes well and returns:

-------------------------------------------
CMake Deprecation Warning at CMakeLists.txt:30 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Generating 64bit code
Liniking dynamically
Using dynamic runtime library.
Using connector lib at: CONCPP_LIB-NOTFOUND
CMake Warning at CMakeLists.txt:228 (message):
Using debug library for non-debug builds - this will not work on Windows


Installing shared library dependencies.
-- Installing: C:/msys64/home/Filip/testapp/run/debug/libmysqlcppconn8-2.dll
-- Installing: C:/msys64/home/Filip/testapp/run/debug/libmysqlcppconn8.dll.a
-- Installing: C:/msys64/home/Filip/testapp/run/libmysqlcppconn8-2.dll
-- Installing: C:/msys64/home/Filip/testapp/run/libmysqlcppconn8.dll.a
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

BOOST_ROOT
WITH_BOOST


-- Build files have been written to: C:/msys64/home/Filip/testapp

-------------------------------------------------------------



Using:
- Windows 10
- MinGW-w64
- cmake version 3.21.4
- make version 4.3
- g++ and gcc 11.2.0
- openssl 1.1.1l
boost libraries installed as well

Options: ReplyQuote


Subject
Views
Written By
Posted
1783
November 01, 2021 04:20PM
Re: C++ connector DLL built but cannot CMake testapps
614
November 05, 2021 01:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.