Staacks / there.oughta.be

Projects featured on my blog at https://there.oughta.be
https://there.oughta.be
GNU General Public License v3.0
101 stars 33 forks source link

Confusing compile error #4

Closed spaceharrier closed 3 years ago

spaceharrier commented 3 years ago

I'm getting a compile failure which I assume is me doing something dumb. This looks like a namespace error or missing library, though I do have rpi-rgb-led-matrix ostensibly installed at the specified paths. Verbose output from g++ isn't telling me anything beyond the error seen here.

`pi@cubepi:~ $ g++ -g -o cpu-stats-gl cpu-stats-gl.cpp -std=c++11 -lbrcmEGL -lbrcmGLESv2 -I/opt/vc/include -L/opt/vc/lib -Lrpi-rgb-led-matrix/lib -lrgbmatrix -lrt -lm -lpthread -lstdc++ -Irpi-rgb-led-matrix/include/

cpu-stats-gl.cpp:25:19: error: 'rgb_matrix::GPIO' has not been declared

using rgb_matrix::GPIO;`

leoceto commented 3 years ago

You can remove the line using rgb_matrix::GPIO;` which seems to be useless and it should compile fine

spaceharrier commented 3 years ago

Yep, that worked. Thanks.

Staacks commented 3 years ago

Thanks for finding this. It looks to me like it is an unused part of one of the example that I used as a base for my code. The only part that confuses me is that it compiles like that for me and (as none of the other who have contacted me so far have mentioned this) for many others.

Does anyone have an idea why this might be the case? I would then remove the line in the repository, but I cannot test right now as I only have an SD card with the read-only filesystem at hand.

Staacks commented 3 years ago

...oh and I re-open as this is still not fixed in the code in the repo and at least others might find it easier that way until I have fixed it.

leoceto commented 3 years ago

Strange indeed, it is obviously linked to the version of gcc or librairies I guess that might differ....

By the way Staacks, I have created a version which is compatible with Raspberry 4, as the usage of OpenGL is different as stated by matus novak ([https://github.com/matusnovak/rpi-opengl-without-x]). You can find it below in case of interest. The compilation command is also a bit different : g++ -g -o cpu-stats-gl cpu-stats-gl.cpp -std=c++11 -ldrm -lgbm -lEGL -lGLESv2 -I/usr/include/libdrm -I/usr/include/GLES2 -I/opt/vc/include -lGL -L/opt/vc/lib -Lrpi-rgb-led-matrix/lib -lrgbmatrix -lrt -lm -lpthread -lstdc++ -Irpi-rgb-led-matrix/include/

The only drawback is that the RPI 4 won't work in headless mode, you need a HDMI output... which is very painful as it kills the portability... I might swich to a RPI 3 just because of that.

cpu-stats-gl-rpi4.zip

Staacks commented 3 years ago

Thanks, I will link to it when I post a blog update with user contributions. Is the rPi4 not running hot inside the cube? I use one for my home automation and am always startled by its temperature...

leoceto commented 3 years ago

It goes up to 72C but it is working fine.... again the only problem is that RPI4 cannot manage OpenGL in headless mode... which is kind of useless for this project.... I have ordered a RPI3 and I will use this RPI4 for another project....

Staacks commented 3 years ago

The line was removed in commit 55f8da7095ebf445a82675c710b3ce009339531f as the patch from https://github.com/Staacks/there.oughta.be/issues/9 was applied.

spants commented 3 years ago

It goes up to 72C but it is working fine.... again the only problem is that RPI4 cannot manage OpenGL in headless mode... which is kind of useless for this project.... I have ordered a RPI3 and I will use this RPI4 for another project....

can you use one of those HDMI dummy display dongles on a weird cable ;-). I hate those micro-hdmi things

LowKnee commented 3 years ago

Just tried this with an RasPi4 without X only CLI, Display connected but I get: Unable to get DRM resources Unable to get EGL display Is there anything I missed?

LowKnee commented 3 years ago

I used hdmi port0 which did not work, so I tried it with port1 acc. https://github.com/matusnovak/rpi-opengl-without-x/issues/4 and voila it works! I also checked to connect an headless HDMI dongle which works, too. And it also works with X and VNC running in parallel.

And it does not flicker on any time, even not if running different scripts (e.g. Python) and multiple services (e.g. Apache & PHP & SQLite) in parallel.

LowKnee commented 3 years ago

rebooted... and it stoped working... again it shows: Unable to get DRM resources Unable to get EGL display

LowKnee commented 3 years ago

Got it working again... Connected Headless HDMI Emulator dongle in Card1! This is how it is set within the "cpu-stats-gl-rpi4" source code acc. https://github.com/matusnovak/rpi-opengl-without-x/issues/4

// You can try chaning this to "card0" if "card1" does not work. device = open("/dev/dri/card1", O_RDWR | O_CLOEXEC); if (getDisplay(&display) != 0)

I set within raspi-config the resolution to DTM Mode 16 1024x768 4;3 having X running incl. VNC.

rebooted several time, all running. shutdown and switched on again, all running.

so far so good!

But if you go into raspi-config again... it will stop working. Whatever you do, you need to plugin your display or headless device into Card1, boot, set the resolution, reboot and then never go into raspi-config again... or redo this... or sometimes Card1 is not initializing... and whatever. strange...

So I tried it with changing to Card0 within the source code...

rebooted, switched off and on, rebooted with a display connected... all fine, it works. rebooted, switched off and on, rebooted with a Headless dpngle connected... all fine, it works... no it does not work...

I installed: sudo apt install kmscube and checked the ports with: sudo kmscube -D /dev/dri/card0 and with: sudo kmscube -D /dev/dri/card1 And I came to the point that sometimes it switches from Card0 to Card1... damn!

So I added an additional if clause to the script: check Card0 and if not available check Card1 and if none then exit. rebooted, switched off and on, rebooted with a Headless dpngle connected... all fine, it works... hopefully.