visual-studio - 如何使用专有编解码器在 Windows 上编译 Qt webengine (5.11)

标签 visual-studio qt build compiler-errors qtwebengine

我在将 Qt webengine 编译到 时遇到了很多麻烦启用专有编解码器 ,文档不是很清楚。我按照stackoverflow上的其他说明进行操作,但它不起作用。我收到如下错误:

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

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

或者
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.

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

或者
C1905: Front end and back end not compatible (must target same processor).
LNK1257: code generation failed

最佳答案

在过去的 5 天里,我遇到了所有这些问题。
如果您不知道如何开始编译 Qt webengine(使用或不使用专有编解码器),我将逐步说明。
如果你已经完成了一些步骤,你可以自由地跳过它们。
如果您看到任何错误,如果这样做有错误,或者如果某些说明不清楚,请告诉我,以便我更新
1.安装Visual Studio 2017
转至 https://www.visualstudio.com/fr/downloads/并下载 Visual Studio 2017。
Visual Sutdio Qt webengine minimum prerequisities
当这个窗口出现时,检查Desktop Development for C++并确保 VC++ toolset 2015.3v v14.00 (v140)SDK Windows 10 (10.0.xxxxx.x)被检查。
安装并等待它完成。
2.安装Qt源码qt webengine
打开MaintenanceTool.exe出现在 Qt 文件夹中
添加或删除模块
Qt webengine minimum prerequisities
请务必至少检查:MSVC 2015 32-bit , MSVC 2015 64-bit , MSVC 2017 64-bit , Sources , Qt WebEngine安装并等待它完成。
3.安装Qt webengine compile prerequisities
(从 this thread 上的 Sébastien Bémelmans 复制的原始说明并稍作修改)
下载:

  • 来自 https://www.python.org/downloads/windows/ 的 Python 2(实际上是 2.7.15,不支持 Python 3)
  • Perl(草莓版)来自 http://strawberryperl.com/
  • 来自 https://sourceforge.net/projects/winflexbison/ 的 Bison 和 flex (将 win-bison.exe 重命名为 bison.exe,将 win-flex.exe 重命名为 flex.exe)
  • Gperf 来自 http://gnuwin32.sourceforge.net/packages/gperf.htm

  • 确保将每个 .exe 添加到系统路径,然后重新启动计算机。
    4. 使用专有编解码器(或不使用)编译 Qt webengine
    打开cmd.exe (具有管理员权限)。
    类型 cd + Microsoft Visual Studio 文件夹的路径,其中 vcvarsall.bat位于:cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
    编译成 32 位:
    输入 vcvars32.bat进入命令行
    编译成 64 位:
    输入 vcvars64.bat进入命令行

    进入Qt的Sources所在路径,进入qtwebengine子目录:
    cd "C:\Qt\5.11.0\Src\qtwebengine"
    

    编译成 32 位:
    输入 "C:\Qt\5.11.0\msvc2015\bin\qmake.exe" -- -webengine-proprietary-codecs进入命令行(注意链接将指向 msvc 2015 32 位)
    编译成 64 位:
    输入 "C:\Qt\5.11.0\msvc2017_64\bin\qmake.exe" -- -webengine-proprietary-codecs进入命令行(注意链接将指向 msvc 2017 64 位)

    您的控制台应如下所示(32 位):
    Compile Qt webengine proprietary codecs
    结果:
    Compile Qt webengine with proprietary codecs

    现在你需要调用nmake。键入“32 位或 64 位版本的 nmake.exe 的路径”,如下所示:
    编译成 32 位:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe"进入命令行(注意x86进入路径)
    编译成 64 位:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe"进入命令行(注意 x64 进入路径)

    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

    关于visual-studio - 如何使用专有编解码器在 Windows 上编译 Qt webengine (5.11),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50510457/

    相关文章:

    c++ - 在 C++ 项目的 C 部分 (VS10)

    c# - 使用非字符串作为字符串时如何显示错误(而不是自动使用 ToString)?

    .net - 如何将类库项目转换为NuGet包

    c++ - 通过不同的线程使用 QTcpSockets

    Qt 和 std::bind

    windows - `echo.` Windows 上生成失败

    git - 如何在具有多个协作者的环境中使用本地化的 PostBuildEvent?

    qt - QDockWidget 停靠在主窗口右侧时尺寸错误

    java - 当尝试从 gradle 运行一个简单的 ant 脚本时,我得到 "srcdir does not exist"

    build - 使用动态选择的 Hudson 或 Jenkins 参数化构建