Wayland on RasPI

172 views
Skip to first unread message

imacarthur

unread,
Dec 11, 2022, 12:53:56 PM12/11/22
to fltk.coredev
This is maybe a long shot, and quite possibly no one knows, but...

So I was testing Wayland on one of my Pi4 units, and it pretty much works.
But my attempts to build fltk with Wayland have not gone well - cmake always says:

-- Checking for module 'wayland-client'
--   No package 'wayland-client' found
-- Checking for module 'wayland-cursor'
--   No package 'wayland-cursor' found
-- Checking for module 'wayland-protocols'
--   Found wayland-protocols, version 1.20
-- Checking for module 'xkbcommon'
--   Found xkbcommon, version 1.0.3
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.12.24
-- Not all software modules 'wayland-client wayland-cursor wayland-protocols xkbcommon dbus-1' are present
-- Consequently, OPTION_USE_WAYLAND is set to OFF.
-- Found X11: /usr/include 

I had a look with "apt search" and as best I can make out, these packages are installed, but the fltk cmake seems not to find them... 
Is there something else I need to add, or...?
 e.g.

$ apt search libdbus-1
Sorting... Done
Full Text Search... Done
dbus/stable,now 1.12.24-0+deb11u1 armhf [installed,automatic]
  simple interprocess messaging system (daemon and utilities)

libdbus-1-3/stable,now 1.12.24-0+deb11u1 armhf [installed,automatic]
  simple interprocess messaging system (library)

libdbus-1-dev/stable,now 1.12.24-0+deb11u1 armhf [installed]
  simple interprocess messaging system (development headers)

etc...

Ideas?

imm

unread,
Dec 11, 2022, 1:06:30 PM12/11/22
to coredev fltk
I should probably have also noted that the Pi is running the default Pi OS which is debian, basically.

My other Wayland testing has been on Ubuntu (also debian) and has worked OK, so I'm not clear why this is different.

--
Ian
From my Fairphone FP3
   

--
You received this message because you are subscribed to a topic in the Google Groups "fltk.coredev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fltkcoredev/wZe2imZrBPk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/9840aa6f-ee66-4503-97b3-273b6327b206n%40googlegroups.com.

Albrecht Schlosser

unread,
Dec 11, 2022, 1:27:15 PM12/11/22
to fltkc...@googlegroups.com
On 12/11/22 19:06 imm wrote:
I should probably have also noted that the Pi is running the default Pi OS which is debian, basically.

My other Wayland testing has been on Ubuntu (also debian) and has worked OK, so I'm not clear why this is different.

On Sun, 11 Dec 2022, 17:53 imacarthur wrote:
This is maybe a long shot, and quite possibly no one knows, but...

So I was testing Wayland on one of my Pi4 units, and it pretty much works.
But my attempts to build fltk with Wayland have not gone well - cmake always says:

-- Checking for module 'wayland-client'
--   No package 'wayland-client' found
-- Checking for module 'wayland-cursor'
--   No package 'wayland-cursor' found
-- Checking for module 'wayland-protocols'
--   Found wayland-protocols, version 1.20
-- Checking for module 'xkbcommon'
--   Found xkbcommon, version 1.0.3
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.12.24
-- Not all software modules 'wayland-client wayland-cursor wayland-protocols xkbcommon dbus-1' are present
-- Consequently, OPTION_USE_WAYLAND is set to OFF.
-- Found X11: /usr/include 

I had a look with "apt search" and as best I can make out, these packages are installed, but the fltk cmake seems not to find them... 
Is there something else I need to add, or...?
 e.g.

$ apt search libdbus-1

libdbus-1 is probably a bad example because it /is/ found according to your log.

You should look for 'wayland-client' and 'wayland-cursor' which are /not/ found.

In such cases I use `apt list` which lists installed packages rather than `apt search`. I don't know if this helps but following is the search I would do with output from my normal Linux system. My raspi hasn't been updated for a while and I didn't try to build fltk/wayland on it yet.


$ apt list | egrep 'wayland-cursor|wayland-client'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libwayland-client++0/focal 0.2.5-2build1 amd64
libwayland-client-extra++0/focal 0.2.5-2build1 amd64
libwayland-client0/focal-updates,focal-security,now 1.18.0-1ubuntu0.1 amd64 [installed]
libwayland-client0/focal-updates,focal-security,now 1.18.0-1ubuntu0.1 i386 [installed,automatic]
libwayland-cursor++0/focal 0.2.5-2build1 amd64
libwayland-cursor0/focal-updates,focal-security,now 1.18.0-1ubuntu0.1 amd64 [installed]
libwayland-cursor0/focal-updates,focal-security,now 1.18.0-1ubuntu0.1 i386 [installed,automatic]

