Screenly / Anthias

The world's most popular open source digital signage project.
https://anthias.screenly.io
Other
2.34k stars 596 forks source link

Can't compile Webview in docker. #1802

Open lexalexalexa opened 1 year ago

lexalexalexa commented 1 year ago

Overview of the Issue

I am trying to compile ScreenlyWebview project, but met error in qmake actions (see below).

Reproduction Steps

  1. Install docker with follow instruction.
  2. Run:
    $ cd webview
    $ docker buildx build \
    --load \
    --build-arg GIT_HASH=$(git rev-parse --short HEAD) \
    -t qt-builder .
  3. Run:
    $ docker run --rm -t \
    -v ~/tmp/qt-src:/src:Z \
    -v ~/tmp/qt-build:/build:Z \
    -v $(pwd):/webview:ro \
    qt-builder

    Environment

Comments

I met 2 problems:

  1. When I run command to build docker container (docker buildx build...) I met 3 missing packets in Docker file install list: g++-multilib, gcc-multilib, lib32z1-dev. As i right understood these packets are not availible for arm at all - i delete following strings from Dockerfile
  2. After then I run build project command (docker run --rm -t...) and met error in the end of qt building:
    ............Done.
    Info: creating super cache file /src/pi4/.qmake.super
    Info: creating cache file /src/pi4/.qmake.cache
    Project ERROR: Cannot run target compiler '/src/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++'. Output:
    ===================
    ===================
    Maybe you forgot to setup the environment?

Question

What is my mistake and how can I compile the QT project?

vpetersson commented 1 year ago

You will never be able to compile qtwebview on a pi. You need some serious hardware for it. We build it in a very large VM on google cloud.

lexalexalexa commented 1 year ago

You will never be able to compile qtwebview on a pi. You need some serious hardware for it. We build it in a very large VM on google cloud.

Which OS do you use on VM?

vpetersson commented 1 year ago

See https://github.com/Screenly/Anthias/tree/master/webview

Debian for the os.

lexalexalexa commented 1 year ago

Debian for the os.

I installed Debian Bullseye on VM (24Cores/256Gb) and run script. Now when starting Dockerfile I got error:

 => ERROR [builder 2/3] RUN apt-get update &&     apt-get install -y         apt-utils         firebird-dev         freetds-dev        0.9s
------
 > [builder 2/3] RUN apt-get update &&     apt-get install -y         apt-utils         firebird-dev         freetds-dev         gstreamer-tools         gstreamer1.0-plugins-base         gstreamer1.0-plugins-good         gstreamer1.0-plugins-ugly         gstreamer1.0-x         libasound2-dev         libavcodec-dev         libavformat-dev         libavutil-dev         libbz2-dev         libcap-dev         libdbus-1-dev         libdbus-glib-1-dev         libdrm-dev         libegl1-mesa-dev         libevent-dev         libfontconfig1-dev         libfreetype6-dev         libgbm-dev         libgcrypt20-dev         libgles2-mesa-dev         libglib2.0-dev         libgst-dev         libgstreamer-plugins-base1.0-dev         libgstreamer1.0-dev         libicu-dev         libinput-dev         libiodbc2-dev         libjpeg62-turbo-dev         libjsoncpp-dev         libminizip-dev         libnss3-dev         libopus-dev         libpci-dev         libpng-dev         libpng16-16         libpq-dev         libpulse-dev         libraspberrypi-bin         libraspberrypi0         librsvg2-common         libsnappy-dev         libsqlite0-dev         libsqlite3-dev         libsrtp0-dev         libsrtp2-dev         libssl-dev         libssl1.1         libswscale-dev         libsystemd-dev         libts-dev         libudev-dev         libvpx-dev         libwayland-dev         libwebp-dev         libx11-dev         libx11-xcb-dev         libx11-xcb1         libxcb-glx0-dev         libxcb-icccm4         libxcb-icccm4-dev         libxcb-image0         libxcb-image0-dev         libxcb-keysyms1         libxcb-keysyms1-dev         libxcb-randr0-dev         libxcb-render-util0         libxcb-render-util0-dev         libxcb-shape0-dev         libxcb-shm0         libxcb-shm0-dev         libxcb-sync-dev         libxcb-sync1         libxcb-xfixes0-dev         libxcb-xinerama0         libxcb-xinerama0-dev         libxcb1         libxcb1-dev         libxext-dev         libxi-dev         libxkbcommon-dev         libxrender-dev         libxslt1-dev         libxss-dev         libxtst-dev         nodejs         ruby         va-driver-all         wget:

#0 0.598 exec /bin/sh: exec format error

------
Dockerfile:6

In what is the a problem? What version of docker do you use?

lexalexalexa commented 1 year ago

@vpetersson , I think script has been worked only on a specific version of Docker and Debian, because I tried it under Ubuntu and got same error. Could you pls tell me which version of Docker and Debian do you use?

vpetersson commented 1 year ago

You're not using cross compilation. Please review the README more carefully (in particular the article Compiling Qt with Docker multi-stage and multi-platform if you're not familiar with multi-platform docker builds with buildx).

lexalexalexa commented 1 year ago

I moved farther and met next problem when run docker run --rm -t -v ~/tmp/qt-src:/src:Z -v ~/tmp/qt-build:/build:Z -v $(pwd):/webview:ro qt-builder command:

[14931/20662] ccache /src/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -MMD -MF obj/content/browser/browser/background_fetch_registration_service_impl.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 -DCR_SYSROOT_HASH=3fcc1d4e44127006318371002a0f421a4fde2ab4 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DCONTENT_IMPLEMENTATION -DVK_NO_PROTOTYPES -DUSE_EGL -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 -DUCHAR_TYPE=uint16_t -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_USE_LIBGIFCODEC -DSK_VULKAN_HEADER=\"../../skia/config/SkVulkanConfig.h\" -DSK_VULKAN=1 -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DVK_NO_PROTOTYPES -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DUSE_SYSTEM_ZLIB=1 -DLEVELDB_PLATFORM_CHROMIUM=1 -DLEVELDB_PLATFORM_CHROMIUM=1 -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 -DHAVE_SCTP -DNO_MAIN_THREAD_WRAPPING -DSQLITE_OMIT_ANALYZE -DSQLITE_OMIT_AUTOINIT -DSQLITE_OMIT_AUTORESET -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_EXPLAIN -DSQLITE_OMIT_GET_TABLE -DSQLITE_DEFAULT_LOOKASIDE=0,0 -DSQLITE_OMIT_LOOKASIDE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_REINDEX -DSQLITE_OMIT_TRACE -DSQLITE_OMIT_UPSERT -DSQLITE_OMIT_WINDOWFUNC -DSQLITE_ENABLE_FTS3 -DSQLITE_DISABLE_FTS3_UNICODE -DSQLITE_DISABLE_FTS4_DEFERRED -DSQLITE_ENABLE_ICU -DSQLITE_SECURE_DELETE -DSQLITE_THREADSAFE=1 -DSQLITE_MAX_WORKER_THREADS=0 -DSQLITE_MAX_MMAP_SIZE=268435456 -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 -DSQLITE_DEFAULT_MEMSTATUS=1 -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_PCACHE_INITSZ=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_USE_ALLOCA -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_HAVE_ISNAN -DSQLITE_ENABLE_BATCH_ATOMIC_WRITE -DSQLITE_TEMP_STORE=3 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DPERFETTO_IMPLEMENTATION -DV8_DEPRECATION_WARNINGS -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -Igen -Igen -Igen -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libyuv/include -Igen -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/khronos -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/gpu -Igen/third_party/dawn/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/dawn/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/source/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/generated -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/ced/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/common -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libgifcodec -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/vulkanmemoryallocator -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/non_mac -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/non_win -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libwebm/source -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/webrtc_overrides -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/webrtc -Igen/third_party/webrtc -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp -Igen/third_party/metrics_proto -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/v8/include -Igen/v8/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/mesa_headers -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/angle/src/common/third_party/base -Igen/angle -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/angle/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/brotli/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/re2/src -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pipe -pthread -march=armv8-a -mfloat-abi=hard -mtune=cortex-a72 -mfpu=neon -mthumb -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wno-psabi -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 -I/sysroot/usr/include/nss -I/sysroot/usr/include/nspr -I/sysroot/usr/include/dbus-1.0 -I/sysroot/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -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 --sysroot=../../../../../../sysroot -fvisibility-inlines-hidden -Wno-deprecated-declarations -c ../../../../../qt5/qtwebengine/src/3rdparty/chromium/content/browser/background_fetch/background_fetch_registration_service_impl.cc -o obj/content/browser/browser/background_fetch_registration_service_impl.o
ninja: build stopped: subcommand failed.
make[4]: *** [Makefile.gn_run:727: run_ninja] Error 1
make[4]: Leaving directory '/src/pi4/qtwebengine/src/core'
make[3]: *** [Makefile:82: sub-gn_run-pro-make_first] Error 2
make[3]: Leaving directory '/src/pi4/qtwebengine/src/core'
make[2]: *** [Makefile:79: sub-core-make_first] Error 2
make[2]: Leaving directory '/src/pi4/qtwebengine/src'
make[1]: *** [Makefile:49: sub-src-make_first] Error 2
make[1]: Leaving directory '/src/pi4/qtwebengine'
make: *** [Makefile:370: module-qtwebengine-make_first] Error 2

