OpenLara icon indicating copy to clipboard operation
OpenLara copied to clipboard

raspberry pi compile error

Open BielBdeLuna opened this issue 3 years ago • 8 comments

On RaspberryPi 2 B (32 bits)

I downloaded:

clang libegl-dev libudev-dev libsdl2-dev mesa-common-dev

do I need any other library?

I got the following message:

/OpenLara/src/platform/rpi $ ./build.sh
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
In file included from main.cpp:15:
In file included from ../../game.h:4:
In file included from ../../core.h:795:
../../gapi/gl.h:211:13: warning: 'GL_TEXTURE_3D' macro redefined [-Wmacro-redefined]
    #define GL_TEXTURE_3D           0
            ^
/usr/include/GLES2/gl2ext.h:1983:9: note: previous definition is here
#define GL_TEXTURE_3D                     0x806F
        ^
In file included from main.cpp:15:
In file included from ../../game.h:4:
In file included from ../../core.h:795:
../../gapi/gl.h:894:29: error: use of undeclared identifier 'GL_R8'
                desc.ifmt = GL_R8;
                            ^
../../gapi/gl.h:895:29: error: use of undeclared identifier 'GL_RED'
                desc.fmt  = GL_RED;
                            ^
../../gapi/gl.h:933:17: warning: address of function 'glGenerateMipmap' will always evaluate to 'true' [-Wpointer-bool-conversion]
            if (glGenerateMipmap) {
            ~~  ^~~~~~~~~~~~~~~~
../../gapi/gl.h:933:17: note: prefix with the address-of operator to silence this warning
            if (glGenerateMipmap) {
                ^
                &
../../gapi/gl.h:1153:13: error: use of undeclared identifier 'glGetStringi'; did you mean 'glGetString'?
        if (glGetStringi != NULL) {
            ^~~~~~~~~~~~
            glGetString
/usr/include/GLES2/gl2.h:597:39: note: 'glGetString' declared here
GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
                                      ^
In file included from main.cpp:15:
In file included from ../../game.h:4:
In file included from ../../core.h:795:
../../gapi/gl.h:1153:13: warning: comparison of function 'glGetString' not equal to a null pointer is always true [-Wtautological-pointer-compare]
        if (glGetStringi != NULL) {
            ^~~~~~~~~~~~    ~~~~
../../gapi/gl.h:1153:13: note: prefix with the address-of operator to silence this warning
        if (glGetStringi != NULL) {
            ^
            &
../../gapi/gl.h:1155:27: error: use of undeclared identifier 'GL_NUM_EXTENSIONS'
            glGetIntegerv(GL_NUM_EXTENSIONS, &count); 
                          ^
../../gapi/gl.h:1157:48: error: use of undeclared identifier 'glGetStringi'
                const char *ext = (const char*)glGetStringi(GL_EXTENSIONS, i);
                                               ^
../../gapi/gl.h:1300:34: warning: comparison of function 'glGenBuffers' not equal to a null pointer is always true [-Wtautological-pointer-compare]
        support.VBO            = glGenBuffers != NULL;
                                 ^~~~~~~~~~~~    ~~~~
../../gapi/gl.h:1300:34: note: prefix with the address-of operator to silence this warning
        support.VBO            = glGenBuffers != NULL;
                                 ^
                                 &
../../gapi/gl.h:1582:21: error: use of undeclared identifier 'glDiscardFramebufferEXT'
                    glDiscardFramebufferEXT(GL_FRAMEBUFFER, count, discard);
                    ^
main.cpp:104:50: error: unknown type name 'EGL_DISPMANX_WINDOW_T'
bool wndInit(DISPMANX_DISPLAY_HANDLE_T &display, EGL_DISPMANX_WINDOW_T &window) {
                                                 ^
main.cpp:132:50: error: unknown type name 'EGL_DISPMANX_WINDOW_T'
void wndFree(DISPMANX_DISPLAY_HANDLE_T &display, EGL_DISPMANX_WINDOW_T &window) {
                                                 ^
main.cpp:139:14: error: unknown type name 'EGL_DISPMANX_WINDOW_T'
bool eglInit(EGL_DISPMANX_WINDOW_T &window, EGLDisplay &display, EGLSurface &surface, EGLContext &context) {
             ^
main.cpp:504:5: error: unknown type name 'EGL_DISPMANX_WINDOW_T'
    EGL_DISPMANX_WINDOW_T     dmWindow;
    ^
4 warnings and 10 errors generated.

BielBdeLuna avatar Jan 15 '22 17:01 BielBdeLuna

Second on this same error. My build environment is a Raspberry Pi 4B (4GB RAM) running the latest Raspberry Pi OS 64-bit beta.

I can build the nix platform build without issue, but I would like to be able to build the rpi build as well.

LambdaCalculus37 avatar Jan 17 '22 02:01 LambdaCalculus37

Got the same error message as well with a raspberry pi 3b+

JohnHenry91 avatar Jan 18 '22 20:01 JohnHenry91

Got the same error message as well with a raspberry pi 3b+

32-bit or 64-bit Raspberry Pi OS?

LambdaCalculus37 avatar Jan 18 '22 20:01 LambdaCalculus37

@ All: Don't use the RPi platform. The old rpi platform uses the DISPMANX API, which is a closed, propietary API from BROADCOM which is now gone for good, in favor of KMS/DRM+MESA.

So that's why it doesn't work on any modern GNU/Linux distro on the Pi. DISPMANX is dead and unsupported for good, in favor or standard APIs.

An specific Pi platform makes no sense nowadays. Instead, use the SDL2 platform: it builds and works on the Pi with no problems at all.

After all, the Pi is simply a *NIX platform running SDL2, and that's what it should be treated like.

EDIT: just build the sdl2 platform as of today's GIT code and works great on the Pi3 and 4, using standard APIs under the hood.

vanfanel avatar Jan 20 '22 11:01 vanfanel

Then if that's the case, then the RPi platform should probably be marked as deprecated and removed from the codebase.

LambdaCalculus37 avatar Jan 24 '22 21:01 LambdaCalculus37

Then if that's the case, then the RPi platform should probably be marked as deprecated and removed from the codebase.

I have already suggested that to master @XProger At this point, the Rpi platform is only causing confusion because no modern Pi OS will work with that.

vanfanel avatar Jan 24 '22 21:01 vanfanel

@ All: Don't use the RPi platform. The old rpi platform uses the DISPMANX API, which is a closed, propietary API from BROADCOM which is now gone for good, in favor of KMS/DRM+MESA.

So that's why it doesn't work on any modern GNU/Linux distro on the Pi. DISPMANX is dead and unsupported for good, in favor or standard APIs.

An specific Pi platform makes no sense nowadays. Instead, use the SDL2 platform: it builds and works on the Pi with no problems at all.

After all, the Pi is simply a *NIX platform running SDL2, and that's what it should be treated like.

EDIT: just build the sdl2 platform as of today's GIT code and works great on the Pi3 and 4, using standard APIs under the hood.

I installed libedil-dev libudev libsdl2-dev mesa-common-dev, switched to sdl2 folder and executed build.sh, but still failed to compile. Platform: RPi4

pi@raspberrypi:~/OpenLara-master/src/platform/sdl2 $ ./build.sh 
In file included from ../../core.h:795,
                 from ../../game.h:4,
                 from main.cpp:9:
../../gapi/gl.h:410:45: error: ‘void (* glDiscardFramebufferEXT)(GLenum, GLsizei, const GLenum*)’ redeclared as different kind of symbol
         PFNGLDISCARDFRAMEBUFFEREXTPROC      glDiscardFramebufferEXT;
                                             ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/SDL2/SDL_opengles2.h:37,
                 from ../../gapi/gl.h:71,
                 from ../../core.h:795,
                 from ../../game.h:4,
                 from main.cpp:9:
/opt/vc/include/GLES2/gl2ext.h:905:29: note: previous declaration ‘void glDiscardFramebufferEXT(GLenum, GLsizei, const GLenum*)’
 GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
                             ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../core.h:795,
                 from ../../game.h:4,
                 from main.cpp:9:
../../gapi/gl.h: In member function ‘GAPI::FormatDesc GAPI::Texture::getFormat()’:
../../gapi/gl.h:97:33: error: ‘GL_R8_EXT’ was not declared in this scope
         #define GL_R8           GL_R8_EXT
                                 ^~~~~~~~~
../../gapi/gl.h:894:29: note: in expansion of macro ‘GL_R8’
                 desc.ifmt = GL_R8;
                             ^~~~~
../../gapi/gl.h:97:33: note: suggested alternative: ‘GL_MIN_EXT’
         #define GL_R8           GL_R8_EXT
                                 ^~~~~~~~~
../../gapi/gl.h:894:29: note: in expansion of macro ‘GL_R8’
                 desc.ifmt = GL_R8;
                             ^~~~~
../../gapi/gl.h:98:33: error: ‘GL_RED_EXT’ was not declared in this scope
         #define GL_RED          GL_RED_EXT
                                 ^~~~~~~~~~
../../gapi/gl.h:895:29: note: in expansion of macro ‘GL_RED’
                 desc.fmt  = GL_RED;
                             ^~~~~~
../../gapi/gl.h:98:33: note: suggested alternative: ‘GL_MIN_EXT’
         #define GL_RED          GL_RED_EXT
                                 ^~~~~~~~~~
../../gapi/gl.h:895:29: note: in expansion of macro ‘GL_RED’
                 desc.fmt  = GL_RED;
                             ^~~~~~
In file included from ../../core.h:795,
                 from ../../game.h:4,
                 from main.cpp:9:
../../gapi/gl.h: In function ‘void GAPI::init()’:
../../gapi/gl.h:322:52: error: invalid cast to function type ‘void(GLenum, GLsizei, const GLenum*)’ {aka ‘void(unsigned int, int, const unsigned int*)’}
     #define GetProcOGL(x) x=(decltype(x))GetProc(#x)
                                                    ^
../../gapi/gl.h:1182:17: note: in expansion of macro ‘GetProcOGL’
                 GetProcOGL(glDiscardFramebufferEXT);
                 ^~~~~~~~~~

W-Mai avatar Feb 12 '22 09:02 W-Mai

Need to update to the latest system (I installed this version), then only install libsdl2-dev, execute src/platform/sdl2/build.sh to compile.

FASTSHIFT avatar Feb 19 '22 09:02 FASTSHIFT