Did you look at README.Wayland.txt, and did you try to install all packages listed there?
(Sorry, just to be sure, I assume you did!)

[...]
- libpango1.0-dev
- libwayland-dev
- wayland-protocols
- libdbus-1-dev
- libxkbcommon-dev
- libgtk-3-dev   <== highly recommended, gives windows a GTK-style titlebar
- libglew-dev    <== necessary to use OpenGL version 3 or above
[...]

Hope this helps...

imacarthur

unread,
Dec 11, 2022, 2:09:02 PM12/11/22
to fltk.coredev
On Sunday, 11 December 2022 at 18:27:15 UTC Albrecht Schlosser wrote:
On 12/11/22 19:06 imm wrote:

libdbus-1 is probably a bad example because it /is/ found according to your log.

Yeah - fair enough, bad example...
 

You should look for 'wayland-client' and 'wayland-cursor' which are /not/ found.

OK, here's what "apt list" reports...

$ apt list | egrep 'wayland-cursor|wayland-client'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libwayland-client++0/stable 0.2.8-1 armhf
libwayland-client-extra++0/stable 0.2.8-1 armhf
libwayland-client0/stable,now 1.18.0-2~exp1.1 armhf [installed]
libwayland-cursor++0/stable 0.2.8-1 armhf
libwayland-cursor0/stable,now 1.18.0-2~exp1.1 armhf [installed]
qml-module-qtwayland-client-texturesharing/stable 5.15.2-3 armhf

So I think that means they are installed?
 
In such cases I use `apt list` which lists installed packages rather than `apt search`. I don't know if this helps but following is the search I would do with output from my normal Linux system. My raspi hasn't been updated for a while and I didn't try to build fltk/wayland on it yet.

Wayland is not enabled by default even in recent Pi images, so if you want to test it you need to enable some "advanced" settingsin raspi-config.
That said, it seems to work OK so far.
I'm using it now...

 $ echo $XDG_SESSION_TYPE
wayland

Did you look at README.Wayland.txt, and did you try to install all
    packages listed there?
(Sorry, just to be sure, I assume you did!)

Yes - all added (except libgtk-3-dev as I was planning on playing with the Cairo decorator some more... )

 

Albrecht Schlosser

unread,
Dec 11, 2022, 2:36:41 PM12/11/22
to fltkc...@googlegroups.com
On 12/11/22 20:09 imacarthur wrote:

OK, here's what "apt list" reports...

$ apt list | egrep 'wayland-cursor|wayland-client'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libwayland-client++0/stable 0.2.8-1 armhf
libwayland-client-extra++0/stable 0.2.8-1 armhf
libwayland-client0/stable,now 1.18.0-2~exp1.1 armhf [installed]
libwayland-cursor++0/stable 0.2.8-1 armhf
libwayland-cursor0/stable,now 1.18.0-2~exp1.1 armhf [installed]
qml-module-qtwayland-client-texturesharing/stable 5.15.2-3 armhf

So I think that means they are installed?

Yes, I think so. Sorry, I have no idea how to proceed.

Maybe Manolo can help better.

Wayland is not enabled by default even in recent Pi images, so if you want to test it you need to enable some "advanced" settings in raspi-config.
That said, it seems to work OK so far.

Thanks for the hint. I'll keep that in mind but I use my raspi usually headless (it's connected to my 55" home TV for setup), hence there's no real use for Wayland. I would need to activate it solely for testing. Maybe I'll try this at some time ...

Manolo

unread,
Dec 11, 2022, 6:19:56 PM12/11/22
to fltk.coredev
Le dimanche 11 décembre 2022 à 18:53:56 UTC+1, Ian a écrit :
This is maybe a long shot, and quite possibly no one knows, but...

So I was testing Wayland on one of my Pi4 units, and it pretty much works.
But my attempts to build fltk with Wayland have not gone well - cmake always says:

-- Checking for module 'wayland-client'
--   No package 'wayland-client' found
-- Checking for module 'wayland-cursor'
--   No package 'wayland-cursor' found
-- Checking for module 'wayland-protocols'
--   Found wayland-protocols, version 1.20
-- Checking for module 'xkbcommon'
--   Found xkbcommon, version 1.0.3
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.12.24
-- Not all software modules 'wayland-client wayland-cursor wayland-protocols xkbcommon dbus-1' are present
-- Consequently, OPTION_USE_WAYLAND is set to OFF.
-- Found X11: /usr/include
 
This dialog is about modules as known by pkg-config, not by apt.
Thus, pkg-config modules  wayland-client and wayland-cursor are apparently missing
from your system.