Could you pls advice what is the problem?

vpetersson commented 1 year ago

Hard to say, but it's very RAM consuming, so you might have run out of RAM if you are running with anything less than 32GB.

lexalexalexa commented 1 year ago

@vpetersson , finally I compiled project.

And I have another question: I am trying to replace vlc/omxplayer for playing videos and try to change them on QVideoVideo with QMediaPlayer instead to prevent issues with VLC and make "all in one" view application for all types of files.

I changed code with including into "mainwindow.h" of these lines:

#include <QVideoWidget>
#include <QMediaPlayer>

And when I am trying to compile this with command:

$ docker run --rm -t \
    -v ~/tmp/qt-src:/src:Z \
    -v ~/tmp/qt-build:/build:Z \
    -v $(pwd):/webview:ro \
    qt-builder

I got error message:

/src/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/sysroot -O2 -std=gnu++11 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WEBENGINE_LIB -DQT_WEBENGINEWIDGETS_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_CORE_LIB -I. -I/src/qt5/qtwebengine/include -I/src/qt5/qtwebengine/include/QtWebEngine -I../qtwebengine/include -I../qtwebengine/include/QtWebEngine -I/src/qt5/qtwebengine/include/QtWebEngineWidgets -I../qtwebengine/include/QtWebEngineWidgets -I/src/qt5/qtwebengine/include/QtWebEngineCore -I../qtwebengine/include/QtWebEngineCore -I/src/qt5/qtdeclarative/include -I/src/qt5/qtdeclarative/include/QtQuick -I../qtdeclarative/include -I../qtdeclarative/include/QtQuick -I/src/qt5/qtbase/include -I/src/qt5/qtbase/include/QtWidgets -I../qtbase/include -I../qtbase/include/QtWidgets -I/src/qt5/qtbase/include/QtGui -I../qtbase/include/QtGui -I/src/qt5/qtdeclarative/include/QtQmlModels -I../qtdeclarative/include/QtQmlModels -I/src/qt5/qtwebchannel/include -I/src/qt5/qtwebchannel/include/QtWebChannel -I../qtwebchannel/include -I../qtwebchannel/include/QtWebChannel -I/src/qt5/qtdeclarative/include/QtQml -I../qtdeclarative/include/QtQml -I/src/qt5/qtbase/include/QtNetwork -I../qtbase/include/QtNetwork -I/src/qt5/qtbase/include/QtDBus -I../qtbase/include/QtDBus -I/src/qt5/qtbase/include/QtCore -I../qtbase/include/QtCore -I. -I../qt5pi/mkspecs/devices/linux-rasp-pi4-v3d-g++ -o moc_mainwindow.o moc_mainwindow.cpp
In file included from src/mainwindow.cpp:12:0:
src/mainwindow.h:11:10: fatal error: QVideoWidget: No such file or directory
 #include <QVideoWidget>
          ^~~~~~~~~~~~~~
compilation terminated.
In file included from moc_mainwindow.cpp:10:0:
src/mainwindow.h:11:10: fatal error: QVideoWidget: No such file or directory
 #include <QVideoWidget>
          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:3375: mainwindow.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:3669: moc_mainwindow.o] Error 1
In file included from src/main.cpp:7:0:
src/mainwindow.h:11:10: fatal error: QVideoWidget: No such file or directory
 #include <QVideoWidget>
          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:3037: main.o] Error 1

As I understood linaro compiler can't find "qmultimedia" library, but I can't find where and why compiling of "qmultimedia" was ignored.

Could you help me to understand what is wrong?

vpetersson commented 1 year ago

I haven't worked on the internals of this at all. Maybe @rusko124 have some ideas.

nicomiguelino commented 1 month ago

@lexalexalexa, given that you're including QVideoWidget, you should also modify webview/ScreenlyWebview.pro to include the multimediawidgets submodule:

# ...
QT += webengine webenginewidgets dbus multimediawidgets
# ...

More info about QVideoWidget can be found here: https://doc.qt.io/qt-5/qvideowidget.html. You can always check the qmake section to determine what submodule to include in the qmake file:

Screenshot from 2024-05-29 07-26-18