Problems creating mysql plugin in Qt6.6 on linux
-
Hello,
I am running Qt6.6.0 on a linux machine and I am trying to build the mysql plugin. I have the required library file (libmysqlclient.so) stored in /usr/lib64. The include files are in /usr/include/mysql.
I have created a directory build-sqldrivers and have followed the directions in the Qt doc for building mysql plugins for unix machines.
I run this qt-cmake command:
/usr/local/Qt6/6.6.0/gcc_64/bin/qt-cmake -G Ninja /usr/local/Qt6/6.6.0/Src/qtbasesrc/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/usr/local/Qt6/6.6.0/gcc_64 -DMySQL_INCLUDE_DIR="/usr/include/mysql" -DMySQL_LIBRARY="/usr/lib64/libmysqlclient.so"-- Configuring done
-- Generating done
-- Build files have been written to: /home/glaird/build-sqldriversI then run (from build-sqldrivers directory) cmake -- build .
I get the following error message:~/build-sqldrivers> cmake --build .
[10/19] Building CXX object mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o
FAILED: mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o
/usr/bin/c++ -DQMYSQLDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x050000 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_NO_AS_CONST -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QEXCHANGE -DQT_PLUGIN -DQT_SQL_LIB -DQT_WARN_DEPRECATED_UP_TO=0x070000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -Imysql/QMYSQLDriverPlugin_autogen/include -I/usr/local/Qt6/6.6.0/Src/qtbase/src/plugins/sqldrivers/mysql -Imysql -Iinclude -isystem /usr/include/mysql -isystem /usr/local/Qt6/6.6.0/gcc_64/include/QtCore -isystem /usr/local/Qt6/6.6.0/gcc_64/include -isystem /usr/local/Qt6/6.6.0/gcc_64/mkspecs/linux-g++ -isystem /usr/local/Qt6/6.6.0/gcc_64/include/QtCore/6.6.0 -isystem /usr/local/Qt6/6.6.0/gcc_64/include/QtCore/6.6.0/QtCore -isystem /usr/local/Qt6/6.6.0/gcc_64/include/QtSql/6.6.0 -isystem /usr/local/Qt6/6.6.0/gcc_64/include/QtSql/6.6.0/QtSql -isystem /usr/local/Qt6/6.6.0/gcc_64/include/QtSql -g -DNDEBUG -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -fPIC -pthread -Wsuggest-override -std=c++1z -MD -MT mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o -MF mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o.d -o mysql/CMakeFiles/QMYSQLDriverPlugin.dir/qsql_mysql.cpp.o -c /usr/local/Qt6/6.6.0/Src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
In file included from /usr/local/Qt6/6.6.0/Src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:11:0:
/usr/local/Qt6/6.6.0/gcc_64/include/QtCore/qfile.h:13:10: fatal error: filesystem: No such file or directory
#include <filesystem>
^~~~~~~~~~~~
compilation terminated.
[15/19] Building CXX object odbc/CMakeFiles/QODBCDriverPlugin.dir/qsql_odbc.cpp.o
ninja: build stopped: subcommand failed.Anyone know how I can fix the #include <filesystem> error?
Thanks.
-
@gdlaird You are using a gcc which is too old as it seems. It needs to support c++ 17
-
Thanks for the reply. I am running opensuse 15.4 with the most current gcc/g++ compiler (gcc12). But I have older versions as well. So, probably what is happening is that an older version is running when I assumed the most current was running. I will try to figure out how to set the default version.
-
@gdlaird
I had always assumed that when I installed a newer version of gcc, the installation process would update the gcc/g++ link to point to the new version--so that executing gcc/g++ would run the newest version.
So, this is not the case. I thought I was using gcc-12 and actually I was using gcc-7. So, I fixed this problem using the 'update-alternatives' configuration routine. Now, things work correctly and I have got the mysql plugin working.
Thanks again! -
Nice to hear, please mark the topic as solved then.
-