Context
After reading @kyrofa’s blog post on stage-snaps, I wanted to split up my WPE WebKit snap as well:
- Libraries snap which contains WPE WebKit, libwpe and wpebackend-fdo. Build time for armhf is > 3 hours, and since the WPE team releases stable versions on a six-month schedule, this doesn’t require rebuilding that often.
- The kiosk snap which contains the fullscreen browser, plumbing like snapcraft-preload and some glue code to make things work in the intended mir-kiosk environment on Ubuntu Core. cog releases are more frequent and I want to experiment with parameters → not building WPE WebKit every time means faster iteration cycles.
Build environment:
snapcraft version 3.6
snap 2.39.2+19.04
snapd 2.39.2+19.04
series 16
ubuntu 19.04
kernel 5.0.0-19-generic
Problem
Building the cog
browser part with the cmake
snapcraft plugin has some weird include paths set up. cmake finds libraries from the wpe-webkit-libs
snap, but the actual cc
call gets these include parameters:
-I/root/parts/cog/install/root/stage/include/wpe-webkit-1.0 -I/root/parts/cog/install/root/stage/include/wpe-fdo-1.0 -I/root/parts/cog/install/root/stage/include/wpe-1.0 -I/usr/include/libsoup-2.4
Notice the /root/stage/
components: With those, the paths do not exist, while /root/parts/cog/install/include/...
does – and if I trigger the build command with correct paths inside the multipass build VM (snapcraft --debug
), everything builds fine. Also notice that for things pulled in via build-packages
like libsoup2.4-dev
, the include paths are correct. So maybe I need to change something in the libraries snap?
Full log for the cog
part:
Building cog
cmake /root/parts/cog/src -DCMAKE_INSTALL_PREFIX= -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_FIND_ROOT_PATH=/snap/wpe-webkit-libs/current
-- The C compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'gio-2.0'
-- Found gio-2.0, version 2.56.4
-- Checking for module 'libsoup-2.4'
-- Found libsoup-2.4, version 2.62.1
-- Checking for module 'wpe-webkit-1.0>=2.23.91'
-- Found wpe-webkit-1.0, version 2.24.2
-- Checking for module 'wayland-client'
-- Found wayland-client, version 1.16.0
-- Checking for modules 'wpe-webkit-1.0>=2.23.91;wpebackend-fdo-1.0;egl;xkbcommon'
-- Found wpe-webkit-1.0, version 2.24.2
-- Found wpebackend-fdo-1.0, version 1.2.0
-- Found egl, version 18.2.8
-- Found xkbcommon, version 0.8.0
-- Checking for module 'wayland-egl'
-- Found wayland-egl, version 18.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /root/parts/cog/build
cmake --build . -- -j2
[1/18] Building C object CMakeFiles/cogplatform-fdo.dir/platform/cog-platform-fdo.c.o
FAILED: CMakeFiles/cogplatform-fdo.dir/platform/cog-platform-fdo.c.o
/usr/bin/cc -DCOG_BG_COLOR_API_SUPPORTED=1 -DCOG_INSIDE_COG__=1 -DG_LOG_DOMAIN=\"Cog\" -Dcogplatform_fdo_EXPORTS -I. -I/root/parts/cog/src/wayland -I/root/parts/cog/install/root/stage/include/wpe-webkit-1.0 -I/root/parts/cog/install/root/stage/include/wpe-fdo-1.0 -I/root/parts/cog/install/root/stage/include/wpe-1.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libdrm -I/root/parts/cog/src/core -I/root/parts/cog/install/include -O3 -DNDEBUG -fPIC -pthread -std=gnu99 -MD -MT CMakeFiles/cogplatform-fdo.dir/platform/cog-platform-fdo.c.o -MF CMakeFiles/cogplatform-fdo.dir/platform/cog-platform-fdo.c.o.d -o CMakeFiles/cogplatform-fdo.dir/platform/cog-platform-fdo.c.o -c /root/parts/cog/src/platform/cog-platform-fdo.c
In file included from /root/parts/cog/src/core/cog.h:15:0,
from /root/parts/cog/src/platform/cog-platform-fdo.c:9:
/root/parts/cog/src/core/cog-webkit-utils.h:20:11: fatal error: wpe/webkit.h: No such file or directory
# include <wpe/webkit.h>
^~~~~~~~~~~~~~
compilation terminated.
[2/18] Building C object CMakeFiles/cog.dir/cog.c.o
FAILED: CMakeFiles/cog.dir/cog.c.o
/usr/bin/cc -DCOG_BG_COLOR_API_SUPPORTED=1 -DCOG_INSIDE_COG__=1 -DG_LOG_DOMAIN=\"Cog\" -I. -I/root/parts/cog/src/core -I/root/parts/cog/install/root/stage/include/wpe-webkit-1.0 -I/root/parts/cog/install/root/stage/include/wpe-1.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/root/parts/cog/install/include -O3 -DNDEBUG -pthread -std=gnu99 -MD -MT CMakeFiles/cog.dir/cog.c.o -MF CMakeFiles/cog.dir/cog.c.o.d -o CMakeFiles/cog.dir/cog.c.o -c /root/parts/cog/src/cog.c
In file included from /root/parts/cog/src/core/cog.h:15:0,
from /root/parts/cog/src/cog.c:12:
/root/parts/cog/src/core/cog-webkit-utils.h:20:11: fatal error: wpe/webkit.h: No such file or directory
# include <wpe/webkit.h>
^~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Failed to run 'cmake --build . -- -j2' for 'cog': Exited with code 1.
Verify that the part is using the correct parameters and try again.
snapcraft-wpe-webkit-mir-kiosk # ls /root/parts/cog/install/include/wpe-webkit-1.0/wpe/webkit.h
/root/parts/cog/install/include/wpe-webkit-1.0/wpe/webkit.h
I also looked at what the cmake plugin is doing, couldn’t find a hint if something is wrong there: