QMSQL : Cannot mix incompatible Qt library (version 0x50b03) with this library (version 0x50c05) - mysql

I'm trying to use a MySQL database in a QT application. For this I needed to build the MySQL manually and nothing went as planned at all.
Using:
Qt 5.12.5
g++ 8.3.0
Make 4.2.1
MySQL 15.1
Debian 10.1
I first tried to follow this guide: https://doc.qt.io/qt-5/sql-driver.html but qmake wouldn't detect MySQL headers.
After searching the internet I found out somebody managed to work things out by building directly the driver.
I went in ~/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/mysql and ran :
qmake qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/x86_64-linux-gnu/ -lmysqlclient_r"
It didn't work :
Project ERROR: Library 'mysql' is not defined.
After some googling, I changed the mysql.pro file to this one:
TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
OTHER_FILES += mysql.json
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
include(../qsqldriverbase.pri)
It worked, for now. Next step, running make ! Guess what? Didn't work either.
/usr/include/c++/8/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
ran qmake again without "INCLUDEPATH [...]", now I was missing mysql.h. I added manually the path to it to the Makefile. It worked.
I tried running my QT app again, still no MySQL driver.
Turned out the newly built driver was not copied in the right directory with the other ones. So I copied in Qt/5.12.5/gcc_64/plugins/sqldrivers.
Now it seems my plugin is indeed recognized by Qt but it just crashes with this error :
Cannot mix incompatible Qt library (version 0x50b03) with this library (version 0x50c05)
I don't know what to do next, can't find anything useful for this case on the internet...
Help, please?

Turned out I had another version Qt installed on my system. I don't where it came from but this issue is now solved.

Related

Octave Psychtoolbox can't find Screen.mex despite being first directory in path

I have attempted to install Psychtoolbox for Octave on Windows 10, per the installation instructions. Before the installation completes, I get this warning:
Screen() failed to work for some reason:
Check the troubleshooting instructions on our Wiki (Download section
and FAQ section, maybe also the Bugs section).
You may need to delete (or rename) the following DLL files in your Octave-4.4.1 installations
bin folder to make this work, then restart Octave:
C:\Octave\4.4.1\bin\libglib-2.0.0.dll
C:\Octave\4.4.1\bin\libgmodule-2.0.0.dll
C:\Octave\4.4.1\bin\opengl32.dll
Once you manage to fix the problem (simply type 'AssertOpenGL' to verify
that stuff works now), you do not need to run the installation routine again,
but can start working immediately.
I had already deleted the named DLL files, which I confirmed. I then ran AssertOpenGL and received this error:
Last Error: could not find library or dependencies: D:\Coding\PTB\Psychtoolbox\PsychBasic\Octave4WindowsFiles64\Screen.mex
Simply calling Screen directly gives this error:
error: library open failed: D:\Coding\PTB\Psychtoolbox\PsychBasic\Octave4WindowsFiles64\Screen.mex
However, the directory containing Screen.mex is at the very top of my path:
Octave's search path contains the following directories:
.
D:\Coding\PTB\Psychtoolbox\PsychBasic\Octave4WindowsFiles64
D:\Coding\PTB\Psychtoolbox
<etc>
As such, the solution to this similar question is of no use. What might I be able to do to correctly configure PTB on Octave?
What version of gstreamer are you using? I had a similar problem recently and fixed it by installing gstreamer 1.14.4. The latest version of gstreamer will not work, nor will versions earlier than 1.14.4.

Linking errors while building VTK

