RobLoach / node-raylib

Node.js bindings for Raylib
https://robloach.github.io/node-raylib/
Other
245 stars 20 forks source link

FAIL to work on headless RPI 4 #91

Open tomarigr opened 3 years ago

tomarigr commented 3 years ago

Followed instructions to install and test, I get:cd pi@raspberrypi:~/downloads/raylibtest $ node index.js INFO: Initializing raylib 3.5 WARNING: GLFW: Error: 65544 Description: X11: The DISPLAY environment variable is missing WARNING: GLFW: Failed to initialize GLFW INFO: TIMER: Target time per frame: 16.667 milliseconds Segmentation fault

looking at node_modules/raylib/build/CMakeCache.txt I can see that it is still installed as Desktop platform, it should be PLATFORM_DRM for headless rpi4

tried other fixes on the "issues" list but no luck any advice? I need to make this work

thanks

EDIT: to anyone spending hours and hours looking how to make this work on headless RPI4 this is what you need to do: 1) install raylib in your project folder: npm install raylib 2) cd out of your project folder and: git clone https://github.com/RobLoach/node-raylib.git 3) replace node-raylib/vendor/raylib/src/CMakeLists.txt with attached file 4) npm it 5) copy contents of node-raylib/ to your_project_file/node_modules/raylib/ Enjoy! CMakeLists.txt

RobLoach commented 3 years ago

Is this anything that could be pushed upstream to raylib? Or would an update to raylib 3.7 help?

tomarigr commented 3 years ago

This is a dirty fix that will force cmake to install PLATFORM_DRM, the if statement in the CMakeLists.txt fails to detect correct platform and installs PLARFORM_DESKTOP, although desktop enabled PI4s might work flawlessly, headless PIs will complain for not finding x11 Display.

Not sure if updating to 3.7 works out of the box, but I am happy to test anything since I am on it anyway.

You'll have to give me instructions how to do it though.

tomarigr commented 3 years ago

@RobLoach I think we should try to update to 3.7 this version fails to find a screen if only DSI screen is connected (no hdmi)