Webkitgtk and GTK4

Recently I got a serious request to support webkitgtk by the gintro Nim bindings, see

Seems to be not that hard for GTK3. Unfortunately my Gentoo-Linux does not support GTK4 yet, so I install it to /opt to get the GTK4 gir files and to test the GTK4 support. The pattern is like

git clone https://gitlab.gnome.org/GNOME/gtk.git
cd gtk
meson --prefix /opt/gtk builddir
ninja -C builddir
ninja -C builddir install

For webkit I tried

unxz webkitgtk-2.30.4.tar.xz
tar -xf webkitgtk-2.30.4.tar
export PKG_CONFIG_PATH="/opt/gtk/lib64/pkgconfig/"
cd webkitgtk-2.30.4
cmake -DUSE_GTK4=ON -DENABLE_BUBBLEWRAP_SANDBOX=OFF -DCMAKE_INSTALL_PREFIX=/opt/gtk -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
ninja

But ninja gives

 ninja
[933/4601] Building CXX object Source/JavaScriptCore/CMakeFiles/LowLevelInterpreterLib.dir/llint/LowLevelInterpreter.cpp.o
/home/salewski/webkitgtk-2.30.4/Source/JavaScriptCore/Scripts/postprocess-asm:109: warning: Insecure world writable dir /opt in PATH, mode 040777
[1827/4601] Building CXX object Source/WebCore/PAL/pal/CMakeFiles/PAL.dir/system/gtk/SoundGtk.cpp.o
FAILED: Source/WebCore/PAL/pal/CMakeFiles/PAL.dir/system/gtk/SoundGtk.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBUILDING_GTK__=1 -DBUILDING_PAL -DBUILDING_WITH_CMAKE=1 -DGETTEXT_PACKAGE=\"WebKit2GTK-5.0\" -DHAVE_CONFIG_H=1 -DJSC_GLIB_API_ENABLED -DSVN_REVISION=\"tarball\" -DWEBKITGTK_API_VERSION_STRING=\"5.0\" -I. -IDerivedSources/PAL -ISource/WebCore/PAL -ISource/WebCore/PAL/pal -ISource/WebCore/PAL/pal/crypto -ISource/WebCore/PAL/pal/system -ISource/WebCore/PAL/pal/text -IDerivedSources/ForwardingHeaders -isystem /opt/gtk/include/gtk-4.0 -isystem /opt/gtk/include/pango-1.0 -isystem /usr/include/gio-unix-2.0 -isystem /usr/include/cairo -isystem /usr/include/fribidi -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/pixman-1 -isystem /usr/include/uuid -isystem /usr/include/freetype2 -isystem /usr/include/harfbuzz -isystem /usr/include/libpng16 -isystem /usr/include/graphene-1.0 -isystem /usr/lib64/graphene-1.0/include -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/lib64/libffi/include -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -fdiagnostics-color=always -Wextra -Wall -Wno-expansion-to-defined -Wno-noexcept-type -Wno-psabi -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align  -fno-strict-aliasing -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -fPIC   -mfpmath=sse -msse -msse2 -pthread -std=c++17 -MD -MT Source/WebCore/PAL/pal/CMakeFiles/PAL.dir/system/gtk/SoundGtk.cpp.o -MF Source/WebCore/PAL/pal/CMakeFiles/PAL.dir/system/gtk/SoundGtk.cpp.o.d -o Source/WebCore/PAL/pal/CMakeFiles/PAL.dir/system/gtk/SoundGtk.cpp.o -c Source/WebCore/PAL/pal/system/gtk/SoundGtk.cpp
In file included from Source/WebCore/PAL/config.h:26,
                 from Source/WebCore/PAL/pal/system/gtk/SoundGtk.cpp:20:
DerivedSources/ForwardingHeaders/wtf/Platform.h:88:34: warning: "GDK_VERSION_3_92" is not defined, evaluates to 0 [-Wundef]
   88 | #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_92
      |                                  ^~~~~~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Platform.h:88:34: warning: "GDK_VERSION_3_92" is not defined, evaluates to 0 [-Wundef]
   88 | #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_92
      |                                  ^~~~~~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Platform.h:88:34: warning: "GDK_VERSION_3_92" is not defined, evaluates to 0 [-Wundef]
   88 | #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_92
      |                                  ^~~~~~~~~~~~~~~~
In file included from /opt/gtk/include/gtk-4.0/gdk/gdkapplaunchcontext.h:28,
                 from /opt/gtk/include/gtk-4.0/gdk/gdk.h:30,
                 from Source/WebCore/PAL/pal/system/gtk/SoundGtk.cpp:23:
/opt/gtk/include/gtk-4.0/gdk/gdkversionmacros.h:152:3: error: #error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
  152 | # error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
      |   ^~~~~
In file included from Source/WebCore/PAL/config.h:26,
                 from Source/WebCore/PAL/pal/system/gtk/SoundGtk.cpp:20:
DerivedSources/ForwardingHeaders/wtf/Platform.h:88:34: warning: "GDK_VERSION_3_92" is not defined, evaluates to 0 [-Wundef]
   88 | #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_92
      |                                  ^~~~~~~~~~~~~~~~
[1836/4601] Generating ../../inspector-resources.stamp
ninja: build stopped: subcommand failed.

I guess that my recent gtk4 is to fresh for webkitgtk-2.30.4? But building webkit from git is not recommended and would be a gigantic effort. May it be possible to patch one of the files manually to make it compile?

[EDIT]

OK, I tried to patch DerivedSources/ForwardingHeaders/wtf/Platform.h

#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_92

to

#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_4_0

and ninja continues to compile…

But then I get

Source/WebCore/platform/gtk/PlatformScreenGtk.cpp:209:5: error: ‘gdk_monitor_get_workarea’ was not declared in this scope; did you mean ‘gdk_monitor_get_model’?

So I assume webkitgtk is not really ready for final GTK4.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.