8

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
Dardan Iljazi
  • 747
  • 1
  • 9
  • 16

3 Answers3

17

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

Community
  • 1
  • 1
Dardan Iljazi
  • 747
  • 1
  • 9
  • 16
  • for the records : you should use "vcvarsall amd64_x86" to compile x32 instead of the vcvars32 – VirusEcks Oct 31 '18 at 09:42
  • In Step 3, how does one add add a .exe to PATH? I can only add folders to PATH. I can set a .exe to a system variable - if this is what I should do, what should I name this system variable? – SamG101 Dec 05 '19 at 19:47
  • @SamG101 You are right, I did a mistake by saying we need to add .exe to system path, it should be ok to add the folder where the .exe file is. [How to add path to windows 10](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/) – Dardan Iljazi Dec 06 '19 at 19:17
  • Ah ok cool, if I also have Python 3 installed and the folders in PATH, do I have to move the Python 2 folders above the Python 3 folders so Python 2 is actually recognised?? – SamG101 Dec 06 '19 at 22:40
  • @SamG101 If you have a command tester on Windows (like cmder) and you type: "which python", it will show you the path to python that is taken into account. Normally if you put it above/earlier in the PATH it will take it first yes – Dardan Iljazi Dec 07 '19 at 13:22
  • I was having the error: "Needs Visual Studio 2017 or Higher" even if I had VS2017. The problem was that it might need a specific update of VS. I had the base one, but for Qt 5.12.4 it needs Update 3 or superior. I solved my problem installing the corresponding Update of Visual Studio. – fern17 Oct 19 '20 at 13:57
  • Make sure to use a traditional cmd, not the PowerShell. The environment configuration via vcvarsall doesn't work in PowerShell (at least in my case). – Krzysztof Nowak Jun 18 '21 at 22:56
1

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.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
1

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.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83