Page 2 of 2
Re: Cross compilation problems
Posted: Thu Nov 17, 2011 12:30 pm
by doragasu
I think I'm getting a bit nearer, but still no luck. The error I get now is: "Could not retrieve EGL function eglGetDisplay"
Full traceback log:
http://pastebin.com/PgWgE9MT
I may be wrong, but I think I don't need to touch pygame, just renpy and SDL to get this working with GLES.
Re: Cross compilation problems
Posted: Fri Nov 18, 2011 12:52 am
by PyTom
It seems like you're not linking against the EGL library. That's required for OpenGL ES.
Re: Cross compilation problems
Posted: Fri Nov 18, 2011 3:50 am
by doragasu
Yes, that's what looks like, but I'm indeed linking against libGLES_CM.so.
I have tried locating the libraries in my Pandora console and trying to read the simbols to see if the offending function is listed, and I have found something really strange.
If I run from my PC "arm-angstrom-linux-gnueabi-nm libGLES_CM.so", it lists properly the symbols, including the offending function. If I run "nm libGLES_CM.so" from my Pandora, it says there are no symbols defined! If now I copy this library that is supposed to have no symbols from my Pandora to my PC, and run arm-angstrom-linux-gnueabi on it, symbols are listed!
Even more strange, if I run from my Pandora "nm libGLES2D.so", symbols are also listed!
Could it be a problem with the library or with the command nm in my Pandora? Looks like, but I don't think so because I can run other gles programs in the console without problems (for example Quake and Quake II ports).
A run of nm command in my PC:
Code: Select all
$ arm-angstrom-linux-gnueabi-nm -Dg /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib/libGLES_CM.so | grep eglGetDisplay
U IMGeglGetDisplay
0003e968 T eglGetDisplay
$ arm-angstrom-linux-gnueabi-nm -Dg /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib/libGLES2D.so | grep eglGetDisplay
U eglGetDisplay
I have also tried to copy libGLES_CM.so included in my cross-compiler to renpy install directory to see if it helps, but the result is the same, and nm also behaves the same with this library.
EDIT: I have browsed the code in SDL that loads the library and is causing the error. It looks like the library is loaded, but dlsym fails to load the function pointer (maybe because of the same problem that makes nm fail?). The related code inside SDL_x11gles.c:
Code: Select all
[...]
/*
* A macro for loading a function pointer with dlsym
*/
#define LOAD_FUNC(NAME) \
*((void**)&this->gles_data->NAME) = dlsym(handle, #NAME); \
if (!this->gles_data->NAME) \
{ \
SDL_SetError("Could not retrieve EGL function " #NAME); \
return -1; \
}
/* Passing a NULL path means load pointers from the application */
int X11_GLES_LoadLibrary(_THIS, const char* path)
{
[...] Removed the code that loads EGL library using dlopen and errors if something goes wrong
/* Load new function pointers */
LOAD_FUNC(eglGetDisplay);
[...]
Pastebin of the complete X11_GLES_LoadLibrary function:
http://pastebin.com/qFC5jj50
Re: Cross compilation problems
Posted: Mon Nov 21, 2011 11:50 am
by Spiky Caterpillar
I've run into similar errors before; I *THINK* they were a result of an autoconf script 'helpfully' trying to use a native ranlib and/or ar instead of a crosscompiling version, so the .a file's index never got properly created. (And an awful lot of build scripts don't even let you override ar and ranlib yourself, or build their own ranlib, or something similarly troublesome.) If you crosscompiled libGLES_CM, do it again and check for ignored errors, or errors that happen the first time you build the library and then don't happen on subsequent times.
Re: Cross compilation problems
Posted: Mon Nov 21, 2011 1:10 pm
by PyTom
Also, note that usually EGL is in a different library than libGLES_CM.
Re: Cross compilation problems
Posted: Fri Nov 25, 2011 5:03 am
by doragasu
I've been really busy past week, and had no time to do much tests. Things I've tested:
- Py'Tom was right: I was not linking to EGL, and was only linking to GLES_CM. Unfortunately, I have built again both SDL and Ren'Py module linking against both GLES_CM and EGL, and the behaviour is exactly the same.
- The strange behaviour I reported with "nm" was because of a stupid mistake I made when calling the tool. When calling it from the PC I was using the "-D" switch, but I forgot to use it when calling it from the Pandora console.
- I have straced a Ren'Py run, and it looks like both libGLES_CM and libEGL are properly loaded. (both open() and mmap2() calls for both libraries return without problem). SDL library is also loaded. Unfortunately information in the trace is not very helpful beyond this point.
When I get some time, I will try to compile/install ltrace in the Pandora to see if ltrace spits more usable information. If ltrace doesn't give me an insight, I'll have to try debugging SDL and/or Ren'Py, but I hope I'll not have to do that...
Re: Cross compilation problems
Posted: Mon Nov 28, 2011 4:40 am
by doragasu
I have done a small modification of the macro used to load the EGL symbols and now the error about eglDisplay function is gone

. But guess what, the game still starts in software mode and now I face a new error message:
Code: Select all
Could not get pygame screen: error('X11 driver not configured with OpenGL',)
A quick grep shows this error code is generated also in SDL library by the OpenGL (not GLES) video driver, so it looks like I will also have to change something in pygame to make it work with GLES. Any pygame experts here? Will I only have to change things in the initialization (like renaming function calls from the OGL to the GLES equivalents) or will I have to change things in more places (like porting the drawing code)?
Also @PyTom, I have seen you and Patrick Dawson have created a "Pygame subset for Android". I suppose it is what you use for the Android port, it must use GLES and work well with Ren'Py. I'm wondering if I it's a good idea trying to use it with this port, or if I should forget about it and try to make the full pygame work with GLES...
Re: Cross compilation problems
Posted: Mon Nov 28, 2011 7:09 pm
by PyTom
I'd probably go with something like the android port, or the angle port, rather than trying to make the full SDL work.