What do you get when you run these commands
    pkg-config --list | grep wayland
and
    pkg-config --list | grep cursor
on your Pi4 ?

Manolo

unread,
Dec 12, 2022, 12:29:48 AM12/12/22
to fltk.coredev
Le lundi 12 décembre 2022 à 00:19:56 UTC+1, Manolo a écrit :

What do you get when you run these commands
    pkg-config --list | grep wayland
and
    pkg-config --list | grep cursor
on your Pi4 ?

Sorry, there's a typo up there. The exact commands are
pkg-config --list-all | grep wayland
pkg-config --list-all | grep cursor

While at it, give also, please, the result of
lsb_release -a

To progress and help me, you could also remove the check about the
wayland-client and wayland-cursor modules, continue building, and see what happens.
That could help determine what files exactly are missing on the Pi4.
For that, edit CMake/options.cmake, and add after lines 201-202 which are
    pkg_check_modules(WLDCLIENT wayland-client)
    pkg_check_modules(WLDCURSOR wayland-cursor)
this
  set(WLDCLIENT_FOUND 1)
  set(WLDCURSOR_FOUND 1)
and then use CMake again.
[Of course, that's temporary, just to help understanding what happens with the Pi4].

TIA
Manolo

Manolo

unread,
Dec 12, 2022, 12:34:58 AM12/12/22
to fltk.coredev
Le lundi 12 décembre 2022 à 06:29:48 UTC+1, Manolo a écrit :

For that, edit CMake/options.cmake, and add after lines 201-202 which are
    pkg_check_modules(WLDCLIENT wayland-client)
    pkg_check_modules(WLDCURSOR wayland-cursor)
this
  set(WLDCLIENT_FOUND 1)
  set(WLDCURSOR_FOUND 1)
and then use CMake again.

Re-reading this, I'm afraid that could fail because of cached variable values.
Therefore, for security, do as follows:
1) comment out  or remove these 2 lines
   pkg_check_modules(WLDCLIENT wayland-client)
    pkg_check_modules(WLDCURSOR wayland-cursor)
2) add these
 set(WLDCLIENT_FOUND 1)
  set(WLDCURSOR_FOUND 1)
3) run CMake again after having completely deleted all content of the build dir.

imacarthur

unread,
Dec 12, 2022, 3:57:25 AM12/12/22
to fltk.coredev
Thanks Manolo.
Well, that gets me a bit further, but still no joy: I think Wayland on the Pi is not ready for us to test yet!

Here's a log of sorts:

$ pkg-config --list-all | grep cursor
xcursor               Xcursor - X Cursor Library
$ pkg-config --list-all | grep wayland
wayland-protocols     Wayland Protocols - Wayland protocol files

(So pkg-config does not know about wayland-cursor or wayland -client, as anticipated.)

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:    11
Codename:    bullseye

Edit CMake/optons.cmake
clear folder out (rm -rf *)

cmake -G ....

Proceeds to:
-- Checking for module 'wayland-egl'
--   No package 'wayland-egl' found
-- Checking for module 'egl'
--   Found egl, version 1.5
-- Checking for module 'gl'
--   Found gl, version 1.2
-- Modules 'wayland-egl, egl, and gl' are required to build for the Wayland backend.
CMake Error at CMake/options.cmake:455 (message):
  *** Aborting ***

$ apt list | grep wayland-egl


WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libwayland-egl++0/stable 0.2.8-1 armhf
libwayland-egl-backend-dev/stable 1.18.0-2~exp1.1 armhf
libwayland-egl1-mesa/stable 20.3.5-1+rpt4+rpi1 armhf
libwayland-egl1/stable,now 1.18.0-2~exp1.1 armhf [installed,automatic]

$ sudo apt install libwayland-egl-backend-dev

-- Checking for module 'wayland-egl'
--   No package 'wayland-egl' found

Looks like pkg-config does not know about wayland-egl either, though it is present.
Edit options.cmake again, line 450, to "tweak"

    pkg_check_modules(WLD_EGL wayland-egl)

That then proceeds to completion of configuration.

-- Static libraries will be built in /home/pi/source/test-1.4/build-WL/lib
-- Shared libraries will not be built (set OPTION_BUILD_SHARED_LIBS=ON to build)
-- FLUID will be built in /home/pi/source/test-1.4/build-WL/bin/fluid
-- Test programs    will be built in /home/pi/source/test-1.4/build-WL/bin/test
-- Example programs will not be built (set FLTK_BUILD_EXAMPLES=ON to build)
-- Image Libraries: JPEG = System
--                  PNG  = System
--                  ZLIB = System
-- Use Wayland:             Yes (when available at run-time)
-- All drawing uses Cairo:  Yes
-- Use Pango:               Yes
-- Fl_Cairo_Window support: No

