CEF with Qt & QCefView without X on ARM

Discussion of current events and participation in intelligent conversation with other CEF users.

CEF with Qt & QCefView without X on ARM

Postby josullivan » Thu Jul 21, 2022 3:02 pm

Hi,

I have a Qt 5.2 app running on a 1GHz single core (no GPU) 512MB ARM device and I'm trying to integrate CEF3 to make some evaluation of how it may perform on this hardware. The QtWebKit used in this Qt version runs well on the platform but is not actively maintained so I'm looking for alternatives. A newer Qt with the bundled chromium might be another option but not without a bit more work. Even if performance due to the specs isn't very good, I'm interested to try this out first.

The platform does not have X installed, instead the input and display (framebuffer) are integrated using a QPA module for the Qt version. The approach I'm trying to use is to embed a QCefView (this was posted in another thread) widget in my app (that handles integrating the Qt & CEF event loops) with OSR, linking in CEF/Chromium. I'm not sure if it'll work on the arm build, but I did an x86 build (which does use X), using one of the Spotify builds and it worked nicely.

Trying something similar with the ARM spotify build didn't work, as it has X dependencies, so I'm trying to build without those now to see if it'll work. With a bit of googling I found some of the issues on Bitbucket where people were trying to build for similar use cases. It seems like the ozone platform abstraction allows this, but I'm not sure if it needs another backend (EGL, wayland etc.) or if it could work with the OSR in QCefView and thus go through the QPA and framebuffer.

I'm building according to the instructions here with the following configuration:

Code: Select all
$ python ../automate/automate-git.py --download-dir=$WORKSPACE/cef_build/chromium_git_arm --branch=5112 --depot-tools-dir=$WORKSPACE/cef_build/depot_tools --arm-build --no-distrib --no-build
$ export CEF_INSTALL_SYSROOT=arm
$ export GN_DEFINES="is_debug=false target_cpu=\"arm\" use_ozone=true ozone_platform_x11=false blink_symbol_level=0 use_sysroot=true use_allocator=none symbol_level=0 is_cfi=false use_thin_lto=false use_vaapi=false"
...


I've seen this issue just now.. so maybe this approach can't work without that?
josullivan
Newbie
 
Posts: 4
Joined: Mon Jul 18, 2022 6:29 pm

Re: CEF with Qt & QCefView without X on ARM

Postby magreenblatt » Thu Jul 21, 2022 6:16 pm

Ozone doesn't offer a framebuffer backend currently. We don't test "use_ozone=true ozone_platform_x11=false", and it's likely to have compile errors, but beyond that there's no fundamental reason to think it wouldn't work (assuming it can use some other platform instead of X11). Please update this thread with your changes if you do manage to get it working.
I'm not sure if it needs another backend (EGL, wayland etc.)

There does need to be some platform backend. You can see what's supported by ozone here.
magreenblatt
Site Admin
 
Posts: 12379
Joined: Fri May 29, 2009 6:57 pm

Re: CEF with Qt & QCefView without X on ARM

Postby josullivan » Tue Jul 26, 2022 11:26 am

I got this at the start of the build

Code: Select all
~/Source/cef_build/chromium_git_arm/chromium/src$ ninja -C out/Release_GN_arm/ cefsimple ceftests chrome_sandbox
ninja: Entering directory `out/Release_GN_arm/'
ninja: error: '../../ui/aura/test/ui_controls_factory_ozone.cc', needed by 'obj/cef/libcef_static/ui_controls_factory_ozone.o', missing and no known rule to make it


It appeared to be some file naming problem, so I just renamed ui_controls_ozone.* to ui_controls_factory_ozone.* as a workaround to get the build going.

After that it proceeded fine until near the end, where there's some dynamic library missing for this v8_context_snapshot_generator executable

Code: Select all
~/Work/Source/cef_build/chromium_git_arm/chromium/src$ ninja -C out/Release_GN_arm/ cefsimple ceftests chrome_sandbox
ninja: Entering directory `out/Release_GN_arm/'
[4658/5196] ACTION //tools/v8_context_snapshot:generate_v8_context_snapshot(//build/toolchain/linux:clang_x86_v8_arm)
FAILED: v8_context_snapshot.bin
python3 ../../build/gn_run_binary.py ./clang_x86_v8_arm/v8_context_snapshot_generator --output_file=v8_context_snapshot.bin
././clang_x86_v8_arm/v8_context_snapshot_generator: error while loading shared libraries: libglib-2.0.so.0: wrong ELF class: ELFCLASS64
./clang_x86_v8_arm/v8_context_snapshot_generator failed with exit code 127
ninja: build stopped: subcommand failed.


