Project ERROR: Unknown module(s) in QT: webkitwidgets - c++

I am porting code from qt4 to qt5. I added the following line to my .pro file, as suggested:
QT += webkitwidgets
However, when I run qmake, I get the this error:
Project ERROR: Unknown module(s) in QT: webkitwidgets
I am developing on Ubuntu 12.04 LTS and installed Qt as described.

You need to install the webkitwidgets library.
On Ubuntu, try this in a terminal:
sudo apt-get install libqt5webkit5-dev
On Fedora, the package has a different name, thus try:
sudo apt-get install qt5-qtwebkit-devel
Or on Fedora, via dnf:
sudo dnf install qt5-qtwebkit-devel

If you need to install the webkit* Windows library for Qt 5.7 you should compile it manually because in new version webkit (WebView?) replaced by WebEngine.
Read about Qt 5.7 release (comments): http://blog.qt.io/blog/2016/06/16/qt-5-7-released/
Build sequence (static OR shared):
1) Download Qt 5.7.0 sources: http://download.qt.io/community_releases/5.7/5.7.0/
2) Download required tools: ActiveState Perl (binary), Python (binary), Ruby (binary), GnuWin Bison (binary), GPref (binary), Grep (binary), WinFlex, LibIconv, make (binary), sqlite (source!), ICU (source), windows msys (binary) (unix like shell with the tools), mingw-w64 (bin+dev) for build Qt with QtWebKit, see link on: https://trac.webkit.org/wiki/BuildingQtOnWindows
3) After download ICU source into C:\icu\icu. Open msys QT mingw console shell by open Start windows menu (msys should be downloaded and installed) and search or use fast search. In opened console start configure script and then compile and install:
$ cd C:\icu\icu\source
$ ./runConfigureICU
$ set PATH=%PATH%;C:\msys\1.0\bin\
$ make.exe
$ make.exe install
4) Build Qt with(!) ICU support (set "-icu" to configure) see compile script below. Change PATH to your environment.
Directory structure:
C:\Qt\5.7.0 - download binary version of Qt 5.7.0 here
C:\Qt\5.7.0n - directory for new (compiled) version of 5.7.0 (just make dir)
C:\Qt\Src - download source of Qt 5.7.0 here
C:\Qt\Src\qtbase\compile.bat
set INCLUDE=C:\icu\icu\dist\include
set LIB=C:\icu\icu\dist\lib
set QTDIR=C:\Qt\5.7.0n
set PATH=%PATH%;C:\Qt\Qt5.7.0\5.7\mingw53_32\bin;C:\Qt\Qt5.7.0\Tools\QtCreator\bin;C:\Qt\Qt5.7.0\Tools\mingw530_32\bin;C:\Qt\Src\qtbase\bin;C:\Program Files (X86)\GnuWin32\bin;C:\winflex;C:\Ruby23-x64\bin;C:\Python27;C:\mingw-w64\i686-1\mingw32\bin;C:\icu\bin
set QMAKESPEC=win32-g++
set BUILD_DIR=C:\Qt\Qt5.7.0n
call C:\Qt\Src\qtbase\configure.bat -prefix %BUILD_DIR% -platform %QMAKESPEC% -confirm-license -debug-and-release -opensource -opengl desktop -no-compile-examples -icu -I C:/icu/icu/dist/include -L C:/icu/icu/dist/lib
jom.exe -j 4
pause
Run command in exmaple in Windows Power Shell:
$ cd C:\Qt\Src\qtbase
$ ./compile.bat
After pass through compile use it to install files in the BUILD_DIR (install Qt files):
$ C:\mingw-w64\i686-1\mingw32\bin\mingw32-make.exe install
Qt should start to install
5) Download Qtwebkit sources to C:\Qt\Src\qtwebkit. Use compile script below to compile the qtwebkit using new Qt 5.7.0 build with files in C:\Qt\5.7.0n with ICU.
C:\Qt\Src\qtwebkit\Tools\Scripts\compile.bat
set INCLUDE=C:\sqlite
set LIBS=C:\sqlite
set SQLITE3SRCDIR=C:\sqlite
set QTDIR=C:\Qt\Qt5.7.0n
set PATH=%PATH%;C:\Qt\Qt5.7.0n\bin;C:\Qt\Src\qtbase\bin;C:\winflex;C:\Ruby23-x64\bin;C:\Python27;C:\mingw-w64\i686-1\mingw32\bin;C:\icu\bin;C:\Program Files (x86)\GnuWin32\bin
set QMAKESPEC=win32-g++
call perl.exe .\build-webkit --qt --release
Compile the qtwebkit:
$ cd C:\Qt\Src\qtwebkit\Tools\Scripts
$ ./compile.bat
$ cd C:\Qt\Src\qtwebkit\WebKitBuild\Release
$ C:\mingw-w64\i686-1\mingw32\bin\mingw32-make.exe install
It should be possible to compile your application with the qtwebkit after successfull compile and install.
BUILD QT FOR STATIC
Edit file C:\Qt\Src\qtbase\compile.bat and pass through build.
...
call C:\Qt\Src\qtbase\configure.bat -prefix %BUILD_DIR% -platform %QMAKESPEC% -confirm-license -debug-and-release -opensource -opengl desktop -static -no-compile-examples -icu
echo "QMAKE_FLAGS += -static -static-libgcc" >> .mkspecs/%QMAKESPEC%/qmake.conf
...
POSSIBLE ERRORS
1) While build qtwebkit: "fatal error: unicode/uchar.h: No such file or directory"
Check that your Qt 5.7.0n build with ICU. IT also could notify you about "ICU required" at configure in qtwebkit.
2) flex: unknown flag '-'. For usage, try
You should use correct version of Flex that is "win_flex" in this case. You should rename files to use win_flex instead of just flex (and bison).
1) rename C:\Program Files (x86)\GnuWin32\bin\flex.exe to some unused name.
2) rename C:\Program Files (x86)\GnuWin32\bin\bison.exe to some unused name.
3) rename C:\winflex\win_bison.exe to bison.exe.
3) While build qtwebkit: "fatal error: sqlite3.h: No such file or directory"
Edit file C:\Qt\Src\qtwebkit\Tools\Scripts\compile.bat and check for correct path to sqlite:
set SQLITE3SRCDIR=C:\(path to some SQLITE .h/source files)
4) skipping incompatible ... when searching for ...
You should download right library arch (32bit or 64bit)
5) View.cpp ... undefined reference to WKPageCanGoBack
Could happens when pass through some test or MiniBrowser. You can search in files for the "UIProcess/API/qt" and "MiniBroswer" and remove it from
Makefile's and some other files and then start build again.
LINKS
Build Qt5: https://wiki.qt.io/Building_Qt_5_from_Git Qt WebKit build
like how to: https://trac.webkit.org/wiki/BuildingQtOnWindows ICU
build with GNU: https://wiki.qt.io/Compiling-ICU-with-MinGW

