What leads to "Could not find QtWebEngineProcess" error? - c++

I am triyng to port WebKit (Qt5.5.1) plugin to WebEngine (Qt5.11.3) one as described here: https://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html
Building and running in Ubuntu 18.04 I get following errors:
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
and then
Could not find QtWebEngineProcess
I am not sure if first one is related to second but second one leads to crash.
EDIT:
I put QtWebEngineProcess from Qt/libexec dir to dir with binary and now second error changed to:
WebEngineContext used before initialize() or OpenGL context creation failed.
still crashes.

Problem was in missed dependency files.
Our cmake build copied only auto-determined dependencies (libs) from the Qt folder to the app folder. But for a full deploy a QtWebEngine app needs few non-libs dependencies such as QtWebEngineProcess executable xcbglintegrations plugins (first error) and WebEngine resources. This instruction https://doc.qt.io/qt-5/qtwebengine-deploying.html have most of details.
It worked for me with Qt5.12.9. With Qt5.11.3 I still had some problem.

Related

How to deploy QWindowsIntegrationPlugin with CMake

I'm using CMake to build a Qt application. My project compiles, and thanks to 'fixup_bundle()', make install copies the required libraries next to my executable. Great!
Only problem is, when I execute it, I get the dreaded 'This application failed to start because it could not find or load the Qt platform plugin "windows".' error.
Indeed, manually copying qwindows.dll into a 'platforms' directory next to the executable fixes the issue. Now, how can I tell CMake to do that automatically?
Not much info from Qt :
Plugins are also available as IMPORTED targets in CMake. The Qt Network, Qt SQL, Qt GUI, and Qt Widgets modules have plugins associated. They provide a list of plugins in the Qt5_PLUGINS variable.
All right, I guess I have to play with Qt5::QWindowsIntegrationPlugin, which should be an imported target. That's where I'm lost.
I know (well, I think I know at least) that fixup_bundle() looks into the executable to find its dependencies. But despite the fact that I link my executable against QWindowsIntegrationPlugin, there is no trace of it. Therefore, no qwindows.dll copied into my output path by fixup_bundle().
Except the manual copy of the file, I couldn't find a nice CMake-friendly answer to this issue.
Thanks for your help.
Just ran into the same issue. Here is how I resolved it in my CMake install script:
# QWindowsIntegrationPlugin is part of the Gui component
find_package(Qt5 COMPONENTS Gui REQUIRED)
install(
FILES "$<TARGET_FILE:Qt5::QWindowsIntegrationPlugin>"
DESTINATION bin/platforms
)

QMYSQL driver not loaded on Windows

I am trying to implement a database system in my Qt application. For this purpose, I am trying to use MySQL (with the related QMYSQL driver). My class connection-function is written below.
Assuming that connection is defined as a private class member:
private:
QSqlDatabase connection;
we have the following:
database::database() : connection() {
this->connection.addDatabase("QMYSQL");
this->connection.setHostName(p.database->server_addr);
this->connection.setUserName(p.database->username);
this->connection.setPassword(p.database->password);
this->connection.setDatabaseName(p.database->database_name);
if (!connection.open())
this->error = this->connection.lastError().text();
else this->error = "";
}
I get database::error with the value Driver not loaded Driver not loaded (yes, it's written twice). I've seen here on Stack Overflow that I have to put the driver libraries in my application's path. I've done this and nothing happened. Below is a screenshot of the Qt libraries that are in my path.
EDIT
After calling QSqlDatabase::drivers(), I found out that I have the drivers available. Below is the output ( int the show-more section of the message-box).
For mingw and Windows: Download the C (not c++) connector from: https://dev.mysql.com/downloads/connector/c/,
then copy the library: libmysql.dll, to the folder: D:\Qt\5.5\mingw492_32\bin.
This should solve the problem for the not loaded driver.
1) I assume that you already compiled your qsqlmysql dll. You should have the qmyssql.dll in the plugins/sqldrivers directory relative to your binary path of your executable.
2) You should also be careful not to mix release and debug dlls (the ones with the d at the end).
3) The static method addDatabase should be used this way: this->connection = QSqlDatabase::addDatabase(DRIVER, NAME);
4) Another point: The reason you get the error "twice" (you actually just get two errors combined) is that connection.lastError().text() results a combined error message (appended) from the driver and from the connection attempt (see the API more more information about the differences).
5) When i took a closer look at your libs i could not see the non-debug version of libmysql.dll. If you run in release mode you must use the release library since the runtime will look for libmysql.dll and not libmysqld.dll. This will give you this error.
In addition to #OnWhenReady's answer, I run the DependencyWalker on the qsqlmysql.dll and found that there were missing some dependencies.
IEShims.dll
I copied it in my path and now it's working!
As a tip: run DependecyWalker for this kind of libraries, because, as it's written in the Qt Documentation, QMYSQL driver libraries won't give errors (won't show them).
Please see the link for QT5:
http://seppemagiels.com/blog/create-mysql-driver-qt5-windows
=> qsqlmysql.dll and libmysql.dll (and libmysql.lib, if your installation of MySQL has it) are needed
And the link for QT4:
http://seppemagiels.com/blog/create-mysql-driver-qt-windows
=> libqsqlmysql4.a and qsqlmysql4.dll and libmysql.dll (and libmysql.lib, if your installation of MySQL has it) are needed
I use msys2 with its qt5 package mingw64/mingw-w64-x86_64-qt5 (5.8.0-3) and looking at the plugins/sqldrivers/qsqlmysql.dll with the Dependency Walker reveled dependency on the mariadb.dll, so I installed the mariadb client package:
pacman -S mingw64/mingw-w64-x86_64-libmariadbclient
and the dll appeared in /mingw64/bin/mariadb.dll, so I just copied the dll next to my app's exe file and it suddenly worked.
Even if you don't use msys2, you should still look at your qsqlmysql.dll with Dependency Walker and provide the missing dlls to your app. You can install MariaDB or MySQL connectors and just copy the dlls from the installed path.
I have encountered this problem many times. If you are in
LINUX: You need to build it. You need to first install MySQL server then MySQL Client from package manager. then follow instructions in Qt Documentation website Here. Which is basically these commands:
cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql
make install
and after the build process finishes, generated plugin will in $QTDIR/qtbase/src/plugins/sqldrivers/ i guess.
WINDOWS: No need to build. Install MySQL and after that you can
Install MySQL Connector C (.msi file) and add installation destination folder to PATH.
or download the zip file and extract it in somewhere that your application can find.
also, if you have done all above and still doesn't work, you need to install Visual C++ Runtime Libraries. I had this problem in XP and Dependency Walker didn't show any missing or incompatible .dll file and after installing those runtime libs my problem was solved. Where you can find them packed and ready? Here
Before you test your app, its a good idea to reboot so those changes in PATH and ... can take effect.

QT missing dll after deploy

I've copied all of the dlls from QT that were required, and my application works fine on my Windows server machine.
However when trying to run it on a Windows 7 box i get the following message:
This application failed to start because it could not find or load he
Qt platform plugin "windows".
Reinstallning the application may fix this problem.
Any ideas what I'm missing here?
I'd scratched my head over this some time ago. It turned out that this was caused not by missing qwindows.dll, but rather one of libEGL.dll or libGLESv2.dll. This was tricky, because dependency walker does not show those libs as direct dependencies.
If you want to test on your dev machine, whether your app has all required libs, fire up console issue SET PATH=, cd to your app directory and run it.
This is complete list of dlls that my app is using (Qt 5.2 / QtQuick app only, rest is C++). QtQuick is nice but the size of Qt dependencies is a bit scary:
icu*.dll - depending on whether you've compiled with ICU
libEGL.dll
libGLESv2.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Network.dll
Qt5Qml.dll
Qt5Quick.dll
Qt5Widgets.dll
Widely used solution is put all necessary libraris in the folder of application.
What are libraries application need?
Run application and see error message:
The program can't start because <Library name> is missing from your computer.
Try reinstalling the program to fix this problem
Library set is depended from Qt version. Run several times application and each time copy required lib you found what is neeeded for application.
In my case (Qt 5.2.1) there are
icudt51.dll,
icuin51.dll,
icuuc51.dll,
libgcc_s_dw2-1.dll,
libstdc++-6.dll,
libwinpthread-1.dll,
Qt5Core.dll,
Qt5Gui.dll,
Qt5Widgets.dll.
All libs you can found in your Qt install folder. But don't use libraries from Tools\QtCreator folder, because QtCreator has another version of these libraries!
In case of error:
This application failed to start because it could not find or load he Qt platform plugin windows. Reinstallning the application may fix this problem.
You should create folder platforms and copy qwindows.dll into it.
If you still got error you should create qt.conf file in application's folder with content:
[Paths]
Plugins=plugins
This solution is described in https://qt-project.org/forums/viewthread/37265
More information about qt.conf you can find at http://qt-project.org/doc/qt-5/qt-conf.html
In latest versions of Qt you can find deploy tool (since 5.2). This tool find necessary libraries for application and copy into application folder. You can run it something like this:
call c:\Qt\QtX.Y.Z\X.Y.Z\mingw48_32\bin\qtenv2.bat
cd /d "c:\path\to\your\application\folder"
windeployqt.exe your_application.exe
Generally it works well. But I notice that some libraries are not copied, but you can found by method is descibed at beggining of post. More useful information you can find at
http://qt-project.org/doc/qt-5/windows-deployment.html
In rare cases yo can got this error if some library is missing but not appear in error message above. Example: Qt 5.1.1: Application failed to start because platform plugin "windows" is missing
I wasn't in this situation, so I can't tell more.

What dlls do i need to distribute my Qt application?

I built a Qt app that I'd like to distribute to a few people.
On a computer with QtCreator installed, I can get it to run by placing a bunch of Qt dlls (I inserted the ones it complained about) inside the same folder as the executable. But if I uninstall Qt or try it on a computer without Qt, the executable does nothing. No error, just no window or process when I run it.
Here's what I've tried:
-put every dll from the qt folder with the executable. No effect.
-run it with dependency walker. I'm not entirely sure I'm using it right but, with Qt uninstalled and the necessary dlls with the executable, it doesn't give me any missing or invalid modules. Just a couple of red lines in the logger after profiling like:
GetProcAddress(0x75AC0000 [KERNEL32.DLL], "SetDefaultDllDirectories") called from "MSVCR110.DLL" at address 0x6AC0FD4F and returned NULL. Error: The specified procedure could not be found (127).
and
GetProcAddress(0x75AC0000 [KERNEL32.DLL], "GetCurrentPackageId") called from "MSVCR110.DLL" at address 0x6AC0FDFA and returned NULL. Error: The specified procedure could not be found (127).
Nothing related to qt that I can tell.
I'm testing on a virtual machine (trying to simulate a non-dev machine) with 32bit windows 7. MSVC redist 2010 and 2012 are installed.
It's Qt 5.1.0 MSCV2012-32bit. And I have the same problems with the 64bit version (I haven't used dependency walker with the 64 bit version though).
Is there some step I'm missing?
I have found you need to add a sub directory with some of the plug in dlls found in the plugin subdirectory of the install folder (where you find the include and bin folder)
in particular the platforms subdirectory and the qminimale.dll and windows.dll in it are needed for a gui
edit: to be clear add a subdirectory platforms to the directory with the exe and add the qminimale.dll and windows.dll to it

How do i configure SDL to work with the Blackberry Playbook Native SDK / NDK?

I've got the NDK set up and managed to compile and run the hello native sdk project on my playbook. I downloaded the blackberry sdl port from github. However I've been unable to compile even a hello world project using it. Also it seems to be lacking a "lib" folder which I'm used to needing for the compiler settings.
EDIT: I have managed to get the sdl to open in the native sdk, it seems the download was designed to act as a project template of sorts. At first the compiler complained that i needed another library, TouchControlOverlay. So I downloaded this and set up the includes to include it. However again I couldn't find a lib folder, and the project still wont compile, saying it cannot find -lTouchControlOverlay.
The reason the compile cannot find TouchControlOverlay is because it's not installed on your host machine. To install it:
Clone TouchControlOverlay from here: https://github.com/blackberry/TouchControlOverlay
Go into the directory and run:
make && make install
If you now navigate to: $QNX_TARGET/armle-v7/lib you should see that libTouchControlOverlay.so has been placed there. You should now be able to link against this library using -lTouchControlOverlay
Note that you will need to package this library with your application by specifying it as an <asset> in your bar-descriptor.xml file.