Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile Qt webengine (5.11) on Windows with proprietary codecs

I have a lot of trouble compiling Qt webengine to enable proprietary codecs, documentation is not very clear. I followed others instructions on stackoverflow but it doesn't work. I got error like:

Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?

OR

Needs VS 2015 Update 3 with Cumulative Servicing Release or higher
Qt WebEngine will not be built.

OR

Could not detect Windows SDK Version ('WindowsSDKVersion' environment variable is not set).
Qt Webengine on Windows requires a Windows SDK version 10.0.10586 or newer.
QtWebEngine will not be built.

OR

Needs Visual Studio 2017 or Higher
Qt WebEngine will not be built.

OR

C1905: Front end and back end not compatible (must target same processor).
LNK1257: code generation failed
like image 856
Dardan Iljazi Avatar asked May 24 '18 13:05

Dardan Iljazi


3 Answers

I had all of those problems for the last 5 days.

I'm doing a step by step instruction if you don't know how to begin with compiling Qt webengine (with or without proprietary codecs). If you have already done some of the steps, you can freely skip them.

Please if you see any error, if have one by doing this or if some instruction is not clear, tell me so I can update

1. Install Visual Studio 2017

Go to https://www.visualstudio.com/fr/downloads/ and download Visual Studio 2017.

Visual Sutdio Qt webengine minimum prerequisities

When this window comes, check Desktop Development for C++ and be sure that VC++ toolset 2015.3v v14.00 (v140) and SDK Windows 10 (10.0.xxxxx.x) are checked.

Install and wait until it finishes.

2. Install Qt sources qt webengine

Open MaintenanceTool.exe present into the Qt folder

Add or delete module

Qt webengine minimum prerequisities

Be sure to check at least: MSVC 2015 32-bit, MSVC 2015 64-bit, MSVC 2017 64-bit, Sources, Qt WebEngine

Install and wait until it finishes.

3. Install Qt webengine compile prerequisities

(Original instructions copied from Sébastien Bémelmans on this thread and a bit modified)

Download:

  • Python 2 (2.7.15 actually, Python 3 is not supported) from https://www.python.org/downloads/windows/
  • Perl (Strawberry vesion) from http://strawberryperl.com/
  • Bison and flex from https://sourceforge.net/projects/winflexbison/ (Rename win-bison.exe to bison.exe and win-flex.exe to flex.exe)
  • Gperf from http://gnuwin32.sourceforge.net/packages/gperf.htm

Be sure to add every .exe to System path, and restart the computer.

4. Compile Qt webengine with proprietary-codecs (or without)

Open cmd.exe (with administrator rights).

type cd + Path to the Microsoft Visual Studio folder where vcvarsall.bat is located:

cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"


For compilation into 32-bits:

Type vcvars32.bat into command line

For compilation into 64-bits:

Type vcvars64.bat into command line


Go to the path where Sources of Qt are and enter qtwebengine subdirectory:

cd "C:\Qt\5.11.0\Src\qtwebengine"

For compilation into 32-bits:

Type "C:\Qt\5.11.0\msvc2015\bin\qmake.exe" -- -webengine-proprietary-codecs into command line (note the link is going to msvc 2015 32 bit)

For compilation into 64-bits:

Type "C:\Qt\5.11.0\msvc2017_64\bin\qmake.exe" -- -webengine-proprietary-codecs into command line (note the link is going to msvc 2017 64 bit)


Your console should look like this (32 bit):

Compile Qt webengine proprietary codecs

And the result:

Compile Qt webengine with proprietary codecs


Now you need to call nmake. Type "Path to nmake.exe for version 32 bit or 64 bit" like this:

For compilation into 32-bits:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe" into command line (note the x86 into the path)

For compilation into 64-bits:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe" into command line (note the x64 into the path)


Your command line should now output a lot of things. Compiling qt webengine requires lot of memory and space (around 90 Go on my computer and 60% of my 8 GO of RAM). Be sure to have place and free memory. It is long processing too

Compiling Qt webengine proprietary codecs

like image 97
Dardan Iljazi Avatar answered Oct 18 '22 05:10

Dardan Iljazi


If you get a message below after running qmake:

"A suitable version of python2 could not be found."

download the configure file here.

Extract it and run "_configure.py" with python2. It will configure your qt and that error goes away.

like image 27
user10753989 Avatar answered Oct 18 '22 06:10

user10753989


One addition to Dardan Iljazi's answer. After successful compilation, I couldn't launch application with proprietary codecs support. I had to do the following in the same console:

nmake install

This command copies all output from previous work to the Qt installation folder. So I can use the same kit in Qt Creator to build and debug app with proprietary codecs support.

Also I was stuck once on detecting python2. Hint: to clean qmake step of build process manually remove config.* files in your qtwebengine folder.

like image 1
Sergei Lebedev Avatar answered Oct 18 '22 06:10

Sergei Lebedev