1

I wrote an application with QtWebEngine, but I need support for the h264 codec and QtWebEngine doesn't include it by default because of patent problems, or so I heard. That's why I decided to build QtWebEngine from source and enable proprietary codecs. I can't use the latest Qt6-based QtWebEngine, so I chose the most recent Qt5 version, which is 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

It manages to build most of the source, but then I get this message:

[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

Then I try to run this command manually:

/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

To run it manually, I change directory to

cd src/core/release 

and run this command. It works and the file compiles successfully, so I'm not sure if this particular file causes any problems. But the build fails anyway.

I have 24 GB of RAM and memory consumption during the build never goes above 8 GB, when I look at

htop

during the build.

Also I don't see any out of memory(OOM) errors when I run

sudo dmesg

I did a fair amount of Googling and forum reading, but couldn't find the answer.

1 Answer 1

0

I found a fix. It turns out QtWebEngine uses system Ninja by default, but also has its own Ninja. I read that using system Ninja can cause problems, so I switched to QtWebEngine Ninja by adding

-no-feature-webengine-system-ninja

to qmake, like so:

qmake .. -- -proprietary-codecs -no-feature-webengine-system-ninja
Sign up to request clarification or add additional context in comments.

1 Comment

Hi, I see you had worked out QtWebEngine compilation on ubuntu, Would you plz take a look at this problem. forum.qt.io/topic/138824/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.