Contributing Wayland Support to CImGui.jl - help wanted

So I am a redhat fan - specifically a fedora linux fan. Lot’s of people are! Anyways, I am exploring UI options in Julia for front ends right now. One keenly caught my eye(GitHub - Gnimuc/CImGui.jl: Julia wrapper for cimgui). It looks so easy, smart, and fast, I want to use it! Trouble is, when I try to run it, the GLFW backend explodes(GitHub - JuliaGL/GLFW.jl: Julia interface to GLFW, a multi-platform library for creating windows with OpenGL contexts and managing input and events. , GLFW: Release notes)

the message I get is the following:

 β”Œ Error: Error building `GLFW`: 
β”‚ -- The C compiler identification is GNU 8.3.1
β”‚ -- 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
β”‚ -- Looking for pthread.h
β”‚ -- Looking for pthread.h - found
β”‚ -- Looking for pthread_create
β”‚ -- Looking for pthread_create - not found
β”‚ -- Looking for pthread_create in pthreads
β”‚ -- Looking for pthread_create in pthreads - not found
β”‚ -- Looking for pthread_create in pthread
β”‚ -- Looking for pthread_create in pthread - found
β”‚ -- Found Threads: TRUE  
β”‚ -- Using X11 for window creation
β”‚ -- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
β”‚ -- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
β”‚ -- Looking for gethostbyname
β”‚ -- Looking for gethostbyname - found
β”‚ -- Looking for connect
β”‚ -- Looking for connect - found
β”‚ -- Looking for remove
β”‚ -- Looking for remove - found
β”‚ -- Looking for shmat
β”‚ -- Looking for shmat - found
β”‚ -- Found X11: /usr/lib64/libX11.so
β”‚ -- Configuring done
β”‚ -- Generating done
β”‚ -- Build files have been written to: /home/caseykneale/.julia/packages/GLFW/e257h/deps/usr/downloads/src/build
β”‚ Scanning dependencies of target glfw
β”‚ [  5%] Building C object src/CMakeFiles/glfw.dir/context.c.o
β”‚ In file included from /home/caseykneale/.julia/packages/GLFW/e257h/deps/usr/downloads/src/src/internal.h:187,
β”‚                  from /home/caseykneale/.julia/packages/GLFW/e257h/deps/usr/downloads/src/src/context.c:28:
β”‚ /home/caseykneale/.julia/packages/GLFW/e257h/deps/usr/downloads/src/src/x11_platform.h:48:10: fatal error: X11/extensions/XInput2.h: No such file or directory
β”‚  #include <X11/extensions/XInput2.h>
β”‚           ^~~~~~~~~~~~~~~~~~~~~~~~~~
β”‚ compilation terminated.
β”‚ gmake[2]: *** [src/CMakeFiles/glfw.dir/build.make:63: src/CMakeFiles/glfw.dir/context.c.o] Error 1
β”‚ gmake[1]: *** [CMakeFiles/Makefile2:123: src/CMakeFiles/glfw.dir/all] Error 2
β”‚ gmake: *** [Makefile:130: all] Error 2
β”‚ [ Info: Unpacking /home/caseykneale/.julia/packages/GLFW/e257h/deps/usr/downloads/src.tar.gz into /home/caseykneale/.julia/packages/GLFW/e257h/deps/usr/downloads/src
β”‚ β”Œ Warning: 
β”‚ β”‚ ================================================================
β”‚ β”‚ ================================================================
β”‚ β”‚ === Building GLFW has failed. Most common problem is,        ===
β”‚ β”‚ === that you don't have x-org installed.                     ===
β”‚ β”‚ === You can install it via: `sudo apt-get install xorg-dev`  ===
β”‚ β”‚ ================================================================
β”‚ β”‚ ================================================================
β”‚ β”” @ Main ~/.julia/packages/GLFW/e257h/deps/build.jl:56
β”‚ ERROR: LoadError: failed process: Process(`/home/caseykneale/.julia/packages/CMake/nSK2r/deps/usr/bin/cmake --build .`, ProcessExited(2)) [2]
β”‚ Stacktrace:
β”‚  [1] run at ./process.jl:661 [inlined]
β”‚  [2] (::getfield(Main, Symbol("##9#10")))() at /home/caseykneale/.julia/packages/GLFW/e257h/deps/build.jl:52
β”‚  [3] cd(::getfield(Main, Symbol("##9#10")), ::String) at ./file.jl:96
β”‚  [4] top-level scope at /home/caseykneale/.julia/packages/GLFW/e257h/deps/build.jl:43
β”‚  [5] include(::String) at ./client.jl:392
β”‚  [6] top-level scope at none:0
β”‚ in expression starting at /home/caseykneale/.julia/packages/GLFW/e257h/deps/build.jl:21

So we have an issue here - the GLFW install thinks I’m using X11 and I’m not! There’s an issue raised for this, on the GLFW repo by someone else in the same boat. https://github.com/JuliaGL/GLFW.jl/issues/188 , I wanna actually contribute to this fix if I can because not everyone wants to install a VM or download an OS to extend a package their working on for free!

My question is, where - if ever in GLFW.jl or in a Julia package does a call to Pkg.build install a dependancy like GLFW? I am pretty convinced it doesnt, but man, I’m not an expert. So is the issue with GLFW library itself? Or Fedora’s package manager (dnf) not running an up to date install of GLFW that looks for wayland?

Checking for wayland appears trivial(c++ - How I can find out if a Linux system uses Wayland or X11? - Stack Overflow), and specifying a wayland install of GLFW again also trivial(https://github.com/glfw/glfw/issues/986). I just can’t find where the hell to put the fix! Any help appreciated - this really isn’t my area of expertise but I think it’s important. At least for me and maybe one other Julian it is.

3 Likes

Okay I did a little more digging and found that CImGui.jl has a wrapper https://github.com/JuliaBinaryWrappers/GLFW_jll.jl .

Now the problem is the tags for versioning of dependancies appear to be based on OS - https://github.com/JuliaBinaryWrappers/GLFW_jll.jl/blob/master/Artifacts.toml

Which leads to people blanket assuming that say X11 is being used and then calling for binary X11 wrappers from julia? Ex: https://github.com/JuliaBinaryWrappers/GLFW_jll.jl/blob/master/src/wrappers/x86_64-linux-gnu.jl

The water is a little murky for me here… I’ve never seen this side of Julia. It is interesting but maybe someone can help out? How do I ask for a wayland binary wrapper? Or is that even the problem. Maybe @StefanKarpinski @jeff.bezanson would know?

1 Like

you may ask this on the slack, in the #binarybuilder channel.

1 Like

The binary wrapper wizards have struck again!

They in one fowl swoop solved this issue and like three others I was having. There is now wayland support! GTK canvas’s now work for fedora!

Heads up, don’t use the fedora repo version of Julia. Use the official binaries from JuliaLang. Don’t be lazy - it will bite you! It bit me!

2 Likes