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

Raspberry pi build #1942

Open
ameisso opened this Issue Dec 11, 2017 · 10 comments

Comments

Projects
None yet
6 participants
@ameisso
Copy link

ameisso commented Dec 11, 2017

Hello,

I'm trying to use Cinder on my raspberry pi 3.
I've installed a fresh SD with "raspbian stretch lite 4.9 released 2017-11-29" (without gui) and followed this tutorial.

The cinder lib build fine, but I can't run any of the samples.
I've tried to reduce the code to it's minimum to locate the problem origin.

#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Log.h"

using namespace ci;
using namespace ci::app;

class BasicApp : public App {
  public:
        void draw() override;
};

void prepareSettings( BasicApp::Settings* settings )
{
        CI_LOG_D( "PREPARE " );
}

void BasicApp::draw()
{
        CI_LOG_D( "DRAW" );
}

CINDER_APP( BasicApp, RendererGl, prepareSettings )

the build seems normal but when I run it, I have a "PREPARE" log, but no "DRAW".

Here is the output :

|debug  | void prepareSettings(BasicApp::Settings *)[16] PREPARE 
gl_es_load entered...
Extension: GL_OES_compressed_ETC1_RGB8_texture
Extension: GL_OES_compressed_paletted_texture
Extension: GL_OES_texture_npot
Extension: GL_OES_depth24
Extension: GL_OES_vertex_half_float
Extension: GL_OES_EGL_image
Extension: GL_OES_EGL_image_external
Extension: GL_EXT_discard_framebuffer
Extension: GL_OES_rgb8_rgba8
Extension: GL_OES_depth32
Extension: GL_OES_mapbuffer
Extension: GL_EXT_texture_format_BGRA8888
Extension: GL_APPLE_rgb_422
Extension: GL_EXT_debug_marker
gl_es_2_0_ext_load: SUCCESSFUL! | 9 procs loaded
gl_es_load: SUCCESSFUL
Segmentation fault

I've also tried with other GL drivers without success.

Does anyone have a clue o what could happen ?
Is there a special Raspbian image that is reported to work with cinder ?

Best

Antoine M*

@richardeakin

This comment has been minimized.

Copy link
Collaborator

richardeakin commented Jan 2, 2018

Are you able to step through the code and see what is causing the segmentation fault?

I've only worked with a pi once, about half a year ago, and the version of raspbian I used (can't recall which, the current stable one then) just worked for me.

@ameisso

This comment has been minimized.

Copy link
Author

ameisso commented Jan 3, 2018

Hello @richardeakin,

I haven't investigated much on what happened.
I've tried with different (previous) releases since then and I'm still getting the same error.

I'll let you know if I push some more test. For now I've switched back on openframeworks, but I wanted to compare both frameworks.

Anyway, the OSx version of cinder works pretty well ! Good job for that.
Best !

@PetrosKataras

This comment has been minimized.

Copy link
Contributor

PetrosKataras commented Jan 3, 2018

I haven't tried it but from what I m reading on Stretch you should enable the legacy GL drivers with raspi-config and then link with brcmGLESv2 and brcmEGL instead of GLESv2 and EGL as its currently happening here since these have been renamed and the GLESv2 and EGL versions on Stretch refer to the new mesa drivers which are still experimental and I m not sure if the would require more modifications on our side.

@ameisso

This comment has been minimized.

Copy link
Author

ameisso commented Jan 4, 2018

Hello @PetrosKataras,

I've installed a fresh stretch (2017-11-29-raspbian-stretch-lite) version and followed the install process.
I've ended up writing a script to do so :
cinderInstall.txt

Then I went to : /opt/vc/lib and created two link :
sudo ln -s libbrcmEGL.so libEGL.so
sudo ln -s libbrcmGLESv2.so libGLESv2.so

When trying to build the basic app, I got the following error :
make[2]: *** No rule to make target '/opt/vc/lib/libGLESv2.so', needed by 'Debug/BasicApp/BasicApp'. Stop.

Then it worked with the BasicApp.
Maybe It could be a good idea to edit the tutorial so it points to this thread or add the two link lines in it ?

Thanks for your work anyway !

Regards

@notlion

This comment has been minimized.

Copy link
Contributor

notlion commented Jan 5, 2018

Hey FWIW, I had a similar issue with a missing /opt/vc/lib/libEGL.so, also on the latest Raspbian image. I saw somewhere that updating the Pi's firmware with sudo rpi-update would fix things, and indeed after running that the EGL lib was put into the correct place. This was also after installing Cinder's dependencies, of course. Maybe give it a try?

@notlion

This comment has been minimized.

Copy link
Contributor

notlion commented Jan 5, 2018

It also looks like your install script compiles Cinder before opening up the update-alternatives configuration. If you set CC and CXX before compiling CMake should use those, like so:

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++

I also recently wrote an install script for Raspi 3. Might useful as a reference:
https://github.com/notlion/dynamicland-lightpath/blob/master/install.sh

@felixfaire

This comment has been minimized.

Copy link

felixfaire commented Nov 2, 2018

Sorry to revive this but I have been unable to build Cinder on master with a rpi 3 B+. I've followed the official document and tried the above suggestions but I get this error:

/home/pi/Developer/Cinder/src/cinder/app/linux/WindowImplLinuxRpi.cpp:40:2: fatal error: unknown type name 'EGL_DISPMANX_WINDOW_T'
        EGL_DISPMANX_WINDOW_T window;
        ^
1 error generated.

This is compiling with Clang. Any thoughts?

@felixfaire

This comment has been minimized.

Copy link

felixfaire commented Nov 2, 2018

(PS. i also had to change line 275 of Window.cpp from:

return mImpl->getNative(); to
return (void*)mImpl->getNative();

to get the compilation past a cannot initialize return object of type 'void *' with an rvalue of type 'EGLNativeWindowType' (aka 'unsigned long') error. Not sure if this is related)

@CallumHoward

This comment has been minimized.

Copy link

CallumHoward commented Nov 5, 2018

You could try running sudo raspi-config and changing the OpenGL configuration

@felixfaire

This comment has been minimized.

Copy link

felixfaire commented Nov 5, 2018

PetrosKataras has since merged a fix for the issue I was experiencing, Cinder is now building fine along with most of the samples (except the ones that use Resources.h but that is a separate problem). We may want to resolve this Issue now for cleanliness' sake?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment