我用QtWebEngine编写了一个应用程序,但我需要对h264编解码器的支持,而且由于专利问题,QtWebEngine默认不包括它。这就是我决定从源代码构建QtWebEngine并启用专有编解码器的原因。我不能使用最新的基于Qt6的QtWebEngine,所以我选择了最新的Qt5版本,即5.15.10。
# Installing dependencies:
sudo apt install gperf perl flex bison python2 libnss3-dev qtdeclarative5-private-dev
sudo apt install libdrm-dev libxcomposite-dev libxcomposite1 libnx-x11-dev libxkbfile-dev libxtst-dev libxdamage-dev libxdamage1 libxrandr-dev libxrandr2 libxkbfile-dev libxkbfile1 libx11-xcb-dev
# Getting source code
git clone -b 5.15.10 https://github.com/qt/qtwebengine.git
cd qtwebengine
git submodule update --init --recursive
# Checking versions of Python and g++
python --version
> Python 2.7.18
g++ --version
> g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
# Creating build directory and building
mkdir build
cd build
qmake .. -- -proprietary-codecs
make -j4 -l4它成功地构建了大部分源代码,但随后我得到了以下消息:
[16150/25745] /usr/bin/g++ -MMD -MF obj/third_party/webrtc/modules/congestion_controller/rtp/control_handler/control_handler.o.d -DUSE_UDEV -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DOFFICIAL_BUILD -DTOOLKIT_QT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBRTC_ENABLE_PROTOBUF=1 -DRTC_ENABLE_VP9 -DHAVE_SCTP -DENABLE_EXTERNAL_AUTH -DWEBRTC_USE_H264 -DHAVE_WEBRTC_VIDEO -DLOGGING_INSIDE_WEBRTC -DWEBRTC_LIBRARY_IMPL -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DNO_MAIN_THREAD_WRAPPING -Igen -I../../../../src/3rdparty/chromium -I../../../../src/3rdparty/chromium/third_party/webrtc_overrides -I../../../../src/3rdparty/chromium/third_party/webrtc -Igen/third_party/webrtc -I../../../../src/3rdparty/chromium/third_party/abseil-cpp -I../../../../src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -Igen -I../../../../src/3rdparty/chromium/third_party/libyuv/include -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pipe -pthread -m64 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -fno-delete-null-pointer-checks -Wno-comments -Wno-packed-not-aligned -Wno-dangling-else -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fvisibility=hidden -std=gnu++14 -Wno-narrowing -Wno-class-memaccess -Wno-attributes -Wno-class-memaccess -Wno-subobject-linkage -Wno-invalid-offsetof -Wno-return-type -Wno-deprecated-copy -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -c ../../../../src/3rdparty/chromium/third_party/webrtc/modules/congestion_controller/rtp/control_handler.cc -o obj/third_party/webrtc/modules/congestion_controller/rtp/control_handler/control_handler.o
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile.gn_run:436: run_ninja] Error 1
make[3]: Leaving directory '/home/max/Documents/qtwebengine/build/src/core'
make[2]: *** [Makefile:82: sub-gn_run-pro-make_first] Error 2
make[2]: Leaving directory '/home/max/Documents/qtwebengine/build/src/core'
make[1]: *** [Makefile:80: sub-core-make_first] Error 2
make[1]: Leaving directory '/home/max/Documents/qtwebengine/build/src'
make: *** [Makefile:49: sub-src-make_first] Error 2然后,我尝试手动运行这个命令:
/usr/bin/g++ -MMD -MF obj/third_party/webrtc/modules/congestion_controller/rtp/control_handler/control_handler.o.d -DUSE_UDEV -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DOFFICIAL_BUILD -DTOOLKIT_QT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBRTC_ENABLE_PROTOBUF=1 -DRTC_ENABLE_VP9 -DHAVE_SCTP -DENABLE_EXTERNAL_AUTH -DWEBRTC_USE_H264 -DHAVE_WEBRTC_VIDEO -DLOGGING_INSIDE_WEBRTC -DWEBRTC_LIBRARY_IMPL -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DNO_MAIN_THREAD_WRAPPING -Igen -I../../../../src/3rdparty/chromium -I../../../../src/3rdparty/chromium/third_party/webrtc_overrides -I../../../../src/3rdparty/chromium/third_party/webrtc -Igen/third_party/webrtc -I../../../../src/3rdparty/chromium/third_party/abseil-cpp -I../../../../src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -Igen -I../../../../src/3rdparty/chromium/third_party/libyuv/include -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pipe -pthread -m64 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -fno-delete-null-pointer-checks -Wno-comments -Wno-packed-not-aligned -Wno-dangling-else -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fvisibility=hidden -std=gnu++14 -Wno-narrowing -Wno-class-memaccess -Wno-attributes -Wno-class-memaccess -Wno-subobject-linkage -Wno-invalid-offsetof -Wno-return-type -Wno-deprecated-copy -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -c ../../../../src/3rdparty/chromium/third_party/webrtc/modules/congestion_controller/rtp/control_handler.cc -o obj/third_party/webrtc/modules/congestion_controller/rtp/control_handler/control_handler.o要手动运行它,我将目录更改为
cd src/core/release 然后运行这个命令。它工作正常,文件编译成功,所以我不确定这个特定的文件是否会导致任何问题。但无论如何,构建都失败了。
我有24 GB的内存和内存消耗在构建过程中从未超过8GB,当我看到
htop在建筑过程中。
此外,我在运行时没有看到任何内存不足(OOM)错误
sudo dmesg我做了相当多的谷歌和论坛阅读,但没有找到答案。
发布于 2022-06-13 16:58:48
我找到解决办法了。事实证明,QtWebEngine默认使用system,但也有自己的忍者。我读到使用系统忍者可能会导致问题,所以我切换到QtWebEngine忍者通过添加
-no-feature-webengine-system-ninja就像这样:
qmake .. -- -proprietary-codecs -no-feature-webengine-system-ninjahttps://stackoverflow.com/questions/72575989
复制相似问题