Building mongodb drivers for qt6.5
-
Hello,
I have a working application on Qt 5.15 that I am trying to port over to Qt 6.5, but I am unsuccessful in figuring out how to configure cmake for minGW Qt 6.5.
C Driver-----------------------------------------------------------------------------------------------
in CMakeLists.txt I have added the following linesset(CMAKE_C_COMPILER "C:/Qt/Tools/mingw1120_64/bin/gcc.exe") set(CMAKE_CXX_COMPILER "C:/Qt/Tools/mingw1120_64/bin/g++.exe")
To make the C Driver i use this command
C:/Qt/Tools/CMake_64/bin/cmake.exe .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_VERSION="1.23.4" -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_EXTRA_ALIGNMENT=0 -DCMAKE_INSTALL_PREFIX=C:/Users/mycomputer/Desktop/BuildingSpot/install
Followed by
C:/Qt/Tools/CMake_64/bin/cmake.exe --build . --target install
Cxx driver------------------------------------------------------------------------------------------------
in CMakeLists.txt I have added the following linesset(CMAKE_C_COMPILER "C:/Qt/Tools/mingw1120_64/bin/gcc.exe") set(CMAKE_CXX_COMPILER "C:/Qt/Tools/mingw1120_64/bin/g++.exe")
And i tried 2 ways of making the cxx driver, one with boost
C:/Qt/Tools/CMake_64/bin/cmake.exe .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBSONCXX_POLY_USE_BOOST=1 -DBUILD_VERSION="3.7.1" -DBOOSTROOT=C:/boost/boost_1_82_0 -DCMAKE_PREFIX_PATH=C:/Users/mycomputer/Desktop/BuildingSpot/install -DCMAKE_INSTALL_PREFIX=C:/Users/mycomputer/Desktop/BuildingSpot/install2
and one without boost
C:/Qt/Tools/CMake_64/bin/cmake.exe .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_VERSION="3.7.1" -DCMAKE_CXX_STANDARD=17 -DCMAKE_PREFIX_PATH=C:/Users/mycomputer/Desktop/BuildingSpot/install -DCMAKE_INSTALL_PREFIX=C:/Users/mycomputer/Desktop/BuildingSpot/install2
Followed by
C:/Qt/Tools/CMake_64/bin/cmake.exe --build . --target install
Compiling Qt application-------------------------------------------------------------------------------
For the Qt applicationon Qt 5.15 with the old drivers (mongocxx 3.4 made for minGW 7.3) I can access mongodb with no issues
on Qt 6.5 with the old drivers (mongocxx 3.4 made for minGW 7.3) I can use most of mongodb's functionality, but it is unable to read doubles from mongodbI tried building mongocxx 3.6 and 3.7 using the above method, and trying out a pre-compiled MongoCXX 3.5.1 for GCC 10.1 from online, and all three of them result in the same error message after configuring Qt creator.
Here are the includes from my project file that may be relevant
CONFIG += c++17 #mongoDB INCLUDEPATH += $$PWD/../../MongoDB/Windows/mongocxx371/include/mongocxx/v_noabi \ $$PWD/../../MongoDB/Windows/mongocxx371/include/bsoncxx/v_noabi \ $$PWD/../../MongoDB/WindowsBoost win32: LIBS += -L$$PWD/../../MongoDB/Windows/mongocxx371/lib/ -lmongocxx -lbsoncxx INCLUDEPATH += $$PWD/../../MongoDB/Windows/mongocxx371/include DEPENDPATH += $$PWD/../../MongoDB/Windows/mongocxx371/include INCLUDEPATH += $$PWD/../../MongoDB/Windows/mongocxx371/lib DEPENDPATH += $$PWD/../../MongoDB/Windows/mongocxx371/lib INCLUDEPATH += $$PWD/../../MongoDB/Windows/mongocxx371/bin
Am I making some kind of mistake in the way i configure cmake for qt 6.5?