J1nx

YOU CAN DO IT CHEAPER YOURSELF.
  • Home
  • Articles
    • [DiY] Home (Personal AI) Assistant – BLOG series
    • [DEV] MycroftOS – A bare minimal OS based on Buildroot
  • Projects
    • [DIY] Home (Personal A.I.) Assistant – Project Page
    • [HACK] Installing HassOS on the Homey
    • [DEV] MycroftOS – Buildroot OS for Mycroft A.I.
  • Patreon
  • Contact
  • Home
  • Articles
  • ICT Matters
  • ARM
  • Compiling WPE Webkit for the RaspberryPi

Blog

Friday, 31 August 2018 / Published in ARM, DIY, Embedded, ICT Matters, Linux

Compiling WPE Webkit for the RaspberryPi

Recently I became aware of a very nice project that makes it possible to run a complete fullscreen borderless hardware accelerated webbrowser on the Raspberry Pi. As you might have read in one of the blog posts in the [DiY] Personal A.I. Assistant series, I would like to run it on the device and making it the default visual screen enclosure for Mycroft. Similar as the KDE Plasmoid GUI and the little screen on the soon to be delivered Mark-II device. Creating a small webserver on the device with standard info about that Mycroft instance to show as default URL. Drawing / Pushing additional information to it based on which skill and what is needed to be shown. But you can basically show any remote / online website if requested….

  • Hey Mycroft, tell me about Abraham Lincoln.
  • <Mycroft response>
  • Hey Mycroft, show me on the screen.

Or perhaps something like;

  • Hey Mycroft, play Hero of War from Rise Against from Youtube on the screen.
  • Hey Mycroft, show me the babymonitor
  • Hey Mycroft, show me the news (instead of; tell me the news)

As you can see! Countless possibilities, however more on that to come later in a new blog post in that particular serie. First we need to get it to work on our device! And that is what this post is about.

Compiling WPE Webkit for the RaspberryPi running Raspbian

The project linked above is using Resin.io where the docker is based on YOCTO. I really do not want to follow that route and just want to run the WPE browser on Raspbian without docker stuff etc. Now, I spent countless hours googling how to do that, but other than people asking the same question, nothing to be found. The only small handles I could find are on the trac wiki install documentation – Building WPE natively. Not much to go with and others asking the same question online already stated; It doesn’t work.

As there is no clear step-by-step information available, hereby my attempt to get it done. I am not there yet and keep running into small issues here and there, however slowly knocking them down one by one. As there is no other information available online, I decided to start this blog post as a Work In Progress type of blog post, where I just keep adding steps and information on the go. That way, others can join me and perhaps help me out whenever I get stuck again. In the end hopefully together we can get it done. Community efforts!

So here we go…..

First we need to install some dependencies. Most of these are figured out by the sourcecode configuration steps and/or compilation errors. This list might grow longer as we keep on going, but for now run the following command;

sudo apt-get install cmake ninja-build libegl1-mesa-dev mesa-common-dev \
libxkbcommon-dev gperf ruby-dev libcairo2-dev libepoxy-dev libharfbuzz-dev \
libgcrypt11-dev libsoup2.4-dev libsqlite3-dev libwebp-dev libtasn1-6-dev \
libxslt1-dev libgstreamer* ccache python-dev libjpeg-dev

Perhaps you might need some additional packages that you do not have already which I have by installing Mycroft. If so please let me know, and I will adjust above list accordingly.

One dependency of WPEWebkit is WPEBackend which are some libraries developed by the same guys. So before we get into compiling WPEWebkit, first we need to download, compile and install WPEBackend. I am running below commands within my home directory. You can choose otherwise, so I am leaving out all the “cd ~/” commands. Download the latest WPEbackend sourcecode tarball from their site. At current time this is version 0.2.0. Configure the code, build and install;

wget https://wpewebkit.org/releases/wpebackend-0.2.0.tar.xz
tar xvf wpebackend-0.2.0.tar.xz
cd wpebackend-0.2.0
cmake –GNinja
ninja
sudo ninja install

