Problems building mysql plugin on Windows for Qt 6.1.2
-
wrote on 6 Aug 2021, 15:44 last edited by
Hi, im having a hard time trying to build the mysql plugin for qt... first thing i tried was to follow the documentation https://doc.qt.io/qt-5/sql-driver.html , the problem starts with my prompt input (i've tried to use qt msvc command line, vcvarsall etc...):
qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Server 8.0\lib"
This qmake line gives me exactly nothing as an error it just doesnt execute and instead it links all the options available for qmake (like a -help).
nmake sub-mysql nmake install
And these 2 lines above just give an error saying that nmake doesnt know how to create: 'sub-mysql' and 'install'.
I just dont know what to do from now on, any help is appreaciated.
Thanks in advance.Obs: i've already tried reinstalling qt and downloading resources directly from github. What i noticed reading some post about similar problems was people mentioning mysql.pro and sqldrivers.pro and i dont have those in my qt 6.1.2/6.1.0 installed versions
-
wrote on 6 Aug 2021, 15:57 last edited by
Can you post what the output is from your qmake command? There may be some text explaining what it doesn't like in addition to listing all of its options.
-
Hi
Also for Qt 6, it seems to use configure.bat and not qmake
https://doc.qt.io/qt-6/sql-driver.html -
wrote on 6 Aug 2021, 16:09 last edited by
Hello guys, thank you for your time, as @mrjj said i just noticed that i was using the wrong documentation and tried to build it with the configure.bat and now i got the following errors:
D:\Qt\6.1.2\Src>configure.bat -sql-mysql -- -DCMAKE_INCLUDE_PATH="C:\Program Files\MySQL\MySQL Server 8.0\include" -DCMAKE_LIBRARY_PATH="C:\Program Files\MySQL\MySQL Server 8.0\lib" + cd qtbase + D:\Qt\6.1.2\Src\qtbase\configure.bat -top-level -sql-mysql -- -DCMAKE_INCLUDE_PATH="C:\Program Files\MySQL\MySQL Server 8.0\include" -DCMAKE_LIBRARY_PATH="C:\Program Files\MySQL\MySQL Server 8.0\lib" 'C:/Program Files/CMake/bin/cmake.exe' '-DCMAKE_INCLUDE_PATH=C:\Program Files\MySQL\MySQL Server 8.0\include' '-DCMAKE_LIBRARY_PATH=C:\Program Files\MySQL\MySQL Server 8.0\lib' '-DINPUT_sql_mysql=yes' '-G' 'Ninja' 'D:/Qt/6.1.2/Src' -- The CXX compiler identification is MSVC 19.29.30038.1 -- The C compiler identification is MSVC 19.29.30038.1 -- The ASM compiler identification is MSVC -- Found assembler: D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe -- Check for working CXX compiler: D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - broken CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:62 (message): The C++ compiler "D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: D:/Qt/6.1.2/Src/CMakeFiles/CMakeTmp Run Build Command(s):C:/Ninja/ninja.exe cmTC_2283f && [1/2] Building CXX object CMakeFiles\cmTC_2283f.dir\testCXXCompiler.cxx.obj [2/2] Linking CXX executable cmTC_2283f.exe FAILED: cmTC_2283f.exe cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_2283f.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- D:\VisualStudio2019\VC\Tools\MSVC\14.29.30037\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_2283f.dir\testCXXCompiler.cxx.obj /out:cmTC_2283f.exe /implib:cmTC_2283f.lib /pdb:cmTC_2283f.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." RC Pass 1: command "rc /fo CMakeFiles\cmTC_2283f.dir/manifest.res CMakeFiles\cmTC_2283f.dir/manifest.rc" failed (exit code 0) with the following output: O sistema não pode encontrar o arquivo especificado ninja: build stopped: subcommand failed. -- Configuring incomplete, errors occurred! CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:11 (project) See also "D:/Qt/6.1.2/Src/CMakeFiles/CMakeOutput.log". See also "D:/Qt/6.1.2/Src/CMakeFiles/CMakeError.log". CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:828 (message): CMake exited with code 1.
-
wrote on 6 Aug 2021, 16:53 last edited by
So... i figured out what the previous error was related to, but now i'm getting a Qt6config.cmake file error, this is what im getting from CMD:
CMake Error at CMakeLists.txt:13 (find_package): Could not find a configuration file for package "Qt6" that is compatible with requested version "6.1.0". The following configuration files were considered but not accepted: D:/Qt/6.1.2/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.1.2 (64bit) D:/Qt/6.1.0/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.1.0 (64bit)
Any ideas on whats happening?
-
So... i figured out what the previous error was related to, but now i'm getting a Qt6config.cmake file error, this is what im getting from CMD:
CMake Error at CMakeLists.txt:13 (find_package): Could not find a configuration file for package "Qt6" that is compatible with requested version "6.1.0". The following configuration files were considered but not accepted: D:/Qt/6.1.2/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.1.2 (64bit) D:/Qt/6.1.0/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.1.0 (64bit)
Any ideas on whats happening?
@Marcusdrl
Hi
Not really as im not sure why
D:/Qt/6.1.0/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.1.0 (64bit)
was not accepted as seems to match the version.Maybe if we are lucky Mr @Christian-Ehrlicher comes online soon as he is cmake expert if i ever saw one :)
-
Are you sure you call it from the correct command prompt (64 bit msvc)?
-
Are you sure you call it from the correct command prompt (64 bit msvc)?
wrote on 6 Aug 2021, 17:49 last edited by@Christian-Ehrlicher i checked it, and i wasnt actually... now that i used it i got the same error above related to cl.exe:
-- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe -- Check for working CXX compiler: D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - broken CMake Error at C:/Program Files/CMake/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:62 (message): The C++ compiler "D:/VisualStudio2019/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: D:/Qt/6.1.0/Src/qtbase/src/plugins/sqldrivers/build-sqldrivers/CMakeFiles/CMakeTmp Run Build Command(s):C:/Ninja/ninja.exe cmTC_a04d9 && CreateProcess failed. Command attempted: "D:\VisualStudio2019\VC\Tools\MSVC\14.29.30037\bin\Hostx64\x64\cl.exe -o CMakeFiles\cmTC_a04d9.dir\testCXXCompiler.cxx.obj -c D:\Qt\6.1.0\Src\qtbase\src\plugins\sqldrivers\build-sqldrivers\CMakeFiles\CMakeTmp\testCXXCompiler.cxx" ninja: fatal: CreateProcess: A operaþÒo solicitada requer elevaþÒo. CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:7 (project)
-
wrote on 6 Aug 2021, 18:01 last edited by
@Christian-Ehrlicher So i finally got what happened, i had to give Admin acess to ninja and run my msvc x64 CMD as administrator too... now i finally have a build folder, but facing another problem, the documentation says that i have to execute these 2 lines after creating my Cmake files:
qt-cmake --build . qt-cmake --install
But these are giving me the following errors:
CMake Error: Unknown argument --build CMake Error: Run 'cmake --help' for all supported options.
Am i supposed to run cmake --build instead of qt-cmake?
-
Strange, it should work - it's a common parameter for cmake: https://cmake.org/cmake/help/latest/manual/cmake.1.html. But it basically calls
ninja
- so try simply executingninja
and thenninja install
to compile and install the plugin -
Strange, it should work - it's a common parameter for cmake: https://cmake.org/cmake/help/latest/manual/cmake.1.html. But it basically calls
ninja
- so try simply executingninja
and thenninja install
to compile and install the pluginwrote on 9 Aug 2021, 16:58 last edited by Marcusdrl 8 Sept 2021, 17:08@Christian-Ehrlicher said in Problems building mysql plugin on Windows for Qt 6.1.2:
Strange, it should work - it's a common parameter for cmake: https://cmake.org/cmake/help/latest/manual/cmake.1.html. But it basically calls
ninja
- so try simply executingninja
and thenninja install
to compile and install the pluginHi, the problem was actually that "NINJA" wasnt being called because it didnt had ADMINISTRATOR privileges. I got my problems solved just by simply giving adm privileges for MSVC CMD and NINJA, its kinda frustrating to think that i spent 2 whole days trying to figure out what was happening and it was something this simple... but yeah i have MySQL plugin installed and working now, ty for the replys.
Obs: qt-cmake calls didnt work except for the first line call (these below are my paths):
qt-cmake -G"Ninja" D:\Qt\6.1.2\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX="D:\Qt\6.1.2\msvc2019_64" -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Server 8.0\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib"
And for the second part i had to call cmake --build . and cmake --install . instead of qt-cmake...it worked but i dont have any idea of why it did, since the documentation was specifying qt-cmake calls.
-
Hi,
That's a rather strange requirements. Do you have your files stored in some place that requires administration rights to be executed / written ?
-
Hi,
That's a rather strange requirements. Do you have your files stored in some place that requires administration rights to be executed / written ?
wrote on 9 Aug 2021, 18:32 last edited by Marcusdrl 8 Sept 2021, 18:41@SGaist Hi,
i made a few tests real quick and i noticed that my Program Files folder always ask for permission before executing an action, maybe thats it.qt-cmake -G"Ninja" D:\Qt\6.1.2\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX="D:\Qt\6.1.2\msvc2019_64" -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Server 8.0\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib"
In the line above i use the mysql installation folder to specify include and lib paths.
1/13