The community builds referenced by Alex are only available until Qt 5.9.
If you want to use newer Qt5 (current version is 5.11), then another option is to port "QtWebKit" to "QtWebEngine".
See: https://wiki.qt.io/QtWebEngine/Porting_from_QtWebKit

I got it to work by copying the webkit and webkitwidgets pri files from a previous installation, 5.5.
~/Qt/5.5/clang_64/mkspecs/modules/

For windows, I just downloaded https://github.com/annulen/webkit/releases/tag/qtwebkit-tp5 and copied the folders to relevant Qt installation folder. Now I can use MinGW Qt5.8 with latest webkit. Thanks to Konstantin and all the contributors for this project!
Only one thing to note - I needed to use the release configuration in Qt.

What works for me is the combination of two answers, I used what #user1251007 suggested + this command
sudo apt-get install libqt5websockets5-dev
find this command line here : link to the stackoverflow response

Related

Installing and using arm-none-eabi-gcc on MSYS2

I am trying to build an embedded program using "make all" with the GNU ARM toolchain, but it is not working yet.
I installed it with xpm according to this website with the xpm installer:
https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
Now when I try to build my program using "make all", I get following error:
$ make all
Collecting dependencies for: Bsp/....cpp
/bin/sh: Zeile 1: arm-none-eabi-gcc: Command not found-
...
The file is of course located in the xpack location:
C:\Users\\AppData\Roaming\xPacks
while the normal mingw64 binaries are in another location. How exactly can I use arm-none-eabi-gcc now or how can I edit the PATH variables of msys2 to use the xpm packages?
There is also a similar toolchain here:
https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa
But I guess I can not install this without something like Linux subsystem...
If you downloaded arm-none-eabi-gcc separately from MSYS2, then after starting your MSYS2 shell, you need to add whatever directory contains arm-none-eabi-gcc.exe to your PATH environment variable by running a command like this:
export PATH=$PATH:/c/Users/path/to/bindir/
You can test it by running arm-none-eabi-gcc in the shell with no arguments, and also running which arm-none-eabi-gcc.
The main place to download such a toolchain is here:
https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain
You can install arm-none-eabi-gcc on MSYS2 using its package manager.
Start MSYS2 using mingw64.exe (or the equivalent shortcut) and then install the toolchain by running:
pacman -S mingw-w64-x86_64-arm-none-eabi-gcc
Now arm-none-eabi-gcc should be on your PATH without any additional work.