-- End of Configuration Summary --

Try to build: Fail

[ 12%] Linking C static library ../lib/libfltk_png.a
[ 12%] Built target fltk_png
[ 13%] Generating text-input-protocol.c, text-input-client-protocol.h
/bin/sh: 1: wayland-scanner: not found
make[2]: *** [src/CMakeFiles/fltk.dir/build.make:97: src/text-input-protocol.c] Error 127
make[1]: *** [CMakeFiles/Makefile2:775: src/CMakeFiles/fltk.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

$ apt list | grep -i wayland-scanner


WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

wayland-scanner++/stable 0.2.8-1 armhf

So there is no wayland-scanner package listed, only the -scanner++ package.
Install that anyway, clear out folder and repeat process.
Still fails:

/bin/sh: 1: wayland-scanner: not found
make[2]: *** [src/CMakeFiles/fltk.dir/build.make:97: src/text-input-protocol.c] Error 127
make[1]: *** [CMakeFiles/Makefile2:775: src/CMakeFiles/fltk.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

So I think we are stuck - not all the requisite packages are available yet on the Pi it seems, so that's probably as far as this can go for now...

Manolo

unread,
Dec 12, 2022, 4:13:08 AM12/12/22
to fltk.coredev
I'd say: we're progressing.

wayland-scanner belongs to package libwayland-bin in Debian bullseye. Does it exist for the RasPi?

If not, you could, just for us to understand and then hopefully fix, copy from your successful Wayland build elsewhere
files text-input-protocol.c and text-input-client-protocol.h and put them is the same place on the Pi?
Then it will probably fail again for other missing files generated by wayland-scanner and you could do similarly.


imacarthur

unread,
Dec 12, 2022, 6:45:21 AM12/12/22
to fltk.coredev
On Monday, 12 December 2022 at 09:13:08 UTC Manolo wrote:
I'd say: we're progressing.

So it seems that we are progressing; and indeed a key thing I have found is that I messed up earlier - I made a trivial error when  installing libwayland-dev and *did not notice*, so many of the issues I saw (such as pkg-config not finding all the wayland parts...) are directly attributable to that.

*Correctly* installing libwayland-dev and then adding libwayland-bin (as you indicate below) made a huge improvement.
OK, so with  libwayland-dev and libwayland-bin installed, I can restore the options.cmake file to stock, and then cmake configures satisfactorily.

FLTK then builds with the hybrid Wayland/x11 back-end and most of the test and example code then works OK in either Wayland mode or with FLTK_BACKEND=x11 as we'd hope.

However, GL seems a bit wayward - it mostly works (albeit slowly!) under FLTK_BACKEND=x11 mode, but segfaults under Wayland (same binary in each case.)

$ bin/test/gl_overlay
Can do overlay = 0
Segmentation fault
$
$ FLTK_BACKEND=x11 bin/test/gl_overlay
Can do overlay = 0

(and the test runs...)
I'm not sure what causes that, but feel like I've seen it before recently and can't remember what the cause was!

Manolo

unread,
Dec 12, 2022, 7:56:59 AM12/12/22
to fltk.coredev
Very good progress indeed.

Do you confirm that package libwayland-bin is not installed after libwayland-dev has been installed ?

Could you run the test/shape app with gdb and report the traceback at the point of crash, after having built FLTK with -g ?


Manolo

unread,
Dec 12, 2022, 9:29:51 AM12/12/22
to fltk.coredev
I've just installed RasPi OS in a Virtualbox on my mac.

I build fltk with no problem if what is said in README.Wayland.txt is done except that package
libxinerama-dev is necessary.
Adding package weston, I can run Weston and run FLTK test apps therein. They all run well,
including GL-based apps.

Would you know how to start a wayland-enabled desktop such as gnome therein ?


imm

unread,
Dec 12, 2022, 9:53:16 AM12/12/22
to fltkc...@googlegroups.com
On Mon, 12 Dec 2022 at 14:29, Manolo wrote:
>
> I've just installed RasPi OS in a Virtualbox on my mac.

Ah - I've never used that (I have "plenty" real Pi boards of various ages...)
I don't know, but I think the PC version is a fairly standard debian
image for i386, but with the PiOS shell on top of it?

>
> I build fltk with no problem if what is said in README.Wayland.txt is done except that package
> libxinerama-dev is necessary.
> Adding package weston, I can run Weston and run FLTK test apps therein. They all run well,
> including GL-based apps.
>

OK, that's useful.
I suspect there's something in the GL layer - I *assume* that's "just"
mesa and a soft-GL on the PC version, but in the real Pi hardware I
think it does something with the Videocore interface to use (some of
the) capabilities of the hardware GPU - and I suspect that is where it
is going awry...

> Would you know how to start a wayland-enabled desktop such as gnome therein ?

I'm sorry, I don't know for the PC image.
The real Pi set-up runs the desktop (gnome, mutter) by default, though
set to x11 mode.
From a shell, if you run "sudo raspi-config" you get an ncurses
interface - from there Pick "Advanced" then "Enable Wayland" and
restart and then it runs but with mutter using the Wayland back end
instead of x11.
I have no idea how much (if any!) of that is relevant to the PC-hosted
version I'm afraid.

imacarthur

unread,
Dec 12, 2022, 10:12:30 AM12/12/22
to fltk.coredev
On Monday, 12 December 2022 at 12:56:59 UTC Manolo wrote:
Very good progress indeed.

Do you confirm that package libwayland-bin is not installed after libwayland-dev has been installed ?

I do not know for sure - I *believe* that it would have been, but by that stage I had added it manually anyway, so am not certain.
 

Could you run the test/shape app with gdb and report the traceback at the point of crash, after having built FLTK with -g ?

OK, looks like a driver issue...

Reading symbols from ./shape...
(gdb) r
Starting program: /home/pi/source/test-1.4/test/shape
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb443478c in ?? () from /usr/lib/arm-linux-gnueabihf/dri/vc4_dri.so
(gdb) bt
#0  0xb443478c in  () at /usr/lib/arm-linux-gnueabihf/dri/vc4_dri.so
#1  0xb587863c in  () at /lib/arm-linux-gnueabihf/libEGL_mesa.so.0
(gdb) q
A debugging session is active.

    Inferior 1 [process 3290] will be killed.

So the segfault is in (or related to) the VideoCore-IV driver I guess, from that.

I wonder if assigning more RAM to the video driver would help...?

imm

unread,
Dec 12, 2022, 10:17:56 AM12/12/22
to fltkc...@googlegroups.com
On Mon, 12 Dec 2022 at 15:12, imacarthur wrote:
>
> I wonder if assigning more RAM to the video driver would help...?

No, apparently not...

Greg Ercolano

unread,
Dec 12, 2022, 1:17:13 PM12/12/22
to fltkc...@googlegroups.com

Would it help to distill the findings of this thread into a README.rpi-wayland.txt file?
This would probably help future users find what they're looking for, so they don't
have to pick through threads for final results.

I suppose a lot of the details might be specific to particular raspbian releases/dates,
in which case separate sections in the readme, most recent at the top? e.g.


    Raspbian x.x / Winter 2023 - How To Configure
    ---------------------------------------------
    ..new stuff..

    Raspbian y.y / Fall 2022 - How To Configure
    -------------------------------------------
    ..older stuff..

We probably do have "too many README" files, which might be a reason not to do this,
but not sure how else to collect stuff like this, other than perhaps an article on fltk.org.

Anyway, just a thought.

--

Greg Ercolano, er...@seriss.com
Seriss Corporation
Tel: +1 626-576-0010 ext.8
Fax: +1 626-576-0020
Cel: +1 310-266-8906
Skype: ercolano77

      Rush Render Queue: http://seriss.com/rush/
  1A2 KSU Phone Systems: http://seriss.com/1a2-ksu/
Optical Printer Control: http://seriss.com/opcs/

Manolo

unread,
Dec 12, 2022, 1:23:06 PM12/12/22
to fltk.coredev
Le lundi 12 décembre 2022 à 19:17:13 UTC+1, er...@seriss.com a écrit :

Would it help to distill the findings of this thread into a README.rpi-wayland.txt file?


I believe no, because this thread boils down to "Follow README.Wayland.txt and you're good
for the RasPi too".

imm

unread,
Dec 12, 2022, 4:21:25 PM12/12/22
to coredev fltk
On Mon, 12 Dec 2022, 18:23 Manolo wrote:
Le lundi 12 décembre 2022 à 19:17:13 UTC+1, erco a écrit :

Would it help to distill the findings of this thread into a README.rpi-wayland.txt file?


I believe no, because this thread boils down to "Follow README.Wayland.txt and you're good
for the RasPi too".

Yes, with the only caveat being"And GL windows might not work and we don't know why because they do under x11/glx".

The R.Pi folks are still working on Wayland integration, so it will hopefully get better. I don't think it's anything we can fix, though.
Reply all
Reply to author
Forward
0 new messages