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(https://github.com/Gnimuc/CImGui.jl). It looks so easy, smart, and fast, I want to use it! Trouble is, when I try to run it, the GLFW backend explodes(https://github.com/JuliaGL/GLFW.jl , https://www.glfw.org/docs/latest/news.html)

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(https://stackoverflow.com/questions/45536141/how-i-can-find-out-if-a-linux-system-uses-wayland-or-x11), 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