[SOLVED]Unable to deploy under Linux (MySQL plugin issue)
-
BTW, qsqldriver_p.h isn't missing but qsql_mysql.pri couldn't find it
hpctech-work@hpctech-work ~ $ ls ~/.Qt/5.5/Src/qtbase/include/QtSql/5.5.1/QtSql/private/ qsqlcachedresult_p.h qsqldriver_p.h qsql_mysql_p.h qsql_oci_p.h qsql_psql_p.h qsqlresult_p.h qsql_sqlite_p.h qsql_tds_p.h qsql_db2_p.h qsql_ibase_p.h qsqlnulldriver_p.h qsql_odbc_p.h qsqlquerymodel_p.h qsql_sqlite2_p.h qsqltablemodel_p.h hpctech-work@hpctech-work ~ $
-
You're in the wrong folder, it's
src/plugins/sqldrivers/mysql
-
@SGaist said:
You're in the wrong folder, it's
src/plugins/sqldrivers/mysql
Yep. I found the right path which is
~/.Qt/5.5/Src/qtbase/plugins/sqldrivers
thanks @SGaistAny way, my problem still exists & became much worst because it occurs too when I run my app using Qt Creator although I re-built libqsqlmysql.so successfully!
hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ ~/.Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ make rm -f libqsqlmysql.so g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64 -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64 -Wl,-rpath,/home/hpctech-work/.Qt/5.5/gcc_64/lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o -L/usr/local/lib -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto -L/home/hpctech-work/.Qt/5.5/gcc_64/lib -lQt5Sql -lQt5Core -lpthread mv -f libqsqlmysql.so ../../../../plugins/sqldrivers/ hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/src/plugins/sqldrivers/mysql $ cd ../../../../plugins/sqldrivers/ hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ cp libqsqlmysql.so /home/hpctech-work/.Qt/5.5/gcc_64/plugins/sqldrivers/ hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $ ldd ~/.Qt/5.5/gcc_64/plugins/sqldrivers/libqsqlmysql.so linux-vdso.so.1 => (0x00007fffcf1fe000) libmysqlclient.so.18 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 (0x00007fe886488000) libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007fe886247000) libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007fe885b01000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe8857fd000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe885438000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe88521e000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe88501a000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe884dfc000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe884af5000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe8848df000) libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicui18n.so.54 (0x00007fe884471000) libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicuuc.so.54 (0x00007fe8840c2000) libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicudata.so.54 (0x00007fe882698000) libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fe882496000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe88228d000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fe881f85000) /lib64/ld-linux-x86-64.so.2 (0x00007fe886bfe000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe881d46000) hpctech-work@hpctech-work ~/.Qt/5.5/Src/qtbase/plugins/sqldrivers $
-
As attempting for fixing this issue. I copied
sqldrivers
folder to app path but it didn't fix the issue because my app & Qt Creator still showQMYSQL driver not loaded
hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $ ls -Rl .: total 2116 -rwxr-xr-x 1 hpctech-work hpctech-work 667329 Oct 24 08:34 AndroidMysqlClient -rw-r--r-- 1 hpctech-work hpctech-work 822872 Oct 24 08:34 dialog.o -rw-r--r-- 1 hpctech-work hpctech-work 247752 Oct 24 08:34 main.o -rw-r--r-- 1 hpctech-work hpctech-work 58758 Oct 24 08:34 Makefile -rw-r--r-- 1 hpctech-work hpctech-work 3306 Oct 24 08:34 moc_dialog.cpp -rw-r--r-- 1 hpctech-work hpctech-work 291496 Oct 24 08:34 moc_dialog.o drwxr-xr-x 2 hpctech-work hpctech-work 4096 Oct 24 08:46 sqldrivers -rw-r--r-- 1 hpctech-work hpctech-work 2995 Oct 24 08:34 ui_dialog.h ./sqldrivers: total 1020 -rwxr-xr-x 1 hpctech-work hpctech-work 838064 Oct 13 11:14 libqsqlite.so -rwxr-xr-x 1 hpctech-work hpctech-work 98222 Oct 24 08:12 libqsqlmysql.so -rwxr-xr-x 1 hpctech-work hpctech-work 79248 Oct 13 11:14 libqsqlpsql.so hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $ ldd AndroidMysqlClient linux-vdso.so.1 => (0x00007fff6b3fe000) libQt5Widgets.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Widgets.so.5 (0x00007f71dd56e000) libQt5Sql.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007f71dd32d000) libQt5Core.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007f71dcbe7000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f71dc8b9000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f71dc6a2000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f71dc2dd000) libQt5Gui.so.5 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libQt5Gui.so.5 (0x00007f71dbacb000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f71db8ac000) libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f71db65b000) libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f71db459000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f71db250000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f71daf48000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f71dad36000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f71daa00000) libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f71da79a000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f71da494000) libicui18n.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicui18n.so.54 (0x00007f71da025000) libicuuc.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicuuc.so.54 (0x00007f71d9c77000) libicudata.so.54 => /home/hpctech-work/.Qt/5.5/gcc_64/lib/libicudata.so.54 (0x00007f71d824d000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f71d8048000) /lib64/ld-linux-x86-64.so.2 (0x00007f71dddef000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f71d7e40000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f71d7c01000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f71d79e2000) libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f71d77bb000) libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f71d75b7000) libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f71d73b1000) libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f71d71af000) libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f71d6f97000) libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f71d6d92000) libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f71d6b8f000) libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f71d698b000) libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f71d6785000) libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f71d6583000) libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f71d637c000) libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f71d6170000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f71d5f6b000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f71d5d65000) hpctech-work@hpctech-work ~/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug $
-
Moving the folder beside your application won't help on linux unless you modify the environment a bit so they can be found. But since you have the sql plugin built and in place, you should print the value of lastError to get more information.
-
@SGaist said:
Moving the folder beside your application won't help on linux unless you modify the environment a bit so they can be found.
How can I do that?
But since you have the sql plugin built and in place, you should print the value of lastError to get more information.
Print out the result of lastError() but I got nothing more than I get before see the snippet please:
void Dialog::on_pushButton_connect_clicked() { QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("mysql"); db.setUserName("root"); db.setPassword("root"); if (!db.open()) { ui->plainTextEdit_log->setPlainText(db.lastError().text()); ui->plainTextEdit_log->appendPlainText(QString("----\nPaths\n----\n%1").arg(qApp->libraryPaths().join("\n"))); } }
The result was:
Driver not loaded Driver not loaded ---- Paths ---- /home/hpctech-work/.Qt/5.5/gcc_64/plugins /home/hpctech-work/Snippets/C++ Qt/build-AndroidMysqlClient-Desktop_Qt_5_5_1_GCC_64bit-Debug
-
Can you run your application QT_DEBUG_PLUGINS set to 1 ? That should give some additional pointers as to why it doesn't load the plugin.
-
You are missing the openssl libraries
-
@SGaist said:
You are missing the openssl libraries
It's not related to my issue because it points to "libqsqlmysql.so" which is not needed in my application (the needed one is libqsqlmysql.so)
Any way, I fixed the problem (thanks to Hamish Moffatt from Qt mailing list) by removing "libqsqlmysql.so" (the old plugin original file shipped by Qt Installer) outside sqldrivers folder