This step can easily be done on the Raspberry Pi itself. WPEBackend is not that big and compiling it only takes a few minutes.

Next on the list is actually downloading and building WPEWebkit itself. WPEWebkit is big and compiling it is taking a looooooooooooong time, so I recommend the cross compile it on a beefy machine. Just transfer the folder back to the Raspberry Pi before running the last “sudo ninja install” command. However sorting things out, I am currently compiling it both on another debian 9 machine and on the Raspberry Pi. On the build machine it still took 48 hrs (not a fancy machine), on the Raspberry Pi it is actually still running strong for alreaady 4 days and is at ~60% !!! (Just that you know)

Downloading the sourcecode. latest version is 2.20.2 at current time.

wget https://wpewebkit.org/releases/wpewebkit-2.20.2.tar.xz
tar xvf wpewebkit-2.20.2.tar.xz
cd wpewebkit-2.20.2/

One of the dependencies is libepoxy > 1.4.0 however Raspbian still contains 1.3.1 There is some debate about a bug being fixed or not, but because of it webkit bumped it to >1.4.0 More information here; https://github.com/WebKit/webkit/blob/master/ChangeLog-2018-01-01#L1669

For now decided to lower the requirement back to >1.3.0

nano Source/cmake/OptionsWPE.cmake

Find and replace by;

find_package(LibEpoxy 1.4.0 REQUIRED)

find_package(LibEpoxy 1.3.1 REQUIRED)

We can start to configure the sourcecode by;

cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=Release -DUSE_WOFF2=OFF -DENABLE_JIT=OFF -GNinja

A quick explaination of above parameters. woff2-dev library package is not available for Raspbian so we turn is of with -DUSE_WOFF2=OF There is currently an ARM instruction type of issue which makes compiling the code fail. For it to compile we need to disable JIT by -DENABLE_JIT=OFF

If everything gooes well, the sourcecode should be configured with the following features;

-- Enabled features:
-- ENABLE_ACCELERATED_2D_CANVAS .......... OFF
-- ENABLE_ENCRYPTED_MEDIA                  OFF
-- ENABLE_JIT ............................ OFF
-- ENABLE_VIDEO                            ON
-- ENABLE_WEBDRIVER ...................... ON
-- ENABLE_WEB_AUDIO                        ON
-- ENABLE_WEB_CRYPTO ..................... ON
-- ENABLE_XSLT                             ON
-- USE_SYSTEM_MALLOC ..................... OFF
-- USE_WOFF2                               OFF
-- Configuring done
-- Generating done
-- Build files have been written to:

Accelerated 2D canvas is disabled because of an issue with cairo and OpenGL. Encrypted media, ditto problems with OpenGL. Later on when we have figured out all steps and we have WPEWebkit running, I will have a closer look at; WOFF2, ENCRYPTED_MEDIA, ACCELERATED_2D_CANVAS and ofcourse the LibEpoxy issue stated earlier. But let us get some working stuff first.

Now we are ready to start compiling the code. If you are going to compile it on the RPi you will run into “out of memory” problems, so if you do so you are better of adding some temporarily SWAP to get it to succeed.

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
sudo mkswap /swapfile
sudo swapon /swapfile

This will give you 4 GB extra (very slow and inefficient) memory. All that is left is building the code with the ninja command.

ninja

Take a break, walk away, go do something else. This will take a while……

When all is done we can install the software simply again by (if you cross compile, move over the folder to your RPi again);

sudo ninja install

Clean up the swap stuff again if you where compiling on the Pi.

sudo swapoff /swapfile
sudo rm -f /swapfile

That is it for WPEWekit. Next on the list is the Launcher to start WPE on the Framebuffer similar as with the resin.io project. That is where I am currently at…. There is a launcher which is deprecated and to be replaced by WPEFramework. So that is what I am currently looking at;

More to come as we go…..


Do you like what you just read? Keep me going by donating on Paypal or become a Patron.