Checking its dependencies using ldd (though i'm not sure it reflects the environment during the ninja build) I see

Code: Select all
~/Work/Source/cef_build/chromium_git_arm/chromium/src$ ldd ./out/Release_GN_arm/clang_x86_v8_arm/v8_context_snapshot_generator
        linux-gate.so.1 (0xf7fcb000)
        libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf066d000)
        libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf064a000)
        libglib-2.0.so.0 => not found
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf0545000)
        libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf0526000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf0337000)
        /lib/ld-linux.so.2 (0xf7fcd000)


I'm not sure if it's expecting some system multiarch library like the rest of the libs there - on my system (Lubuntu 20.04 amd64) I don't see any i386 equivalent for glib2.0. So maybe it's finding the system's x64 libglib-2.0.so.0 when trying to run that executable, which might explain the ELFCLASS64 message.

I see there are libglib-2.0.so.0 libraries in the sysroots but I'm not sure they're the ones that should be used here, I tried adding the i386 one to LD_LIBRARY_PATH & LD_PRELOAD but I got errors about it being ELFCLASS32.

Code: Select all
~/Work/Source/cef_build/chromium_git_arm/chromium/src$ find | grep libglib-2.0.so.0
./build/linux/debian_bullseye_arm-sysroot/usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
./build/linux/debian_bullseye_arm-sysroot/usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0.6600.8
./build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
./build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.8
./build/linux/debian_bullseye_i386-sysroot/usr/lib/i386-linux-gnu/libglib-2.0.so.0
./build/linux/debian_bullseye_i386-sysroot/usr/lib/i386-linux-gnu/libglib-2.0.so.0.6600.8
josullivan
Newbie
 
Posts: 4
Joined: Mon Jul 18, 2022 6:29 pm

Re: CEF with Qt & QCefView without X on ARM

Postby magreenblatt » Tue Jul 26, 2022 11:32 am

You need to run the following:
Code: Select all
apt-get install -y libglib2.0-0:i386

See viewtopic.php?f=7&t=17776&p=46448#p47371
magreenblatt
Site Admin
 
Posts: 12379
Joined: Fri May 29, 2009 6:57 pm

Re: CEF with Qt & QCefView without X on ARM

Postby josullivan » Tue Jul 26, 2022 3:01 pm

Thanks, for some reason i wasn't finding it with apt-search but it installs alright.

At that point it builds but then fails on some X dependencies towards the end.

