如何使用专有编解码器在 Windows 上编译 Qt webengine (5.11) [英] How to compile Qt webengine (5.11) on Windows with proprietary codecs
问题描述
我在编译 Qt 网络引擎以启用专有编解码器时遇到了很多麻烦,文档不是很清楚.我遵循了有关 stackoverflow 的其他说明,但它不起作用.我收到如下错误:
项目错误:无法运行编译器cl".输出:========================================也许你忘了设置环境?
或
需要 VS 2015 Update 3 with Cumulative Servicing Release 或更高版本将不会构建 Qt WebEngine.
或
无法检测到 Windows SDK 版本(未设置WindowsSDKVersion"环境变量).Windows 上的 Qt Webengine 需要 Windows SDK 版本 10.0.10586 或更高版本.QtWebEngine 不会被构建.
或
需要 Visual Studio 2017 或更高版本将不会构建 Qt WebEngine.
或
C1905:前端和后端不兼容(必须针对相同的处理器).LNK1257:代码生成失败
过去 5 天我遇到了所有这些问题.
如果您不知道如何开始编译 Qt webengine(使用或不使用专有编解码器),我正在做一个分步说明.如果您已经完成了一些步骤,您可以随意跳过它们.
如果你看到任何错误,如果这样做有错误,或者如果某些指令不清楚,请告诉我,以便我可以更新
1.安装 Visual Studio 2017
转到 上复制的原始说明并稍作修改)
下载:
- Python 2(实际上是 2.7.15,不支持 Python 3)来自 https://www.python.org/downloads/windows/
- 来自 http://strawberryperl.com/ 的 Perl(草莓版)
- 来自 https://sourceforge.net/projects/winflexbison/ 的 Bison 和 flex(重命名 win-bison.exe 到 bison.exe 和 win-flex.exe 到 flex.exe)
- 来自 http://gnuwin32.sourceforge.net/packages/gperf.htm
请务必将每个.exe添加到系统路径中,然后重新启动计算机.
4.使用专有编解码器(或不使用)编译 Qt 网络引擎
打开cmd.exe
(以管理员权限).
type cd
+ vcvarsall.bat
所在的 Microsoft Visual Studio 文件夹的路径:
cd "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuild"
编译为 32 位:
在命令行中输入vcvars32.bat
编译为 64 位:
在命令行中输入vcvars64.bat
进入Qt Sources所在路径,进入qtwebengine子目录:
cd "C:Qt5.11.0Srcqtwebengine";
编译为 32 位:
输入<代码>C:Qt5.11.0msvc2015inqmake.exe"-- -webengine-proprietary-codecs 进入命令行(注意链接指向 msvc 2015 32 位)
编译为 64 位:
输入<代码>C:Qt5.11.0msvc2017_64inqmake.exe"-- -webengine-proprietary-codecs 进入命令行(注意链接指向 msvc 2017 64 位)
您的控制台应如下所示(32 位):
结果:
现在你需要调用nmake.输入32 位或 64 位版本的 nmake.exe 的路径";像这样:
编译为 32 位:
C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428inHostx86x86
make.exe"
命令行(注意 x86 进入路径)
编译为 64 位:
C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428inHostx64x64
make.exe"
命令行(注意 x64 进入路径)
<块引用>
你的命令行现在应该输出很多东西.编译qtwebengine 需要大量内存和空间(大约 90 继续我的计算机和我的 8 GO RAM 的 60%).一定要有地方和自由记忆.也是长处理
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
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.
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
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 Studio2017CommunityVCAuxiliaryBuild"
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:Qt5.11.0Srcqtwebengine"
For compilation into 32-bits:
Type "C:Qt5.11.0msvc2015inqmake.exe" -- -webengine-proprietary-codecs
into command line (note the link is going to msvc 2015 32 bit)
For compilation into 64-bits:
Type "C:Qt5.11.0msvc2017_64inqmake.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):
And the result:
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 Studio2017CommunityVCToolsMSVC14.14.26428inHostx86x86
make.exe"
into command line (note the x86 into the path)
For compilation into 64-bits:
"C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428inHostx64x64
make.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
这篇关于如何使用专有编解码器在 Windows 上编译 Qt webengine (5.11)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!