I am trying to build ITKapps. I am using ITK 4.7., ITKapps 4.7. FLTK 1.1.3.
Some applications build ok, there is .exe and I can run them.
While building applications which use VTK always linking errors appears: cannot find vtkRendering.lib or vtkRenderingOpenGL.lib...
Problem is that I cant build VTK either. While building VTK there are also linking errors:
Error 3808 error LNK1104: cannot open file '......\bin\Debug\vtkRendering.lib'
I tried VTK 4.x and 5.x.. and not one version builds successfull.
VTK 6.x builds ok but building ITKapps still have linking errors.(i don't think ITKapps works with VTK 6.x) so i must use version 4 or 5.
Maybe someone have idea what am I doing wrong or some sugestions?
I had the same error, error LNK1104: cannot open file '......\bin\Debug\vtkRendering.lib' while trying to build VTK in VS 2012. In Cmake I changed the VTK_RENDERING_BACKEND value from OpenGL to OpenGL2 and later the build succeeded in VS.

MySQL Driver not loaded on Qt

Trying to connect to MySQL using
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
gives me the
Driver not loaded error
Reading the other questions and answers did not help me because they have qt4 instead of 5 that I am using, and they had to build the drivers themselves. I do have the drivers though
And I also did load the path in the pro file here
So why is this happening? Should I try and compile the drivers myself as suggested in some other questions?
EDIT
I also did make sure to use MySQL 32bit.
In Debug Mode on development machine the Qt-Framework Installation is enough.
In Release Mode you will have to provide the required driver in the sqldrivers-folder located in your working directory: $(wcd)/sqldrivers/*
Edit:
Check output of: QSqlDatabase::drivers () Eventually rebuild sql drivers for your system using $QTDIR/src/plugins/sqldrivers/mysql/mysql.pro.
Also try adding mysql-client-library to your working directory directly or setting up a library path to look for. It is not enough to add INCLUDEPATH / LIB in pro file, since this is for compile/link time only. During runtime the executable looks in the known places (typical windows: $WINDIR/system32/;$PATH;...)

MySQL++ Application error at launch

I compiled MySQL++ with no issues. When I launched some of the executables (resetdb.exe and simple1.exe) they suggest to run to test if the installation has been successful, the first error I got was that libmysql.dll was missing.
Adding its path to the PATH environment variable did not fix the problem, even after launching a new command prompt; I had to copy the DLL in the directory where MySQL++ executables are.
Now the DLL is found, but I get this error:
simple1.exe - Application error
The application was unable to start correctly (0xc000007b).
Click OK to close the application.
even launching from the command line, I get no more information than these.
Thank you for any help!
MySQL 5.5 -
MySQL++ 3.0.9 -
Windows 7 64 bits -
MINGW32 -
GCC 4.4.0
0xC000007B is a Windows error that means the executable is corrupted. It could refer either to simple1.exe or to one of the DLLs it's linking against.
Some reasons this could happen:
You're mixing toolchains in an incompatible way. In your case, you may have built simple1.exe using pieces built by MinGW GCC and pieces built by Visual C++. MinGW should be compatible with any pure C DLL built by Visual C++, including the MySQL C API DLL. However, you may have other pieces interfering. MinGW isn't compatible with VC++ at the C++ level, but then, it shouldn't have linked at all if this were your problem.
You didn't follow the MySQL C API import library build steps in README-MinGW.txt. You either missed a step, or skipped it entirely and are trying to use the import library that shipped with MySQL.
In your previous gyrations, you ended up with a corrupt object file, which got linked in. Try saying make clean all at the top level of MySQL++ to force a complete rebuild.
You're mixing versions of MySQL or MySQL++. If you have more than one version of each on the system, make sure you're consistent in their use. That is, build the C API import library from the same DLL you run the programs against, use exrun.bat to run the examples to ensure you're using the just-built version of the MySQL++ DLL instead of another you have in your PATH, etc.
Additionally, I note that you're using an older version of MySQL++. If you were on Linux, I could understand that as some distributions still ship with 3.0.9. But since you have to build MySQL++ from source with MinGW, I don't see why you're not using 3.1.0. Did you get a binary build from somewhere?
As for your PATH problem, did you restart the MinGW shell after doing this? PATH updates don't affect running programs; they keep the value they saw when they started.

Qt windows libmysql.dll

I have installed MySQL 5.1.49 and the binary QT 4.6.2 for Visual Studio 2008. I configured Qt as follow:
C:\Qt>configure -static -no-webkit -plugin-sql-sqlite -plugin-sql-mysql -I C:\mysql\include -L C:\mysql\lib\optC:\Qt\src\plugins\sqldriver
Everything went fine, no errors. When I run nmake on my application everything runs fine, no errors as well. However when I execute my application under the debug folder I get a popup saying "Driver not loaded" (I have QT += sql under my project.pro)
If I goto C:\Qt\plugins\sqldrivers I dont see any libmysql, or any *mysql.dll only qsqlmysql.obj and qsqlmysqld.obj (there are files such as: qsqlite4.dll, qsqlpsql4.dll etc.)
I did try to build it manually by doing:
cd %QTDIR%\src\plugins\sqldrivers\mysql
C:\Qt\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\mysql\include" "LIBS+=C:\mysql\lib\opt\libmysql.lib" mysql.pro
nmake
Everything compiles fine, no errors. However, I still don't find any libmysql.dll generated. Only file found is under C:\mysql\bin\libmySQL.dll
I have all the includes for MySQL under C:\mysql\include and the libraries under C:\mysql\lib\opt
Any ideas what could be the problem? Thanks
Using -static prevents you from using plugins at runtime. You will need to change
-plugin-sql-mysql
to
-qt-sql-mysql
and have it compiled in.
B1.
Have you tried using qt source instead of the binary one? I had a similar issue, however I was getting compile errors.