QMYSQL driver not loaded on Ubuntu
-
Do you also have the dev package installed ?
-
here :
root@Gigabyte-Z68P-DS3:~# dpkg --get-selections | grep dev
comerr-dev install
dpkg-dev install
freeglut3-dev:amd64 install
gir1.2-gudev-1.0 install
krb5-multidev install
libalut-dev install
libasprintf-dev:amd64 install
libboost1.53-dev:amd64 install
libc-dev-bin install
libc6-dev:amd64 install
libdevmapper-event1.02.1:amd64 install
libdevmapper1.02.1:amd64 install
libdrm-dev:amd64 install
libfreetype6-dev install
libgcc-4.8-dev:amd64 install
libgettextpo-dev:amd64 install
libgfortran-4.8-dev:amd64 install
libgl1-mesa-dev install
libgl2ps-dev install
libglu1-mesa-dev install
libgudev-1.0-0:amd64 install
libice-dev:amd64 install
libimobiledevice4 install
libkrb5-dev install
libmtdev1:amd64 install
libmysql++-dev install
libmysqlclient-dev install
libmysqlcppconn-dev install
libopenal-dev:amd64 install
libpcre3-dev:amd64 install
libpthread-stubs0-dev:amd64 install
libroot-core-dev install
libroot-geom-dev install
libroot-graf2d-gpad-dev install
libroot-graf2d-graf-dev install
libroot-graf3d-gl-dev install
libroot-gui-dev install
libroot-hist-dev install
libroot-io-dev install
libroot-math-mathcore-dev install
libroot-math-matrix-dev install
libroot-net-dev install
libroot-proof-dev install
libroot-tree-dev install
libsm-dev:amd64 install
libssl-dev:amd64 install
libstdc++-4.8-dev:amd64 install
libudev1:amd64 install
libudev1:i386 install
libv4l-dev:amd64 install
libx11-dev:amd64 install
libx11-xcb-dev install
libxau-dev:amd64 install
libxcb-dri2-0-dev:amd64 install
libxcb-glx0-dev:amd64 install
libxcb1-dev:amd64 install
libxdamage-dev:amd64 install
libxdmcp-dev:amd64 install
libxext-dev:amd64 install
libxfixes-dev:amd64 install
libxpm-dev:amd64 install
libxt-dev:amd64 install
libxxf86vm-dev:amd64 install
linux-libc-dev:amd64 install
makedev install
manpages-dev install
mesa-common-dev install
python-dbus-dev install
system-config-printer-udev install
udev install
unity-scope-devhelp install
x11proto-core-dev install
x11proto-damage-dev install
x11proto-dri2-dev install
x11proto-fixes-dev install
x11proto-gl-dev install
x11proto-input-dev install
x11proto-kb-dev install
x11proto-xext-dev install
x11proto-xf86vidmode-dev install
xserver-xorg-input-evdev install
xserver-xorg-video-fbdev install
xtrans-dev install
zlib1g-dev:amd64 install
root@Gigabyte-Z68P-DS3:~# -
I don't see any Qt related dev package
-
How can I install Qt related dev package ?
-
IIRC you can install qt5-default then the same qt5 packages with a trailing -dev in the name
-
See now i installed qt dev package :
...
...
qtbase5-dev:amd64 install
qtbase5-dev-tools install
qtdeclarative5-dev installCheck latest lines...
root@Gigabyte-Z68P-DS3:~# aptitude show qt5-default
Package: qt5-default
State: installed
Automatically installed: no
Multi-Arch: same
Version: 5.0.2+dfsg1-7ubuntu11.1
Priority: optional
Section: libs
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Uncompressed Size: 93.2 k
Depends: qtbase5-dev, qtchooser
Suggests: qt5-qmake, qtbase5-dev-tools
Conflicts: qt4-default, qt4-default
Breaks: qt5-default (!= 5.0.2+dfsg1-7ubuntu11.1)
Replaces: qt5-default (< 5.0.2+dfsg1-7ubuntu11.1)
Provides: qt-default
Description: Qt 5 development defaults package
Qt is a cross-platform C++ application framework. Qt's primary feature is its rich set of widgets
that provide standard GUI functionality.This package sets Qt 5 to be the default Qt version to be used when using development binaries like
qmake. It provides a default configuration for qtchooser, but does not prevent alternative Qt
installations from being used.
Homepage: http://qt-project.org/root@Gigabyte-Z68P-DS3:~# dpkg --get-selections | grep dev
comerr-dev install
dpkg-dev install
freeglut3-dev:amd64 install
gir1.2-gudev-1.0 install
krb5-multidev install
libalut-dev install
libasprintf-dev:amd64 install
libboost1.53-dev:amd64 install
libc-dev-bin install
libc6-dev:amd64 install
libdevmapper-event1.02.1:amd64 install
libdevmapper1.02.1:amd64 install
libdrm-dev:amd64 install
libfreetype6-dev install
libgcc-4.8-dev:amd64 install
libgettextpo-dev:amd64 install
libgfortran-4.8-dev:amd64 install
libgl1-mesa-dev install
libgl2ps-dev install
libglu1-mesa-dev install
libgudev-1.0-0:amd64 install
libice-dev:amd64 install
libimobiledevice4 install
libkrb5-dev install
libmtdev1:amd64 install
libmysql++-dev install
libmysqlclient-dev install
libmysqlcppconn-dev install
libopenal-dev:amd64 install
libpcre3-dev:amd64 install
libpthread-stubs0-dev:amd64 install
libqt5opengl5-dev:amd64 install
libroot-core-dev install
libroot-geom-dev install
libroot-graf2d-gpad-dev install
libroot-graf2d-graf-dev install
libroot-graf3d-gl-dev install
libroot-gui-dev install
libroot-hist-dev install
libroot-io-dev install
libroot-math-mathcore-dev install
libroot-math-matrix-dev install
libroot-net-dev install
libroot-proof-dev install
libroot-tree-dev install
libsm-dev:amd64 install
libssl-dev:amd64 install
libstdc++-4.8-dev:amd64 install
libudev1:amd64 install
libudev1:i386 install
libv4l-dev:amd64 install
libx11-dev:amd64 install
libx11-xcb-dev install
libxau-dev:amd64 install
libxcb-dri2-0-dev:amd64 install
libxcb-glx0-dev:amd64 install
libxcb1-dev:amd64 install
libxdamage-dev:amd64 install
libxdmcp-dev:amd64 install
libxext-dev:amd64 install
libxfixes-dev:amd64 install
libxpm-dev:amd64 install
libxt-dev:amd64 install
libxxf86vm-dev:amd64 install
linux-libc-dev:amd64 install
makedev install
manpages-dev install
mesa-common-dev install
python-dbus-dev install
qtbase5-dev:amd64 install
qtbase5-dev-tools install
qtdeclarative5-dev install
system-config-printer-udev install
udev install
unity-scope-devhelp install
x11proto-core-dev install
x11proto-damage-dev install
x11proto-dri2-dev install
x11proto-fixes-dev install
x11proto-gl-dev install
x11proto-input-dev install
x11proto-kb-dev install
x11proto-xext-dev install
x11proto-xf86vidmode-dev install
xserver-xorg-input-evdev install
xserver-xorg-video-fbdev install
xtrans-dev install
zlib1g-dev:amd64 install
root@Gigabyte-Z68P-DS3:~# -
Did you retry to run qmake now ?
-
[quote author="SGaist" date="1389256104"]Did you retry to run qmake now ?[/quote]
Ok...
Yes... please see again an error:
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
Project ERROR: addExclusiveBuilds() requires at least two arguments
-
Since you installed Qt 5.2 Why didn't you use the qmake from that Qt rather than the one from the system ?
-
Well , I want to build mysql plugin for Qt 5.2 !
I get error message : QMySQL driver not found loaded.I try test with a minimal code :
Main :
@
#include <QCoreApplication>
#include <QtSql/QSqlDatabase>
#include <QtSql>
#include <QDebug>//remplacer l'affichage par la commande cout
#define q2c(string) string.toStdString()int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("qtdatabase"); db.setUserName("root"); db.setPassword(""); bool ok = db.open(); return a.exec();
}
@
and .pro :
@
#-------------------------------------------------Project created by QtCreator 2014-01-01T09:22:46
#-------------------------------------------------
QT += core
QT += sql
QT -= guiTARGET = untitled18
CONFIG += console
CONFIG -= app_bundleQTPLUGIN += qsqlmysql
TEMPLATE = appSOURCES += main.cpp
@
-
Then use /opt/Qt5.2.0/path_to_bin/qmake to configure the plugin project
-
[quote author="SGaist" date="1389260673"]Then use /opt/Qt5.2.0/path_to_bin/qmake to configure the plugin project[/quote]
I don't understand can you give me true and full command ? please :)
-
rather that calling just qmake like you already did in the plugin folder, use the full path to /opt/Qt5.2.0/whatever_is_needed/bin/qmake and you should be good
-
I have this path /opt/Qt5.2.0/5.2.0/gcc_64/bin/(qmake)
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
Project ERROR: addExclusiveBuilds() requires at least two arguments
I think my path is not true :( In Qt 4 i can build but in Qt 5.2 anything is different.
-
use the full path:
@
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# /opt/Qt5.2.0/5.2.0/gcc_64/bin/qmake “INCLUDEPATH+=/usr/include/mysql” “LIBS+=-L/usr/lib/mysql -lmysqlclient_r” mysql.pro
@ -
Sorry but gives follow message :
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# /opt/Qt5.2.0/5.2.0/gcc_64/bin/qmake “INCLUDEPATH+=/usr/include/mysql” “LIBS+=-L/usr/lib/mysql -lmysqlclient_r” mysql.pro
***Unknown option -lmysqlclient_r”
Usage: /opt/Qt5.2.0/5.2.0/gcc_64/bin/qmake [mode] [options] [files]QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing projectMode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *; *; *; *.ts; *.xlf; *.qrc
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directoryWarnings Options:
-Wnone Turn off all warnings; specific ones may be re-enabled by
later -W options
-Wall Turn on all warnings
-Wparser Turn on parser warnings
-Wlogic Turn on logic warnings (on by default)
-Wdeprecated Turn on deprecation warnings (on by default)Options:
- You can place any variable assignment in options and it will be *
- processed as if it was in [files]. These assignments will be parsed *
- before [files]. *
-o file Write output to file
-d Increase debug level
-t templ Overrides TEMPLATE as templ
-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
-help This help
-v Version information
-after All variable assignments after this will be
parsed after [files]
-norecursive Don't do a recursive search
-recursive Do a recursive search
-set <prop> <value> Set persistent property
-unset <prop> Unset persistent property
-query <prop> Query persistent property. Show all if <prop> is empty.
-cache file Use file as cache [makefile mode only]
-spec spec Use spec as QMAKESPEC [makefile mode only]
-nocache Don't use a cache file [makefile mode only]
-nodepend Don't generate dependencies [makefile mode only]
-nomoc Don't generate moc targets [makefile mode only]
-nopwd Don't look for files in pwd [project mode only]
-
remove -lmysqlclient_r
-
Yes , Solved !
Thank you dear :) -
You're welcome !
Now that you have the plugin, can you please update the thread title prepending [solved] so other forum users may know a solution has been found :)