Project ERROR: Unknown module in QT: webkitwidgets

I am moving the 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 this error:

 Project ERROR: Unknown module(s) in QT: webkitwidgets 

I am developing Ubuntu 12.04 LTS and installing Qt as described .

+61
c ++ qt qt5 qtwebkit
Sep 09 '13 at 13:31 on
source share
4 answers

You need to install the webkitwidgets library.

On Ubuntu, try this in a terminal:

 sudo apt-get install libqt5webkit5-dev 
+98
Sep 09 '13 at 13:31 on
source share

If you need to install the webkit * Windows library for Qt 5.7, you must manually compile it because the new version of webkit (WebView?) Replaces WebEngine.

Read about Qt 5.7 release (comments): http://blog.qt.io/blog/2016/06/16/qt-5-7-released/

Build string (static or general):

1) Download Qt 5.7.0 sources: http://download.qt.io/community_releases/5.7/5.7.0/

2) Download the necessary 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 tools), mingw-w64 (bin + dev) for building Qt with QtWebKit, see the link at: https://trac.webkit.org/ wiki / BuildingQtOnWindows

3) After loading the ICU source in C: \ icu \ icu. Open the MSys QT console console through the open Start menu (msys must be downloaded and installed) and search or use the quick search. In the console that opens, run 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) Create Qt with support (!) ICU (set "-icu" to configure) see the compilation script below. Change PATH to your environment.

Directory structure:

  • C: \ Qt \ 5.7.0 - download the binary version of Qt 5.7.0 here
  • C: \ Qt \ 5.7.0n - directory for the new (compiled) version 5.7.0 (just make dir)
  • C: \ Qt \ Src - download the Qt 5.7.0 source 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 -IC:/icu/icu/dist/include -LC:/icu/icu/dist/lib jom.exe -j 4 pause 

Run the command in exmaple in the Windows Power Shell:

$ cd C: \ Qt \ Src \ qtbase

$. / compile.bat

After going through compilation, use it to install the files in BUILD_DIR (install the Qt files):

$ C: \ mingw-w64 \ i686-1 \ mingw32 \ bin \ mingw32-make.exe install

Qt should start the installation

5) Download the Qtwebkit sources to C: \ Qt \ Src \ qtwebkit. Use the compile script below to compile qtwebkit using the 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 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 qtwebkit after a successful compilation and installation.

CREATE QT FOR STATIC

Edit the file C: \ Qt \ Src \ qtbase \ compile.bat and go through the assembly.

 ... 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 MISTAKES

1) During build qtwebkit: "fatal error: unicode/uchar.h: No such file or directory"

Make sure your Qt 5.7.0n is built with ICU. IT can also notify you of the need for an "ICU" when setting up qtwebkit.

2) flex: unknown flag '-'. For usage, try flex: unknown flag '-'. For usage, try

In this case, you must use the correct version of Flex, which is "win_flex". You must rename the files to use win_flex instead of 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) During build qtwebkit: "fatal error: sqlite3.h: No such file or directory"

Edit the file C: \ Qt \ Src \ qtwebkit \ Tools \ Scripts \ compile.bat and check the correct sqlite path:

 set SQLITE3SRCDIR=C:\(path to some SQLITE .h/source files) 

4) skipping incompatible ... when searching for ...

You must load the right library arch (32 bit or 64 bit)

5) View.cpp ... undefined reference to WKPageCanGoBack

It can happen if you go through some test or MiniBrowser. You can search the files for "UIProcess / API / qt" and "MiniBroswer" and delete them from the Makefile and some other files, and then start building again.

LINK

Build Qt5: https://wiki.qt.io/Building_Qt_5_from_Git Qt WebKit build

like: https://trac.webkit.org/wiki/BuildingQtOnWindows ICU

build with GNU: https://wiki.qt.io/Compiling-ICU-with-MinGW

+7
Jul 12 '16 at 12:14
source share

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/

+1
Oct 18 '16 at 19:52
source share

For windows, I just downloaded https://github.com/annulen/webkit/releases/tag/qtwebkit-tp5 and copied the folders to the appropriate Qt installation folder. Now I can use MinGW Qt5.8 with the latest webkit. Thanks to Konstantin and all the participants in this project!

Just one note - I needed to use the release configuration in Qt.

+1
Feb '17 at 16:43
source share