openGL package not working

Problem description

From 2024-02-16T17:00:00Z All my C++ repl with openGL not run sucessly.
When repl run this code glfwCreateWindow(), it break out.
my replit.nix setting is below:

{ pkgs }: {
	deps = [
    pkgs.clang_12
	pkgs.glfw
    pkgs.glm
	];
}

my .replit setting is below:

compile = ["bash", "-c", "g++ $(find src -name '*.cpp') -o zobjcode -Llib -lglad -lglfw -ldl"]

run = "./zobjcode"
entrypoint = "src/main.cpp"
hidden = ["zobjcode"]

[languages.c]
pattern = "**/*.{c,h}"

Expected behavior

glfwCreateWindow() should work and open a window.

Actual behavior

glfwCreateWindow() “Failed to create GLFW window” then breakout

Steps to reproduce

my code link(public) is bellow :
https://replit.com/@p3artschool/openGL-error-demo

Browser

Chrome

OS

Linux Debian 12

Device if mobile

for replit App I use Android

Plan

Core membership

Please change this topic’s category to Replit Help.

Do not know how to change topic category?
Do I need repost it to Replit Help?

Please do not create duplicate topics.

Sorry, I will keep it in mind.

Qwerty Qwerty via Replit Ask <notifications@replitteams.discoursemail.com> 於 2024年2月17日 週六 上午7:58寫道:

these error message may be could help.
GLX: No GLXFBConfigs returned
GLX: Failed to find a suitable GLXFBConfig
the short version of openGL error demo repl’s URL is below:
https://replit.com/@p3artschool/openGL-error-demo

I think that you can change the category by editing the topic, and then changing the category.

1 Like

I already tried to report a similar issue (using the Core-user support form). The following two errors started to appear on all of my replits using LÖVE engine template (for 2d games) today without myself touching the configuration.

Seems like overall drivers/packages failure. I tried default nix configuration and also my custom configuration not using the latest packages.

First error appearing on replits

Unable to create OpenGL window
This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.

SDL window creation error: Could not get EGL display
Error: [string "boot.lua"]:399: Could not set window mode
stack traceback:
    [C]: in function 'assert'
    [string "boot.lua"]:399: in function <[string "boot.lua"]:275>
    [C]: in function 'xpcall'
Unable to create OpenGL window
This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.

SDL window creation error: Could not get EGL display

and after nix reconfig attempts I receive

libGL error: MESA-LOADER: failed to open swrast: /nix/store/0kiykyrnrpfhmjwxwx89kxr20hmf5304-gcc-10.3.0-lib/lib/../lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/dri/swrast_dri.so) (search paths /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/dri)
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  93
  Current serial number in output stream:  94
AL lib: (EE) alc_cleanup: 1 device not closed

Practically all my work has to stop online - I had to move my development to offline mode.

I appologize to all other users to maybe repeating / duplicating the reports, but I’m probably less skilled to search in replit asks and support tickets so it is hard to find the duplicates and link them together.

Posting here so the topic is visible and providing some error examples.

Maybe repls don’t have gpus :man_shrugging:
Have you managed to get it to work before?

@7heMech Yes, it was working. That’s how I was developing last 4-5 months. :smiley: That was the main reason to start to pay for the service and become a Core member.

:grey_question: I was suspecting Repl.it migrated some of the cloud instances services to different provider or different virtual machines profile - that’s my current hypothesis. Maybe Replit-ers missed some instances of replits actually need the GPUs.

:grey_question: My second theory this regression is not a mistake, it is intentional reduction of the replits run costs = by default of the replit virtual machine is now without GPU and you have to enable it extra - but havent seen any official communication about that and do not see such option in my account settings.

Replit has a kind of partnership with Google and uses their cloud services so this is unlikely.

One possibility would be a change in CPUs, you don’t actually need a GPU if there are integrated graphics on the CPU (it won’t be as fast if course, but it is probably much cheaper than paying for a VM with a GPU).

Hey,
you can always check the CPU with lscpu, it’s always been Intel Xeon or AMD EPYC or something. I know this because of performance differences stemming from it. (I haven’t been able to get the AMD CPU when checking my repls now though.)
Also repls never have GPUs (except for that one time, but definitely not here).
It indeed seems like a problem of a changed driver, whatever that means (idk).

From the 2 repls linked above, here are the important parts of the error message:

Error demo repl:

GLX: No GLXFBConfigs returned
GLX: Failed to find a suitable GLXFBConfig
Failed to create GLFW window

LOVE repl:

Unable to create OpenGL window
This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.
1 Like

I was able to fix BOTH repls, using the following solution:
Click three dots, Show hidden files and open .replit file.
Change the channel variable to "stable-23_11" if it is present, otherwise insert this at the bottom:

[nix]
channel = "stable-23_11"

Refresh or type kill 1 in the Shell.
This will update the nix channel (basically the repository of all the System dependencies the repl uses) from 23.05 (the usual default for all repls), or possibly unstable, to 23.11 . (It does correspond to dates.) Alternatively, one can use "unstable" instead (the most recent but not guaranteed stable).
Maybe this updates the libraries to a version recent enough to be compatible with new updated repl drivers.

4 Likes

I also discovered that the default channel of the replit was changed from the previous value to

~/$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable
3 Likes

@NuclearPasta0 Your fix worked - I probably failed before while trying the same because it takes time to load new packages and I was not patient enough while trying different channels. :slight_smile:

Or maybe the kill 1 via Shell worked better than reload :smiley:

Thank you very much! :pray:

3 Likes

@NuclearPasta0
Your fix worked, Thank you. I hope replit staff could soon update the default channel to “stable-23_11”.

[on normal OK status, for all my openGL repls]
replit.com support …
GL_Vendor Mesa
GL_Version 4.5 (Compatibility Profile) Mesa 23.1.9
GL_Renderer llvmpipe (LLVM 15.0.7, 256 bits)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.