I'm working on a C++ project using the raylib library on a Raspberry Pi 4 Model B. The program used to run without issues, but it suddenly started failing on startup with GLFW errors related to OpenGL context creation. Despite my efforts in reinstalling raylib and verifying OpenGL configurations, I've hit a roadblock. Here are the error messages I'm encountering:
INFO: Initializing raylib 5.1-dev
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO: > rcore:..... loaded (mandatory)
INFO: > rlgl:...... loaded (mandatory)
INFO: > rshapes:... loaded (optional)
INFO: > rtextures:. loaded (optional)
INFO: > rtext:..... loaded (optional)
INFO: > rmodels:... loaded (optional)
INFO: > raudio:.... loaded (optional)
WARNING: GLFW: Error: 65543 Description: GLX: Failed to create context: GLXBadFBConfig
WARNING: GLFW: Failed to initialize Window
Speicherzugriffsfehler (Segmentation fault)
Environment Details:
- OS: Debian GNU/Linux 11 (bullseye) running on a Raspberry Pi 4 Model B Rev 1.4
- Kernel: 6.1.21-v8+ (aarch64)
- Desktop Environment: LXDE with X.Org X Server 1.20.11
- OpenGL Version: 2.1 Mesa 20.3.5 with renderer V3D 4.2
- Display Environment Variable:
:0 - C++ Compiler: g++ (Debian 10.2.1-6) 10.2.1 20210110
- The program worked over X11 and VNC in the past, but now it fails to start in both environments.
glxgears runs perfectly, indicating that OpenGL 2.1 is functional, and raylib was reinstalled multiple times in an attempt to resolve the issue.
I'm seeking guidance on how to address these GLFW errors and successfully run my raylib-based program again. I will provide any further information necessary for troubleshooting.
Minimal Reproducible Example:
I've narrowed down the problem to the following simple program, which should open a window and display some text using raylib. However, the program fails at initialization, specifically at the InitWindow() call.
#include "raylib.h"
int main(void) {
InitWindow(800, 600, "Hello, raylib!");
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Hello, raylib!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
}
CloseWindow();
return 0;
}
In VScode debugging it shows me that the error happens in row 4 InitWindow().
Raylib exemples compile correctly:
Following github.com/raysan5/raylib/wiki i compiled the examples in the libary with the same Make command given and those run well. i compile my code with: g++ main.cpp -o program `pkg-config --libs --cflags raylib` -lGL -lm -lpthread -ldl -lrt -lX11 -latomic -DPLATFORM_DESKTOP
Here is an example of the Make command output of the working examples:
gcc -o others/rlgl_standalone others/rlgl_standalone.c -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused -result -O2 -D_DEFAULT_SOURCE -I. -/home/vacmeister/Desktop/MCI/Programmieren/MCIGraph/raylib/raylib/src -/home/vacmeister/Desktop/MCI/Programmieren/MCIGraph/raylib/raylib/src/external -I/usr/local/include -I/home/vacmeister/Desktop/MCI/Programmieren/MCIGraph/raylib/raylib/src/external/glfw/include -L. -L/home/vacmeister/Desktop/MCI/Programmieren/MCIGraph/raylib/raylib/src- /home/vacmeister/Desktop/MCI/Programmieren/MCIGraph/raylib/raylib/src -L/usr/local/l ib -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 -latomic -DPLATFORM_DESKTOP