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

Dardan Iljazi picture Dardan Iljazi · May 24, 2018 · Viewed 11k times · Source

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

Answer

Dardan Iljazi picture Dardan Iljazi · May 24, 2018

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:

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