Code: Select all
~/Work/Source/cef_build/chromium_git_arm/chromium/src$ ninja -C out/Release_GN_arm/ cefsimple ceftests chrome_sandbox
ninja: Entering directory `out/Release_GN_arm/'
[435/539] CXX obj/cef/libcef_static/x11_event_waiter.o
FAILED: obj/cef/libcef_static/x11_event_waiter.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/cef/libcef_static/x11_event_waiter.o.d -DDCHECK_ALWAYS_ON=1 -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"llvmorg-15-init-11722-g3f3a235a-2\" -D_LIBCPP_ABI_NAMESPACE=Cr -D_LIBCPP_ABI_VERSION=2 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_DEBUG=0 -DCR_LIBCXX_REVISION=b1269813eaf5b8ac78e35e45a0f7cc320bd3e7d6 -DCR_SYSROOT_HASH=a1084eba943f797a1c9aee8d5f8213ed680315a8 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DBUILDING_CEF_SHARED -DUSING_CHROMIUM_INCLUDES -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DWEBP_EXTERN=extern -DUSE_EGL -DVK_USE_PLATFORM_WAYLAND_KHR -DON_FOCUS_PING_ENABLED -D_WTL_NO_AUTOMATIC_NAMESPACE -DTOOLKIT_VIEWS=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DWEBRTC_USE_BUILTIN_ISAC_FIX=1 -DWEBRTC_USE_BUILTIN_ISAC_FLOAT=0 -DWEBRTC_USE_PIPEWIRE -DWEBRTC_DLOPEN_PIPEWIRE -DWEBRTC_USE_GIO -DLOGGING_INSIDE_WEBRTC -DV8_USE_EXTERNAL_STARTUP_DATA -DUSE_V8_CONTEXT_SNAPSHOT -DV8_CONTEXT_SNAPSHOT_FILENAME=\"v8_context_snapshot.bin\" -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_ENABLE_SKSL -DSK_UNTIL_CRBUG_1187654_IS_FIXED -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_WIN_FONTMGR_NO_SIMULATIONS -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_HAS_WUFFS_LIBRARY -DSK_VULKAN=1 -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DLEVELDB_PLATFORM_CHROMIUM=1 -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DATK_LIB_DIR=\"/usr/lib/arm-linux-gnueabihf\" -DUSE_ATK_BRIDGE -DV8_DEPRECATION_WARNINGS -DUSE_CUPS -DI18N_ADDRESS_VALIDATION_DATA_URL=\"https://chromium-i18n.appspot.com/ssl-aggregate-address/\" -DVK_NO_PROTOTYPES -DFLATBUFFERS_LOCALE_INDEPENDENT=0 -DHUNSPELL_STATIC -DHUNSPELL_CHROME_CLIENT -DUSE_HUNSPELL -DFT_CONFIG_MODULES_H=\"freetype-custom/freetype/config/ftmodule.h\" -DFT_CONFIG_OPTIONS_H=\"freetype-custom/freetype/config/ftoption.h\" -DPDFIUM_REQUIRED_MODULES -DCHROMIUM_RESTRICT_VISIBILITY -I../../third_party/crashpad/crashpad -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../cef -Iincludes -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../third_party/libyuv/include -I../../third_party/jsoncpp/source/include -I../../third_party/libwebp/src -I../../third_party/vulkan-deps/vulkan-headers/src/include -I../../third_party/khronos -I../../gpu -Igen/third_party/dawn/include -I../../third_party/dawn/include -I../../third_party/dawn/src/include -Igen/third_party/private_membership/src -Igen/third_party/shell-encryption/src -Igen/components/policy/proto -I../../third_party/wtl/include -I../../third_party/abseil-cpp -I../../third_party/boringssl/src/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/ced/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../net/third_party/quiche/overrides -I../../net/third_party/quiche/src/quiche/common/platform/default -I../../net/third_party/quiche/src -Igen/net/third_party/quiche/src -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/skia -I../../third_party/wuffs/src/release/c -I../../third_party/vulkan/include -I../../third_party/libwebm/source -I../../third_party/mesa_headers -I../../third_party/leveldatabase -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase/src/include -I../../third_party/libaom/source/libaom -I../../third_party/crashpad/crashpad/compat/linux -I../../third_party/crashpad/crashpad/compat/non_win -I../../third_party/zlib -I../../v8/include -Igen/v8/include -Igen/third_party/metrics_proto -I../../third_party/re2/src -I../../third_party/libaddressinput/src/cpp/include -I../../third_party/flatbuffers/src/include -I../../third_party/brotli/include -I../../third_party/libxml/src/include -I../../third_party/libxml/linux/include -I../../third_party/freetype/include -I../../third_party/freetype/include/freetype-custom -I../../third_party/freetype/src/include -I../../third_party/harfbuzz-ng/src/src -I../../third_party/fontconfig/src -I../../third_party/angle/include -Wall -Werror -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Xclang -no-opaque-pointers -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers --target=arm-linux-gnueabihf -march=armv7-a -mfloat-abi=hard -mtune=generic-armv7-a -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -mfpu=neon -mthumb -ftrivial-auto-var-init=pattern -O2 -fdata-sections -ffunction-sections -fno-unique-section-names -fno-omit-frame-pointer -g0 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/glib-2.0 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -DPROTOBUF_ALLOW_DEPRECATED=1 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/nss -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/nspr -Wno-shadow -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/at-spi2-atk/2.0 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/at-spi-2.0 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/dbus-1.0 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/atk-1.0 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/include/glib-2.0 -isystem../../build/linux/debian_bullseye_arm-sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include -DLIBXML_STATIC= -std=c++17 -Wno-trigraphs -fno-aligned-new -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_bullseye_arm-sysroot -fvisibility-inlines-hidden -Wno-deprecated-declarations -c ../../ui/events/test/x11_event_waiter.cc -o obj/cef/libcef_static/x11_event_waiter.o
In file included from ../../ui/events/test/x11_event_waiter.cc:5:
In file included from ../../ui/events/test/x11_event_waiter.h:10:
../../ui/gfx/x/connection.h:16:10: fatal error: 'ui/gfx/x/extension_manager.h' file not found
#include "ui/gfx/x/extension_manager.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


That target is excluded for !ozone_platform_x11 in chromium but I see it included in the CEF Build.gn. If I comment out the x11_event_waiter.* from there it builds a bit further but hits that header dependency again for browser_platform_delegate_native_linux.o

Code: Select all
In file included from ../../cef/libcef/browser/native/browser_platform_delegate_native_linux.cc:19:
In file included from ../../ui/events/keycodes/keyboard_code_conversion_x.h:14:
../../ui/gfx/x/connection.h:16:10: fatal error: 'ui/gfx/x/extension_manager.h' file not found
#include "ui/gfx/x/extension_manager.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


Maybe I can just omit this bit of code that uses this keyboard conversion stuff in CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent..
josullivan
Newbie
 
Posts: 4
Joined: Mon Jul 18, 2022 6:29 pm

Re: CEF with Qt & QCefView without X on ARM

Postby josullivan » Tue Jul 26, 2022 7:49 pm

Okay the build finished with the following diff.

Code: Select all

diff --git a/BUILD.gn b/BUILD.gn
index 4b17a4b92..9d101cae2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1180,8 +1180,8 @@ static_library("libcef_static") {
         "//ui/aura/test/aura_test_utils.cc",
         "//ui/aura/test/aura_test_utils.h",
         # Part of //ui/events:test_support which is testingonly.
-        "//ui/events/test/x11_event_waiter.cc",
-        "//ui/events/test/x11_event_waiter.h",
+#        "//ui/events/test/x11_event_waiter.cc",
+#        "//ui/events/test/x11_event_waiter.h",
         # Part of //ui/ozone::ui_test_support which is testingonly.
         "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.cc",
         "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.h",
diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.cc b/libcef/browser/native/browser_platform_delegate_native_linux.cc
index 5972a3134..56991a833 100644
--- a/libcef/browser/native/browser_platform_delegate_native_linux.cc
+++ b/libcef/browser/native/browser_platform_delegate_native_linux.cc
@@ -16,13 +16,13 @@
 #include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
 #include "ui/events/keycodes/dom/dom_key.h"
 #include "ui/events/keycodes/dom/keycode_converter.h"
-#include "ui/events/keycodes/keyboard_code_conversion_x.h"
-#include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
 #include "ui/events/keycodes/keysym_to_unicode.h"
 #include "ui/gfx/font_render_params.h"
 #include "ui/views/widget/widget.h"
 
 #if BUILDFLAG(OZONE_PLATFORM_X11)
+#include "ui/events/keycodes/keyboard_code_conversion_x.h"
+#include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
 #include "libcef/browser/native/window_x11.h"
 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
 #endif
@@ -235,6 +235,7 @@ CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
 
 ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
     const CefKeyEvent& key_event) const {
+#if 0
   int flags = TranslateUiEventModifiers(key_event.modifiers);
   ui::KeyboardCode key_code =
       static_cast<ui::KeyboardCode>(key_event.windows_key_code);
@@ -264,6 +265,8 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
 
   ui::DomKey dom_key = ui::XKeySymToDomKey(keysym, character);
   return ui::KeyEvent(type, key_code, dom_code, flags, dom_key, time_stamp);
+#endif
+  return ui::KeyEvent(ui::PlatformEvent());
 }
 
 content::NativeWebKeyboardEvent


It seems to have had the desired effect of eliminating most of the X dependencies (i.e. the ones in the spotify ARM build), though I still see xkbcommon. I'm still not sure if it makes sense as a build - my understanding of backends in general, and especially how they'll work in chromium/cef when linked by QCefView, isn't so good, but i'll see about linking anyway.
josullivan
Newbie
 
Posts: 4
Joined: Mon Jul 18, 2022 6:29 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests