how to connect mysql and Qt 5.12 and building QMYSQL driver & make them loaded, get rid of error '-Wdate-time'
I have centos 7 in one client as VM with MySQL client and mysql server in second VM. In client I've installed Qt 5.12. To install MySQL sqldriver fire this command
[root@C-Client mysql]# /opt/Qt5.12.12/5.12.12/gcc_64/bin/qmake -- MYSQL_INCDIR=/usr/include/mysql -- MYSQL_LIBDIR=/usr/lib64/mysql/ -lrt -ldl -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto mysql.pro
but unfortunetly it showed me following error :-
"g++: error: unrecognized command line option ‘-Wdate-time’"
as here :-
[root@C-Client mysql]# make
g++ -c -pipe -O2 -g -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -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/Qt5.12.12/5.12.12/gcc_64/include/QtSql/5.12.12 -I/opt/Qt5.12.12/5.12.12/gcc_64/include/QtSql/5.12.12/QtSql -I/opt/Qt5.12.12/5.12.12/gcc_64/include/QtCore/5.12.12 -I/opt/Qt5.12.12/5.12.12/gcc_64/include/QtCore/5.12.12/QtCore -I/opt/Qt5.12.12/5.12.12/gcc_64/include -I/opt/Qt5.12.12/5.12.12/gcc_64/include/QtSql -I/opt/Qt5.12.12/5.12.12/gcc_64/include/QtCore -I.moc -isystem /usr/include/mysql -I/home/qt/openssl-1.1.1k/include -I/opt/Qt5.12.12/5.12.12/gcc_64/mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
g++: error: unrecognized command line option ‘-Wdate-time’
make: *** [.obj/qsql_mysql.o] Error 1
Now to recover this, do this :-
go to installation dir as mine is : "/opt/Qt5.12.12/5.12.12/Src/qtbase/src/plugins/sqldrivers/mysql". fire following command :
# chmod 777 Makefile
# gedit Makefile
search for "-Wdate-time" by Pressing Ctrl + f. There will be two places by this search. delete "-Wdate-time" on both places, save & close file Makefile. Re-run make command as :-
# make
Now this will give you no error. Then install plugin as :-
# make install
this copies binary sql-driver in to appropriate dir in Qt folder automatically.
# make clean
last line to clean binaries generated during process.
now your plugin is installed. Test it as you want.
No comments:
Post a Comment