BE AMONG THE FIRST..
I agree to have my personal information transfered to MailChimp ( more information )
Be among the first to get access to all the latest information, tutorials and how-to's by joining the newsletter email list.
We hate spam. Your email address will not be sold or shared with anyone else.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Skype (Opens in new window)
  • Click to email a link to a friend (Opens in new window)
Tagged under: ARM, DIY, Embedded, ICT-Matters, Linux, Raspberry Pi, Raspbian, Webkit, WPE

What you can read next

[Update] My plans for 2019
ReSpeaker 4-Mic Array HAT Mycroft A.I. Skill
[DiY] Home (Personal AI) Assistant (Intermediate Roadmap) – PART 6

5 Comments to “ Compiling WPE Webkit for the RaspberryPi”

  1. Travis says :Reply
    22 September 2018 at 06:31

    Anything more on this yet. I’d live to see it. Have mycroft open a browser and show like Alexa would be awesome

    1. Peter Steenbergen says :Reply
      23 September 2018 at 08:03

      Hey Travis, No this work is a bit on hold for the moment. Got the Backend and WPE Webkit to build eventually as shown in the blog post, but got a bit stuck in figuring out the other components needed to launch something on the framebuffer. Most info and pointer are coming from the Resin.io project;
      https://github.com/resin-io-projects/resin-wpe
      And the (not working) buildroot overlay;
      https://github.com/Igalia/buildroot-wpe

      That last one helps me out the most. It has been a while since I last worked with Buildroot, so decided to take a little side step by checking out Buildroot again. So I am now working on MycroftOS to bump my Buildroot know how and to see what have changed the last few years since I was lead developer for the “Little Black Box” project.

  2. Carlos says :Reply
    13 March 2019 at 02:34

    Hi to all.
    has there been luck since then?
    very nice to hear about wpe webkit

    1. Peter Steenbergen says :Reply
      13 March 2019 at 13:17

      Hi Carlos, no apologies, not from me. Been rather busy at the moment with either MycroftOS or the daytime job. It is still on my todo list though.

  3. evgeny says :Reply
    11 March 2020 at 12:49

    fix:
    cmake –GNinja .

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • ReSpeaker 4-Mic Array HAT Mycroft A.I. Skill

    A while ago I created a Mycroft A.I. skill for ...
  • [DEV] MycroftOS – A bare minimal OS based on Buildroot – PART 5

    It has been a while once again since the last u...
  • [Update] Busy, busy, busy….

    Holy crap ! The last blog post here is already ...
  • [DEV] MycroftOS – A bare minimal OS based on Buildroot – PART 4

    A first (very) early alpha release is ready. St...
  • [Update] My plans for 2019

    It has (again, yeah I know) been a while since ...

Categories

  • ARM
  • DIY
  • Embedded
  • Home Assistance
  • Home Automation
  • Homey
  • ICT Matters
  • IoT
  • Linux
  • MyCroft A.I.
  • Project 1
  • Project 2
  • Project 3
  • Smart Speaker
  • Website News

Tags

A.I. Adapt Alexa ARM Bootsplash Buildroot chroot crosscompiling DeepSpeech DIY Embedded Google Assistance Google Home HASS HDMI Home Assistance Home Automation Homey ICT-Matters IoT Kodi Linux Mimic Multimedia MyCroft A.I. News Padatious Precise Raspberry Pi Raspbian ReSpeaker RPi Skills Smart Speaker sourcecode Webkit WPE

PETER STEENBERGEN

Born on the 25th of July 1978 in Leiderdorp - The Netherlands. A "geek" who is working 15+ years in the Oil & Gas industry. As a result of that, visited many parts of the world. His strong affinity with ICT matters has earned him certain online recognition and got him involved in multiple interesting projects. Was a co-founder of "The Little Black Box", a multimedia streamer based on XBMC / Kodi. A device that was brought available to big retail shops in the Netherlands such as MediaMarkt, BCC and many big online webshops as bol.com as an end result.

WEBSITE

  • Articles
  • Projects
  • Patreon
  • Our Policy
  • Contact

FOLLOW

  • Facebook
  • MeWe
  • Patreon
  • Github
  • Youtube

© 2018 J1nx | All rights reserved.

TOP