QSslSocket and supportsSsl() returns false

Background
Basically I need a Openssl support for my application, preferably through dynamic linking. For this I have complied the Openssl libraries using the following:
perl configure VC-WIN32 no-asm --prefix=C:\Build-OpenSSL-VC-32
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
nmake -f ms\ntdll.mak install
using VC 2017 x86 all tests passed. So far so good. Then I compiled qt5 from source using the following configuration:
configure -debug-and-release -opensource -nomake examples -nomake tests -confirm-license --prefix="C:\Work\qt-bin-5.9-VC-17" -skip webengine -platform win32-msvc -openssl -I C:\Build-OpenSSL-VC-32\include -L C:\Build-OpenSSL-VC-32\lib
The build process succeeded with VC 2017. After this I installed the latest version of qt-creator. Then I configured the qt versions/kits and paths to the newly complied version. No other versions are installed on this computer. Next I created a small program to test if everything is working properly. This resulted in QSslSocket::sslLibraryBuildVersionString() returning OpenSSL 1.0.2l 25 May 2017 (version I compiled) and QSslSocket::supportsSsl() returning false. Note I have included:
QT += network
INCLUDEPATH += C:\Build-OpenSSL-VC-32\include
LIBS += C:\Build-OpenSSL-VC-32\lib\libeay32.lib
LIBS += C:\Build-OpenSSL-VC-32\lib\ssleay32.lib
in the .pro file. I've tried adding the .dll instead of the .lib files but I then get the following error.
C:\Build-OpenSSL-VC-32\bin\libeay32.dll:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x2B8
I would really appreciate any help and information about what I did wrong.
It is normal to have an error when you replace the ".lib" by the ".dll", you cannot link directly to a dll. You must link to a ".lib", the ".dll" will be required at execution. But you should not have to link directly to OpenSSL when building your own app, Qt will load them at run-time when they are needed.
QSslSocket::sslLibraryBuildVersionString() returns the version of the SSL library used when you built Qt.
You need to use QSslSocket::sslLibraryVersionString() to get the version number of the run-time SSL library. QSslSocket::supportsSsl() gives info about SSL support at run-time, which may not be available even if SSL support was available when you built Qt itself.
From what you described, it seems that your program fails to find the OpenSSL dll at run-time. Be sure to place libeay32.dll and ssleay32.dll next to your exe file or in your PATH.

how to specify search directory for source code build

I am trying to install Jom (http://wiki.qt.io/Jom) for C++. When I type in qmake -r in cmd, I get the error Project MESSAGE: Cannot build jom with Qt version 4.8.7. Project ERROR: Use at least Qt 5.2.0.. This is because I have PyQt version 4.8.7 and Qt version 5.8.0 both installed. When building Jom, Jom searches for in the wrong Qt folder. How can I fix this?
If you have multiple version of Qt installed, you also have multiple version of qmake. You can check which qmake you are running by using where qmake on Windows, it will output a list of qmake executable available in your path, the first one in the list will be the one executed when running qmake.
For instance:
C:\>where qmake
C:\Qt\5.8\msvc2015\bin\qmake.exe
C:\Qt\5.6\msvc2015\bin\qmake.exe
If the first one, is not the one you want, you can run it by using its complete path:
C:\>C:\Qt\5.6\msvc2015\bin\qmake.exe -version
QMake version 3.0
Using Qt version 5.6.2 in C:/Qt/5.6/msvc2015/lib
If the qmake and Qt version you want is not in your PATH, you can use the scripts provided by Qt to setup a valid environment. These are available in the Start menu as Qt 5.8 64-bit for Desktop (MSVC 2015) (change according to your installation), or you can use them directly by executing qtenv2.bat (e.g C:\Qt\5.8\msvc2015\bin\qtenv2.bat).
If you are using MinGW you are all set, but if you are using MSVC you need also to run vcvarsall.bat, which can be found in your Visual installation folder.

Unable to build qt from the source (for the OpenCV)

I am trying to install OpenCV on my Windows 10 following this guide. In order to install it with my own-build libraries, I need to build qt from the source. I downloaded the latest sources from the qt page (5.6.0, I didn't find any other sources availible), but after typing
configure -release -no-webkit -no-phonon -no-phonon-backend -no-script - no-scripttools
-no-qt3support -no-multimedia -no-ltcg
In VS2013/VS2015 command promt, I got an error:
Unknown option -no-webkit
Unable to detect the platform from environment. Use -platform command line
argument or set the QMAKESPEC environment variable and run configure again.
I have an option just to make everything. But I have to specify the platform. I didn't find how to do it.
Can anyone give me a hint, how to install qt correctly? I have VS 2013 and 2015. I am going to use VS2013, since VS2015 is not supported by CUDA toolkit 7.5.
Thanks,
Mikhail
Update: I was able to begin the installation process by typing configure -platform win32-msvc2013 -mp -release (although I have win64), but after accepting the licence, I got an error: execute: File or path was not found(nmake). Screenshot is attached
have you tried with the MSVC2013 command prompt:
configure -platform win32-msvc2013 -mp -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg
then type:
nmake
Update:
Also, before that, try adding the path to your Qt source code, with the bin folder, to the PATH variable of windows.
For instance, if your PATH variable is currently set to %SystemRoot%\system32;%SystemRoot%; and your Qt source code is at C:\dev\Qt-5.6\
then set your PATH variable to %SystemRoot%\system32;%SystemRoot%;C:\dev\Qt-5.6;C:\dev\Qt-5.6\bin
This website explains how to change the PATH variable on Windows, in case you're not familiar with it: http://www.computerhope.com/issues/ch000549.htm
Then restart the MSVC2013 Command Prompt, or Windows. I believe that should help the compilation. Let me know if it solves your problem.
What about this:
-skip qtwebkit
Excluding a Qt Submodule
Configure's -skip option allows certain Qt submodules to be excluded from the Qt build. These submodules correspond to the Git submodules in the standard Qt 5 repository. Note that many packages contain multiple Qt modules. For example, to exclude Qt NFC and Qt Bluetooth from the Qt build, provide -skip qtconnectivity as the argument to configure.

configure:file not found while static linking Qt 5.4 project in linux

I have an application which i want to deploy using static linking.I am using Qt 5.4 and ubuntu.I learnt that to deploy my application i have to bulid qt statically using the following code
cd /path/to/Qt
./configure -static -prefix /path/to/Qt <other parameters>
make sub-src
i have Qt installed in home/Qt5.4.0
When i run the above code it says that
configure:no such file
When i check the Qt directory there is indeed no configure file.I could only find
configure.prf
in Qt5.4.0/5.4/gcc_64/mkspecs/features/
this may be novice but how should i deploy my application now?
I can describe steps I did for Windows.
Configure Qt static build. For this download source code and in e.g. d:\Qt\5.4\Src\qtbase\mkspecs\win32-g++\qmake.conf change line QMAKE_LFLAGS = to QMAKE_LFLAGS = -static -static-libgcc. Then save and exit.
Make Qt. In console (preferably one from Qt folder like Qt 5.4 for Desktop (MinGW 4.9 32 bit) go to d:\Qt\5.4\Src\qtbase, change environment variables
set LIB=
set INCLUDE=
SET QTDIR=D:\Qt\5.4\Src\qtbase
SET QMAKESPEC=win32-g++
SET PATH=C:\Python34;c:\Strawberry\perl\bin;d:\Qt\Tools\mingw491_32\bin;d:\Qt\5.4\Src\qtbase\bin;%PATH%
Start configuration (accept license) and make.
configure.exe -debug-and-release -opensource -c++11 -static -opengl desktop -no-angle -no-vcproj -nomake examples -nomake demos
mingw32-make.exe (This can take time)
Add kit in Qt Options (Build & Run tab)
Chose new kit for the project. Should work.