Skip to content
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

Trying to build on GLES platforms fails #14

Open
vanfanel opened this issue Dec 10, 2018 · 19 comments
Open

Trying to build on GLES platforms fails #14

vanfanel opened this issue Dec 10, 2018 · 19 comments

Comments

@vanfanel
Copy link

@alfrix:

I was trying to get this core to build on non-Xorg, GLES-based platforms like the Raspberry Pi or any X86 PC with no Xorg server running (RetroArch is know for running on KMS/DRM+GLES) but it fails:

../../gapi_gl.h:92:24: fatal error: GL/glx.h: No such file or directory
     #include <GL/glx.h>
                        ^
compilation terminated.

I am forcing compilation by defining a non-Xorg OS on core.h like this:

#elif __KMSDRM__
    #define _OS_KMSDRM 1
    #define _GAPI_GL   1
    #define _GAPI_GLES 1

    #define DYNGEOM_NO_VBO


and also using that OS on gapi_gl.h like this on line 48:

#elif defined(_OS_RPI) || defined(_OS_CLOVER) || defined(_OS_KMSDRM)

Then I added a new platform definition on the libretro platform Makefile, like this:

else ifeq ($(platform), rpi)
   TARGET := $(TARGET_NAME)_libretro.so
   fpic := -fPIC
   SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
   CXXFLAGS += -D__KMSDRM__
   CFLAGS += -D__KMSDRM__
   LIBS += -lpthread
   GLES = 1

And then it builds on the X-less Pi as intended, but all I get on loading PSX data is a segfault... Can you please test?

@alfrix
Copy link

alfrix commented Dec 11, 2018 via email

@vanfanel
Copy link
Author

@alfrix : Any GNU/Linux PC will do.

@vanfanel
Copy link
Author

vanfanel commented Dec 27, 2018

@alfrix : Trying to build a GLES version with current sources I get this:

../../gapi_gl.h:194:45: error: ‘void (* glGenerateMipmap)(GLenum)’ redeclared as different kind of symbol
         PFNGLGENERATEMIPMAPPROC             glGenerateMipmap;
                                             ^~~~~~~~~~~~~~~~
In file included from ./libretro-common/include/glsym/rglgen_headers.h:55,
                 from ./libretro-common/include/glsym/rglgen.h:32,
                 from ./libretro-common/include/glsym/glsym.h:26,
                 from main.cpp:7:
/usr/include/GLES2/gl2.h:576:29: note: previous declaration ‘void glGenerateMipmap(GLenum)’
 GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
                             ^~~~~~~~~~~~~~~~
In file included from ../../core.h:607,
                 from ../../game.h:4,
                 from main.cpp:11:
../../gapi_gl.h:207:45: error: ‘GLuint (* glCreateProgram)()’ redeclared as different kind of symbol
         PFNGLCREATEPROGRAMPROC              glCreateProgram;
                                             ^~~~~~~~~~~~~~~
In file included from ./libretro-common/include/glsym/rglgen_headers.h:55,
                 from ./libretro-common/include/glsym/rglgen.h:32,
                 from ./libretro-common/include/glsym/glsym.h:26,
                 from main.cpp:7:
/usr/include/GLES2/gl2.h:551:31: note: previous declaration ‘GLuint glCreateProgram()’
 GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
                               ^~~~~~~~~~~~~~~
In file included from ../../core.h:607,
                 from ../../game.h:4,
                 from main.cpp:11:

It's much longer, but you get the idea. I believe something is wrong with these redefinitions...
I use MESA GLES implementation, the most common in GNU/Linux.

@alfrix
Copy link

alfrix commented Dec 27, 2018

you cannot just turn GLES on linux, you need to extensively modify gapi_gl to add your platform, otherwise it will assume desktop GL each time there is an defined(_OS_LINUX),

@vanfanel
Copy link
Author

vanfanel commented Dec 28, 2018

@alfrix : but "my platform" is libretro, as in src/platform/libretro.
Asuming that Linux=DesktopGL is just plain wrong, as GLES/GLES2 is also widely used in Linux.

Is this core supposed to build on something like the Raspberry Pi?

@alfrix
Copy link

alfrix commented Dec 28, 2018

i have only tested fedora and ubuntu, i have never seen a x86 distro that comes with gles but not gl,
i'm no expert but you can tell by looking at the code, rpi is treated differently, but again i cannot test it, if you have it, try to fix it and make a PR

@vanfanel
Copy link
Author

@alfrix : Desktop GNU/Linux distros are not to be used as a reference when it comes to libretro cores, since LR/RA main point is being able to run the cores in WAY more different ways inside the Linux ecosystem, like SBCs (Pi, etc), consoles (NES/SNES/PSX Classics), etc...

I will give it a go, but I need your help. Can I meet you on IRC or any other method for a fluid comunication?

@alfrix
Copy link

alfrix commented Dec 28, 2018

Most LR/RA devs, including maintainers hangout on the Discord channel
ask your question directly on #programming
https://discord.gg/GZJKWjJ
the IRC channel is much less populated
http://webchat.freenode.net/?channels=%23retroarch&uio=d4
note that there is a bridge (retrobot) between IRC and discord of the channel #retroarch

@vanfanel
Copy link
Author

@alfrix : I don't need general RA/LR or programming advice, but help with the OpenLara core, so I need to contact you.

@alfrix
Copy link

alfrix commented Dec 28, 2018

i go there regularly, you can PM me if you prefer it, once you join the channel.
you can also find xproger in https://discord.gg/6mc4Jw

@vanfanel
Copy link
Author

@alfrix : Does xprogger also collaborate in the libretro port?

@XProger
Copy link

XProger commented Dec 28, 2018

@vanfanel I'll help all I can :)

@vanfanel
Copy link
Author

@XProger : Do you use IRC? What server/channel?

@XProger
Copy link

XProger commented Dec 28, 2018

@vanfanel nope, only discord and telegram

@vanfanel
Copy link
Author

Can you guys send me a new invite or tell me how to join again? This discord stuff is new to me...

@alfrix
Copy link

alfrix commented Dec 29, 2018 via email

@vanfanel
Copy link
Author

vanfanel commented Jan 31, 2019

@alfrix @XProger

I am writting concise instructions to build OpenLara on RetroArch using GLES instead of Desktop OpenGL. It's very easy and NO Raspberry Pi is needed, any desktop GNU/Linux computer will do, because MESA has GLES implemented for desktop systems too.

  1. Build RetroArch in GLES mode:
    ./configure --enable-opengles --disable-qt
    make

  2. Try to build OpenLara Libretro for GLES:
    make GLES=1

You can easily see why it fails. It's the only core not compatible with GLES on Linux, but I am sure it's easy for you to fix it, since the core itself has GLES code already (in fact, this core is supposed to run on the Switch, which only has GLES, isn't it?).

@vanfanel
Copy link
Author

@vanfanel @XProger I just fixed this. OpenLara LibRetro now works on GLES RetroArch too:

#20

@vanfanel2
Copy link

@alfrix : GLES is broken again (it builds, but does not display anything). It's not your fault. Please merge latest upstream changes to get it working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants