Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Building for Wayland instead of X11 on Ubuntu 22.04 produces compile error in GLFW lib #2666

Closed
3 tasks done
defce74 opened this issue Aug 28, 2022 · 10 comments
Closed
3 tasks done
Labels
external This issue depends on external lib platform: Linux Linux platform

Comments

@defce74
Copy link

defce74 commented Aug 28, 2022

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • My code has no errors or misuse of raylib

Building for Wayland instead of X11 on Ubuntu 22.04 produces compile error in GLFW lib

external/glfw/src/wl_platform.h:57:10: fatal error: wayland-xdg-shell-client-protocol.h: No such file or directory

in raylib/src/Makefile: USE_WAYLAND_DISPLAY ?= TRUE

This #include was removed in this glfw commit: glfw/glfw@dffe203#diff-a236f7eff7f0908ab273256af30863eb4023c4d5b28feb5e5fe1b20eee43fdc1

Using an external install of GLFW (latest master branch build https://github.com/glfw/glfw as of 28/8/2022) is working, therefore suggested that the Raylib GLFW version gets an update

in raylib/src/Makefile: USE_EXTERNAL_GLFW ?= TRUE

Environment

  • raylib 4.2 (latest master branch build as of 27/8/2022)
  • OS: Ubuntu 22.04 Wayland, Linux 5.18.15-051815-generic
  • OpenGL version: 4.6 (Core Profile) Mesa 22.0.5
  • GPU: AMD Radeon Vega 10 Graphics - raven, LLVM 13.0.1, DRM 3.46
@raysan5 raysan5 changed the title [Raylib] Building for Wayland instead of X11 on Ubuntu 22.04 produces compile error in GLFW lib [core] Building for Wayland instead of X11 on Ubuntu 22.04 produces compile error in GLFW lib Aug 28, 2022
@raysan5
Copy link
Owner

raysan5 commented Aug 29, 2022

GLFW has been updated to latest version lately but it seems Wayland compilation requires some previous step to generate some wayland specific code files.

I don't know how those files should be generated, help is welcome.

In the meantime, you can use CMake to build GLFW and generate the files automatically.

@raysan5 raysan5 added contributions are welcome! external This issue depends on external lib platform: Linux Linux platform labels Aug 29, 2022
@gen2brain
Copy link
Contributor

There is a script in raylib-go that I am using occasionally, on the update, to generate needed Wayland files https://github.com/gen2brain/raylib-go/blob/master/raylib/external/scripts/glfw-generate-wayland.sh.

From the next major GLFW release both X and Wayland should be compiled together and detected and used on runtime.

@raysan5
Copy link
Owner

raysan5 commented Aug 29, 2022

@gen2brain Thanks for the info! I didn't know Wayland compilation required those shenanigans...

From the next major GLFW release both X and Wayland should be compiled together and detected and used on runtime.

Does it mean this wayland-specific-files generation process won't be needed after GLFW 3.4 official release?

@gen2brain
Copy link
Contributor

Not sure if it will be needed, in that GLFW commit that is referenced above it seems it will not be needed.

@defce74
Copy link
Author

defce74 commented Aug 29, 2022

@raysan5 the glfw website https://www.glfw.org/docs/latest/compile.html states in the manual compilation section that use of the Wayland API is "experimental and incomplete".. might be worth waiting for the next glfw major release as @gen2brain has mentioned ?

@defce74
Copy link
Author

defce74 commented Aug 30, 2022

@raysan5 update: this may be a separate issue but testing both make and cmake builds, I'm getting ~60fps using a make build but only ~45fps with a cmake build.. this is reproducible as I tried different raylib commits with the same result.. definite slowdown with cmake builds. not sure if this is just linux or relevant to windows also ?

so I am using make to build raylib, with external GLFW and thus wayland enabled, as the current working solution. alas i have very little experiene with cmake, I use scons as build tool, so unfortunately I'm not really the right person to be addressing this issue

@raysan5
Copy link
Owner

raysan5 commented Sep 1, 2022

Information has been added to the Wiki: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#wayland

@defce74 The framerate issue you mention is a separate one and I have no idea why that happens but it seems it is more related to OS or compilation than raylib, the raylib code is the same in both cases.

@raysan5 raysan5 closed this as completed Sep 1, 2022
@defce74
Copy link
Author

defce74 commented Sep 1, 2022

@raysan5 ok would you like me to open a separate issue for this?

@raysan5
Copy link
Owner

raysan5 commented Sep 1, 2022

@defce74 Feel free to open a separate issue if you think it is related to raylib sources but it's needed more info to investigate it and, personally, I'm not investigating it. Let's see if someone is up for that task.

@defce74
Copy link
Author

defce74 commented Sep 2, 2022

@raysan5 ok, so before opening this as an issue, when I get some time, I'll look into it a bit myself as (correct me if I'm wrong) its probably some build settings in the Cmake config? I'll go back and look at some previous commits and see if I can find a build where cmake and make were comparable in terms of performance.

fyi as a test I am making 320,000 calls to DrawPixel per frame plus a few other bits like text and update logic.. I am getting up to 70fps using a make build or the official release build.. Cmake is only ~45fps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external This issue depends on external lib platform: Linux Linux platform
Projects
None yet
Development

No branches or pull requests

3 participants