Wayland support?

Hi!

Does openFramworks work with Wayland?
I’m using Archlinux.

Everything still compiles fine, but I get a segmentation fault now whenever I try and run an app. Wether they are mine or in the examples folder.
Or maybe I’m missing something?

Here’s the output from valgrind:

==22147== Memcheck, a memory error detector
==22147== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22147== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==22147== Command: ./bin/3DPrimitivesExample
==22147== 
==22147== Invalid read of size 1
==22147==    at 0x5DC112: updateKeyCodeLUT (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5DCFE5: initExtensions (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5DD722: _glfwPlatformInit (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5D7264: glfwInit (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x51FAC2: ofAppGLFWWindow::setup(ofGLFWWindowSettings const&) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x520BED: ofAppGLFWWindow::setup(ofGLWindowSettings const&) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5273BD: ofMainLoop::createWindow(ofWindowSettings const&) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x514E8E: ofSetupOpenGL(int, int, ofWindowMode) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x41ACA6: main (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==  Address 0xc is not stack'd, malloc'd or (recently) free'd
==22147== 
==22147== 
==22147== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==22147==  Access not within mapped region at address 0xC
==22147==    at 0x5DC112: updateKeyCodeLUT (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5DCFE5: initExtensions (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5DD722: _glfwPlatformInit (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5D7264: glfwInit (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x51FAC2: ofAppGLFWWindow::setup(ofGLFWWindowSettings const&) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x520BED: ofAppGLFWWindow::setup(ofGLWindowSettings const&) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x5273BD: ofMainLoop::createWindow(ofWindowSettings const&) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x514E8E: ofSetupOpenGL(int, int, ofWindowMode) (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==    by 0x41ACA6: main (in /home/dimitri/Documents/development/of_v0.9.3_linux64_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample)
==22147==  If you believe this happened as a result of a stack
==22147==  overflow in your program's main thread (unlikely but
==22147==  possible), you can try to increase the size of the
==22147==  main thread stack using the --main-stacksize= flag.
==22147==  The main thread stack size used in this run was 8388608.
==22147== 
==22147== HEAP SUMMARY:
==22147==     in use at exit: 376,577 bytes in 1,915 blocks
==22147==   total heap usage: 4,779 allocs, 2,864 frees, 577,823 bytes allocated
==22147== 
==22147== LEAK SUMMARY:
==22147==    definitely lost: 0 bytes in 0 blocks
==22147==    indirectly lost: 0 bytes in 0 blocks
==22147==      possibly lost: 1,352 bytes in 18 blocks
==22147==    still reachable: 375,225 bytes in 1,897 blocks
==22147==                       of which reachable via heuristic:
==22147==                         newarray           : 1,536 bytes in 16 blocks
==22147==         suppressed: 0 bytes in 0 blocks
==22147== Rerun with --leak-check=full to see details of leaked memory
==22147== 
==22147== For counts of detected and suppressed errors, rerun with: -v
==22147== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)

Thanks!

There is a bug in GLFW version used by OF, that prevents apps running under Wayland. It’s fixed in the newer version (3.2) of GLFW.

I was afraid of that…
Is it worth trying to replace glfw in openframeworks with a new version?
I see there’s a glfw folder in libs, if I changed (or symlinked) all the files in there, would it magically work? (Assuming this version of openframeworks could run it).

AFAIK openframeworks uses the system GLFW library on arch linux. So maybe try replacing it with https://aur.archlinux.org/packages/glfw-wayland-git/

I had trouble install it, some unresolvable conflict issue.
In the meantime I switched back to X11, but I’ll try again with Wayland when I have more time.

Yeah. Aur packages are a hit and miss sometimes :wink:

Out of personal curiosity. The rest of the system was running fine on wayland? Are you running gnome-shell?

Of course^^ But in this case if I remember correctly, there was a conflict between glfw-wayland-git and glfw-x11-git, and it didn’t give me any choice for resolving it. And no clue how to resolve it manually. Thankfully, X11 works fine^^

I am using gnome-shell. The rest of the system seemed to work fine. One or two apps had visual glitches (steam menus appeared at screen origin instead of the window, that was fun). Other than that no complaints. But I haven’t been using it for very long.

I have created a fork from master with some workarounds to make it work on arch linux and wayland with glfw-x11 3.2-4. I have removed glfw static lib from repository and modified makefile to link to system lib dynamicaly.

Fork: https://github.com/jegun/openFrameworks

My changes in the fork:
Glfw 3.2 has a small change related to key events that are not compatible with master code. Particularly the old key event doesn’t provide codepoint anymore (there is dedicated event for codepoint now in glfw). That’s why I had to use keycode instead of codepoint in KeyPressed event in my fork. So in my fork ofApp returns key code instead of codepoint.

I just realized that codepoint issue was already solved in master, I guess now it’s enough to remove local glfw and modify makefile to link to system glfw.

1 Like