我用 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 的 RAM 和構建期間的記憶體消耗從未超過 8 GB
htop
在構建程序中。
我運行時也沒有看到任何記憶體不足(OOM)錯誤
sudo dmesg
我做了相當多的谷歌搜索和論壇閱讀,但找不到答案。
uj5u.com熱心網友回復:
我找到了解決辦法。原來QtWebEngine默認使用系統忍者,但也有自己的忍者。我讀到使用系統忍者會導致問題,所以我通過添加切換到 QtWebEngine Ninja
-no-feature-webengine-system-ninja
到 qmake,像這樣:
qmake .. -- -proprietary-codecs -no-feature-webengine-system-ninja
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/491177.html
標籤:qt 编译器错误 铬 h.264 qtwebengine
