I've recently updated my machine to the latest version of Fedora Linux 27 and Qt 5.10.0. The Qt framework was installed using the Offline installer qt-opensource-linux-x64-5.10.0 which I usually do. All of the options were checked during installation to ensure that all the plugins , sources, and libraries are installed. Again this is how i usually do a Fresh Install of Qt after an Update.
Now the problem is that MySQL driver is not loaded
QSqlDatabase: QMYSQL driver not loaded
Previously on the earlier versions like Qt 5.8 or 5.7 etc this problem was solved either by linking the correct version of libmysqlclient.so or recompiling it from the Src directory. But this is not working now at all.
So here is the ldd of the Qt program which needs MySQL
linux-vdso.so.1 (0x00007ffc13709000)
libmysqlclient.so.21 => /usr/lib64/mysql/libmysqlclient.so.21 (0x00007f59732cb000)
libzmq.so.5 => /usr/local/lib/libzmq.so.5 (0x00007f5973045000)
libQt5WebEngineWidgets.so.5 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/lib/libQt5WebEngineWidgets.so.5 (0x00007f5972e04000)
libQt5PrintSupport.so.5 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/lib/libQt5PrintSupport.so.5 (0x00007f5972b97000)
libQt5Widgets.so.5 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/lib/libQt5Widgets.so.5 (0x00007f597235e000)
As can be seen this needs the latest version of mysql libmysqlclient.so.21 library which is already installed
This is the ldd output of /opt/Qt/Qt5.10.0/5.10.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so
linux-vdso.so.1 (0x00007ffeb8bf8000)
libQt5Sql.so.5 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007f60cd408000)
libQt5Core.so.5 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007f60cccba000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f60cca9b000)
libmysqlclient.so.18 => not found
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f60cc715000)
libm.so.6 => /lib64/libm.so.6 (0x00007f60cc3c0000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f60cc1a9000)
libc.so.6 => /lib64/libc.so.6 (0x00007f60cbdc6000)
libz.so.1 => /lib64/libz.so.1 (0x00007f60cbbaf000)
libicui18n.so.56 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.56 (0x00007f60cb716000)
libicuuc.so.56 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.56 (0x00007f60cb35e000)
libicudata.so.56 => /opt/Qt/Qt5.10.0/5.10.0/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.56 (0x00007f60c997b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f60c9777000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f60c9575000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f60c9261000)
/lib64/ld-linux-x86-64.so.2 (0x00007f60cd863000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f60c8fee000)
Clearly this says libmysqlclient.so.18 => not found as because the latest version libmysqlclient.so.21 is installed.
Now when i try to recompile the drivers i'm faced with a repeated problem
qsql_mysql.cpp:235:9: error: ‘my_bool’ does not name a type; did you mean ‘_Bool’?
Here is what i did
cd /opt/Qt/Qt5.10.0/5.10.0/Src/qtbase/src/plugins/sqldrivers/mysql
/opt/Qt/Qt5.10.0/5.10.0/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib64/mysql" mysql.pro
make
Make is failing with a strange error
g++ -c -pipe -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include/QtSql/5.10.0 -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include/QtSql/5.10.0/QtSql -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include/QtCore/5.10.0 -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include/QtCore/5.10.0/QtCore -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include/QtSql -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/include/QtCore -I.moc -isystem /usr/include/mysql -I/opt/Qt/Qt5.10.0/5.10.0/gcc_64/mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
qsql_mysql.cpp:235:9: error: ‘my_bool’ does not name a type; did you mean ‘_Bool’?
my_bool nullIndicator;
^~~~~~~
_Bool
qsql_mysql.cpp: In constructor ‘QMYSQLResultPrivate::QMyField::QMyField()’:
qsql_mysql.cpp:231:28: error: class ‘QMYSQLResultPrivate::QMyField’ does not have any field named ‘nullIndicator’
: outField(0), nullIndicator(false), bufLength(0ul),
^~~~~~~~~~~~~
qsql_mysql.cpp: In member function ‘bool QMYSQLResultPrivate::bindInValues()’:
qsql_mysql.cpp:430:28: error: ‘struct QMYSQLResultPrivate::QMyField’ has no member named ‘nullIndicator’
bind->is_null = &f.nullIndicator;
^~~~~~~~~~~~~
qsql_mysql.cpp: In member function ‘virtual QVariant QMYSQLResult::data(int)’:
qsql_mysql.cpp:641:15: error: ‘const struct QMYSQLResultPrivate::QMyField’ has no member named ‘nullIndicator’
if (f.nullIndicator)
^~~~~~~~~~~~~
qsql_mysql.cpp: In member function ‘virtual bool QMYSQLResult::isNull(int)’:
qsql_mysql.cpp:734:35: error: ‘const struct QMYSQLResultPrivate::QMyField’ has no member named ‘nullIndicator’
return d->fields.at(field).nullIndicator;
^~~~~~~~~~~~~
qsql_mysql.cpp: In member function ‘virtual bool QMYSQLResult::exec()’:
qsql_mysql.cpp:987:13: error: ‘my_bool’ was not declared in this scope
QVector<my_bool> nullVector;
^~~~~~~
qsql_mysql.cpp:987:13: note: suggested alternative: ‘_Bool’
QVector<my_bool> nullVector;
^~~~~~~
_Bool
qsql_mysql.cpp:987:20: error: template argument 1 is invalid
QVector<my_bool> nullVector;
^
qsql_mysql.cpp:1001:20: error: request for member ‘resize’ in ‘nullVector’, which is of non-class type ‘int’
nullVector.resize(values.count());
^~~~~~
qsql_mysql.cpp:1008:25: error: invalid types ‘int[int]’ for array subscript
nullVector[i] = static_cast<my_bool>(val.isNull());
^
qsql_mysql.cpp:1008:41: error: ‘my_bool’ does not name a type; did you mean ‘_Bool’?
nullVector[i] = static_cast<my_bool>(val.isNull());
^~~~~~~
_Bool
qsql_mysql.cpp:1009:46: error: invalid types ‘int[int]’ for array subscript
currBind->is_null = &nullVector[i];
^
qsql_mysql.cpp:1105:17: error: expected ‘;’ before ‘update_max_length’
my_bool update_max_length = true;
^~~~~~~~~~~~~~~~~
qsql_mysql.cpp:1114:72: error: ‘update_max_length’ was not declared in this scope
mysql_stmt_attr_set(d->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &update_max_length);
^~~~~~~~~~~~~~~~~
qsql_mysql.cpp: In member function ‘virtual bool QMYSQLDriver::open(const QString&, const QString&, const QString&, const QString&, int, const QString&)’:
qsql_mysql.cpp:1316:5: error: ‘my_bool’ was not declared in this scope
my_bool reconnect=false;
^~~~~~~
qsql_mysql.cpp:1316:5: note: suggested alternative: ‘_Bool’
my_bool reconnect=false;
^~~~~~~
_Bool
qsql_mysql.cpp:1334:21: error: ‘reconnect’ was not declared in this scope
reconnect = true;
^~~~~~~~~
qsql_mysql.cpp:1334:21: note: suggested alternative: ‘connect’
reconnect = true;
^~~~~~~~~
connect
qsql_mysql.cpp:1415:13: error: ‘reconnect’ was not declared in this scope
if (reconnect)
^~~~~~~~~
qsql_mysql.cpp:1415:13: note: suggested alternative: ‘connect’
if (reconnect)
^~~~~~~~~
connect
make: *** [Makefile:806: .obj/qsql_mysql.o] Error 1
Seriously i've been using Qt for some years now and never before did i faced this problem when setting up the MySQL drivers. And whats odd is that now the machine is updated with all the latest versions.
Please let me know how can i solve this. Been searching all over the internet for nearly a week now, but no solution for this error. Everything i tried always ends up with the error
qsql_mysql.cpp:235:9: error: ‘my_bool’ does not name a type; did you mean ‘_Bool’?