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

Strange stuck bug on the old Android devices #26

Closed
EXL opened this Issue Jun 9, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@EXL

EXL commented Jun 9, 2017

On older Android devices I get the problem with stuck when choosing some libraries through dlopen.

The bug is reproducible on Motorola Droid 2, Android 2.3.4 and don't affect on my another Android devices: Motorola Droid 4, Android 6.0.1 (CM 13), Motorola Photon Q, Android 4.1.2 and huge heap of emulators.

Using debug I found a place where the app gets stuck:

https://github.com/ptitSeb/gl4es/blob/master/src/gl/loader.c#L62

I put a couple of debug-output:

GL4ES Debug Output

And I got a log:

I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libbcm_host.so, flags: 0x00000000
<now app gets stuck w/ black screen>

I thought it was because of the RPi libraries that are not in the Android device and I commented this function calls:

BCM Wrong Libraries

But it did not help. OpenGL ES and EGL libraries were not loaded too:

I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libGLESv1_CM.so, flags: 0x00000000
<now app gets stuck w/ black screen>
I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libEGL.so, flags: 0x00000000
<now app gets stuck w/ black screen>

Log from the Motorola Photon Q, Android 4.1.2 phone, where everything works:

I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libGLESv1_CM.so, flags: 0x00000000
I/LIBGL: Now Here!
I/LIBGL: LIBGL:loaded: libGLESv1_CM.so
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libEGL.so, flags: 0x00000000
I/LIBGL: Now Here!
I/LIBGL: LIBGL:loaded: libEGL.so

I tried to substitute library name with the full path (e. g. /system/lib/egl/libEGL_POWERVR_SGX530_125.so) to the dlopen function, but this also does not work.

Any assumptions or suggestions? Thanks!

@ptitSeb

This comment has been minimized.

Owner

ptitSeb commented Jun 9, 2017

Yes, it's a problem with older Android version were dl_open is not recursive. here is an url with some info ( http://grokbase.com/t/gg/android-ndk/124bdvscqx/block-with-calling-dlopen-and-dlclose ), but basicaly, on version of Android oder then 4.1 I think, you cannot dlopen a lib from a dlopen.
And gl4es just does some dlopen inside a dlopen, because it use, by default, a library constructor (the funciton with __attribute__((constructor))
But there is a workaround.

  1. In the Android.mk, remove the comment at line 54 ( https://github.com/ptitSeb/gl4es/blob/master/Android.mk#L54 ) to define NO_INIT_CONSTRUCTOR
  2. In your code, as soon as you can, call void initialize_gl4es() from gl4es to properly initialise GL4ES.

(I need to document that in main readme)

@EXL

This comment has been minimized.

EXL commented Jun 9, 2017

Many thanks for the detailed explanation. It works now!

I need to document that in main readme

Ok! Please close this issue when you add this info to ReadMe.

EXL added a commit to EXL/Gish that referenced this issue Jun 9, 2017

@ptitSeb

This comment has been minimized.

Owner

ptitSeb commented Jun 9, 2017

Done with 5d6a723

@ptitSeb ptitSeb closed this Jun 9, 2017

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