Google Play New problem : 64bits

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Honestly, I'm at a loss. I have so many files with the same names scattered across different folders and two computers (Windows and Linux)... It’s a mess. So, I'm back to rebuilding the ZGEBullet library from scratch. But unfortunately, the result is the same: it works perfectly in 32-bit but not in 64-bit. And I've tested it on three different phones already.
I also tried setting the minimum target to Android-19 and even Android-21. The original source code from Rado1 is set to Android-8, which doesn't support 64-bit. For reference, my previous test library, libok.so, is targeting Android-19 and was built on the same computer and Android NDK as ZGEBullet.

There are no problems when compiling. And I just checked the two libraries:

Code: Select all

libZgeBullet.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=5f73afac1ae2d7f5268e15ca7688b0163faaa602, stripped

libZgeBullet.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=cec1e61e7760fe27f9dab8a96ced7514a2e3772f, stripped
Right now, I have no more ideas :|


Edit: I adb libOpenSLES.so on my phone and it is there:
/system/lib64/libOpenSLES.so
User avatar
VilleK
Site Admin
Posts: 2320
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Did you try adding more debug info such as

Code: Select all

WriteLn(TheName)
just before the call to dlopen in Platform_LoadModule?

And judging from that code it looks like the module name should start with "." to make sure the AndroidLibraryPath is added to it.
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

I added that line. Is it showing in the log?

Here's the logcat for 32bit, which is working nicely, despite the errors:

Code: Select all

09-04 20:31:38.291   343   343 E ZgeAndroid: /storage/emulated/0
09-04 20:31:38.291   343   343 E ZgeAndroid: /data/user/0/com.txori.ZGEBullet/files/
09-04 20:31:38.291   343   343 E ZgeAndroid: /data/user/0/com.txori.ZGEBullet/lib/
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: JNI_OnLoad
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glDepthRange
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glGenLists
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glMateriali
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glIndexMask
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glListBase
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glBegin
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glCallList
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glColor3f
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glColor3fv
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glColor4fv
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glEnd
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glColorMaterial
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glDeleteLists
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glDrawBuffer
09-04 20:31:38.326   343   343 E ZgeAndroid: Function not found: glGetTexImage
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glPolygonMode
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glPopAttrib
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glPushAttrib
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glRasterPos2f
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glTexCoord2f
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glVertex2f
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glVertex3f
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glTexGeni
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glAttachShader
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glBindAttribLocation
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glCompileShader
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glCreateShader
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glCreateProgram
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glDeleteShader
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glDeleteProgram
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glDetachShader
09-04 20:31:38.327   343   343 E ZgeAndroid: Function not found: glGetProgramiv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glGetShaderiv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glGetShaderInfoLog
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glGetProgramInfoLog
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glValidateProgram
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glGetUniformLocation
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glLinkProgram
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glShaderSource
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniform3fv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniform1f
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniform4fv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniform2fv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniform1i
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniform1fv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniformMatrix3fv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUniformMatrix4fv
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glUseProgram
09-04 20:31:38.328   343   343 E ZgeAndroid: Function not found: glIsRenderbuffer
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glBindRenderbuffer
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glDeleteRenderbuffers
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glGenRenderbuffers
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glRenderbufferStorage
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glBindFramebuffer
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glDeleteFramebuffers
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glGenFramebuffers
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glCheckFramebufferStatus
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glFramebufferTexture2D
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glFramebufferRenderbuffer
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glGenerateMipmap
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glRenderbufferStorageMultisample
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glTexImage2DMultisample
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glBlitFramebuffer
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glDisableVertexAttribArray
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glEnableVertexAttribArray
09-04 20:31:38.329   343   343 E ZgeAndroid: Function not found: glVertexAttribPointer
09-04 20:31:38.340   343   343 E ZgeAndroid: Function not found: JNI_OnLoad
09-04 20:31:38.427   343   343 E ZgeAndroid: GLBase: 1.1
09-04 20:31:38.585   343   595 E ZgeAndroid: Function not found: JNI_OnLoad
09-04 20:31:38.585   343   595 E ZgeAndroid: Function not found: glDepthRange
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glGenLists
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glMateriali
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glIndexMask
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glListBase
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glBegin
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glCallList
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glColor3f
09-04 20:31:38.586   343   595 E ZgeAndroid: Function not found: glColor3fv
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glColor4fv
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glEnd
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glColorMaterial
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glDeleteLists
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glDrawBuffer
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glGetTexImage
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glPolygonMode
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glPopAttrib
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glPushAttrib
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glRasterPos2f
09-04 20:31:38.587   343   595 E ZgeAndroid: Function not found: glTexCoord2f
09-04 20:31:38.588   343   595 E ZgeAndroid: Function not found: glVertex2f
09-04 20:31:38.588   343   595 E ZgeAndroid: Function not found: glVertex3f
09-04 20:31:38.588   343   595 E ZgeAndroid: Function not found: glTexGeni
09-04 20:31:38.607   343   595 E ZgeAndroid: Function not found: glAttachShader
09-04 20:31:38.607   343   595 E ZgeAndroid: Function not found: glBindAttribLocation
09-04 20:31:38.607   343   595 E ZgeAndroid: Function not found: glCompileShader
09-04 20:31:38.607   343   595 E ZgeAndroid: Function not found: glCreateShader
09-04 20:31:38.607   343   595 E ZgeAndroid: Function not found: glCreateProgram
09-04 20:31:38.607   343   595 E ZgeAndroid: Function not found: glDeleteShader
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glDeleteProgram
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glDetachShader
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glGetProgramiv
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glGetShaderiv
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glGetShaderInfoLog
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glGetProgramInfoLog
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glValidateProgram
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glGetUniformLocation
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glLinkProgram
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glShaderSource
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glUniform3fv
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glUniform1f
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glUniform4fv
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glUniform2fv
09-04 20:31:38.608   343   595 E ZgeAndroid: Function not found: glUniform1i
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glUniform1fv
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glUniformMatrix3fv
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glUniformMatrix4fv
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glUseProgram
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glIsRenderbuffer
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glBindRenderbuffer
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glDeleteRenderbuffers
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glGenRenderbuffers
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glRenderbufferStorage
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glBindFramebuffer
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glDeleteFramebuffers
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glGenFramebuffers
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glCheckFramebufferStatus
09-04 20:31:38.609   343   595 E ZgeAndroid: Function not found: glFramebufferTexture2D
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glFramebufferRenderbuffer
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glGenerateMipmap
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glRenderbufferStorageMultisample
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glTexImage2DMultisample
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glBlitFramebuffer
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glDisableVertexAttribArray
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glEnableVertexAttribArray
09-04 20:31:38.610   343   595 E ZgeAndroid: Function not found: glVertexAttribPointer
09-04 20:31:38.738   343   595 E ZgeAndroid: CPUs: 8
And here's the non working 64bit logcat:

Code: Select all

09-04 20:33:38.823  1249  1249 E ZgeAndroid: /storage/emulated/0
09-04 20:33:38.823  1249  1249 E ZgeAndroid: /data/user/0/com.txori.ZGEBullet/files/
09-04 20:33:38.823  1249  1249 E ZgeAndroid: /data/user/0/com.txori.ZGEBullet/lib/
09-04 20:33:38.858  1249  1249 E ZgeAndroid: Function not found: JNI_OnLoad
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glDepthRange
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glGenLists
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glMateriali
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glIndexMask
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glListBase
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glBegin
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glCallList
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glColor3f
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glColor3fv
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glColor4fv
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glEnd
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glColorMaterial
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glDeleteLists
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glDrawBuffer
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glGetTexImage
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glPolygonMode
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glPopAttrib
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glPushAttrib
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glRasterPos2f
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glTexCoord2f
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glVertex2f
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glVertex3f
09-04 20:33:38.859  1249  1249 E ZgeAndroid: Function not found: glTexGeni
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glAttachShader
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glBindAttribLocation
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glCompileShader
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glCreateShader
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glCreateProgram
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glDeleteShader
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glDeleteProgram
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glDetachShader
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glGetProgramiv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glGetShaderiv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glGetShaderInfoLog
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glGetProgramInfoLog
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glValidateProgram
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glGetUniformLocation
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glLinkProgram
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glShaderSource
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniform3fv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniform1f
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniform4fv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniform2fv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniform1i
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniform1fv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniformMatrix3fv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUniformMatrix4fv
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glUseProgram
09-04 20:33:38.860  1249  1249 E ZgeAndroid: Function not found: glIsRenderbuffer
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glBindRenderbuffer
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glDeleteRenderbuffers
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glGenRenderbuffers
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glRenderbufferStorage
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glBindFramebuffer
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glDeleteFramebuffers
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glGenFramebuffers
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glCheckFramebufferStatus
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glFramebufferTexture2D
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glFramebufferRenderbuffer
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glGenerateMipmap
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glRenderbufferStorageMultisample
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glTexImage2DMultisample
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glBlitFramebuffer
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glDisableVertexAttribArray
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glEnableVertexAttribArray
09-04 20:33:38.861  1249  1249 E ZgeAndroid: Function not found: glVertexAttribPointer
09-04 20:33:38.862  1249  1249 E ZgeAndroid: failed to load: /data/user/0/com.txori.ZGEBullet/lib/./libZgeBullet.so
09-04 20:33:38.862  1249  1249 E ZgeAndroid: Found JNI_OnLoad function, calling now...
But I already tried to log a lot of stuff in that function: https://www.emix8.org/forum/viewtopic.p ... 881#p10703

Edit:
New idea!
I'll try loading a known library such as OpenCV after eating.
https://opencv.org/releases/
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

OpenCV 64bit library libopencv_java4.so is loading just fine, even if I don't know what to do with it afterward. No crash.

So the good news is that the problem doesn't seem to be coming from libzgeandroid.so :?
And the bad news is that the only two libraries that I use are not working.

For Sunvox, I just tried their app, and it is running just fine in 64bit. So I unpacked it to get their libraries, instead of the ones that are in their developer's package. Turn out it's not the same library, named sundog instead of libsunvox. And the calls to it aren't the same...

Then I tried readelf -d libsunvox.so
Both 32 and 64 version are asking for the same shared libraries:
  • liblog.so
  • libandroid.so
  • libOpenSLES.so
  • libm.so
  • libdl.so
  • libc.so
I really don't see why it would come from my phone. So here's a simple test to play music on android. Please try it if you have an android and tell me if it works for you.
Attachments
ZGE_Sunvox_64-debug.apk
(1.45 MiB) Downloaded 9 times
User avatar
VilleK
Site Admin
Posts: 2320
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

I tried your apk and it crashes here too.

The errors in 32-bit is normal and this is because ZGE is trying to load OpenGL functions that do not exist in OpenGL ES.

Indeed, I forgot that writeln doesn't write to the log so you should use AndroidLog instead. But since the "Failed to load" message display the full path then it is not necessary.

I think you need to call at least one function in libopencv_java4.so otherwise ZGE will not try loading the library. Did you do that?
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

I just tried compiling the Sunvox Player example for Android from the Sunvox SDK, and it works fine using the same 64bit library. The only differences in how I build my APK from ZGE are:
  • Using of gradle instead of ant
  • Targeting platform android-12 (API 31) instead of android-10 (API 29)
  • Using build-tools android-12 (API 32) instead of android-11 (30.0.3)
Could this be an issue with an outdated SDK configuration?

Here's my current situation:
  • According to Google’s documentation, the minimum platform/build-tool version for running 64-bit apps is Android-5 (API 21). So my setup should be fine
  • I can’t update build-tools from Android-11 to Android-12 because the dx.bat file is missing after Android-11, and it's required for compiling the APK from ZGE
  • I tried changing android:minSdkVersion from 16 to 21, but that didn’t work. And I verified afterward, Sunvox Player is targeting minimal 16
  • I can’t set android:targetSdkVersion above 29 because the APK would require the newer Signature Scheme v2/v3, which I’m still trying to figure out how to implement
I'm a bit stuck. So, I tried the opposite approach: I compiled the Sunvox Player example again, but with targetSdkVersion 29 and build-tools 30.0.3, just like I do with ZGE. And... it's working! This is just crazy :shock:

The last difference is the use of gradle instead of ant to produce the apk, and that is going to get overly complicated... But necessary, as ant is no longer supported.

Edit:
As for this
I think you need to call at least one function in libopencv_java4.so otherwise ZGE will not try loading the library. Did you do that?
I have no idea what function to declare in ZExternalLibrary/Source in order to test it :lol:
Last edited by Ats on Thu Sep 05, 2024 11:09 am, edited 1 time in total.
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Re: Google Play New problem : 64bits

Post by Kjell »

Hi Ats,
Ats wrote: Thu Sep 05, 2024 9:20 amI have no idea what function to declare in ZExternalLibrary/Source in order to test it :lol:
Hmm .. you could try cvCbrt ( fast cubic root calculation ) which is part of the core module.

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnLoaded>
    <ZExternalLibrary ModuleName="libopencv" Source="float cvCbrt(float value){}"/>
    <ZExpression Expression="trace(intToStr(cvCbrt(2)*100));"/>
  </OnLoaded>
</ZApplication>
K
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Thanks, Kjell. But in a surprising turn of events, both libopencv_java4.so for 32-bit and 64-bit are crashing when a function is called on Android. Yet, everything runs fine on Windows... I triple-checked everything.

While waiting for a new idea to strike, I started modifying the ZGE source code to replace `armeabi` with `armeabi-v7a` as the 32-bit library folder name to avoid errors later on. That said, I'm a bit confused about what's happening in ZDesigner.dproj:

Code: Select all

<DeployClass Name="AndroidLibnativeArmeabiFile">
    <Platform Name="Android">
        <RemoteDir>library\lib\armeabi</RemoteDir>
        <Operation>1</Operation>
    </Platform>
    <Platform Name="Android64">
        <RemoteDir>library\lib\armeabi</RemoteDir>
        <Operation>1</Operation>
    </Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
    <Platform Name="Android64">
        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
        <Operation>1</Operation>
    </Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
    <Platform Name="Android">
        <RemoteDir>library\lib\mips</RemoteDir>
        <Operation>1</Operation>
    </Platform>
    <Platform Name="Android64">
        <RemoteDir>library\lib\mips</RemoteDir>
        <Operation>1</Operation>
    </Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
    <Platform Name="Android">
        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
        <Operation>1</Operation>
    </Platform>
    <Platform Name="Android64">
        <RemoteDir>library\lib\arm64-v8a</RemoteDir>
        <Operation>1</Operation>
    </Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput_Android32">
    <Platform Name="Android64">
        <RemoteDir>library\lib\armeabi-v7a</RemoteDir>
        <Operation>1</Operation>
    </Platform>
</DeployClass>
Why are the folders library\lib\armeabi and library\lib\armeabi-v7a associated with the Platform Name "Android64"? What does that even do?

Edit:
Rhaaaa... I've been requesting a trial license for Embarcadero's RAD Studio every two years since 2018. Now, they say I can't renew without paying €2,040 (20% off, what a bargain) :lol:
So I made the modifications to rename the folder on github, but I have no way to compile ZGameEditor.exe

Edit 2:
I just got a phone call from Embarcadero. They were very nice and told me that I could have another trial license to test my stuff :D
User avatar
VilleK
Site Admin
Posts: 2320
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

The dproj file is not used by Freepascal so it is not relevant. Delphi IDE adds those various items automatically.

The crash when calling external function is most likely because the ZExpression changes are not yet working. Please check if you can make it compile using the AArch64 path: https://github.com/VilleKrumlinde/zgameeditor/pull/53

Let's check if the sunvox file is found. Try adding this code before the dlopen call in ZPlatform_Android.inc

Code: Select all

if FileExitst(TheName) then
  AndroidLog('Library found')
else
  AndroidLog('Library NOT found');
Good that you could extend your trial license :)
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

I added theName to the trace so we can see what is found or not :wink:
I removed from the log all the "E ZgeAndroid: Function not found: glSomething" for clarity.

Here's the logcat for the working 32bit:

Code: Select all

09-06 18:50:58.207 21878 21878 E ZgeAndroid: /storage/emulated/0
09-06 18:50:58.207 21878 21878 E ZgeAndroid: /data/user/0/com.txori.sunvox/files/
09-06 18:50:58.207 21878 21878 E ZgeAndroid: /data/user/0/com.txori.sunvox/lib/
09-06 18:50:58.209 21878 21878 E ZgeAndroid: Library NOT found: libGLESv1_CM.so
09-06 18:50:58.244 21878 21878 E ZgeAndroid: Function not found: JNI_OnLoad
09-06 18:50:58.247 21878 21878 E ZgeAndroid: Library found: /data/user/0/com.txori.sunvox/lib/./libsunvox.so
09-06 18:50:58.248 21878 21878 E ZgeAndroid: Function not found: JNI_OnLoad
09-06 18:50:58.440 21878 21878 E ZgeAndroid: GLBase: 1.1
09-06 18:50:58.612 21878 21935 E ZgeAndroid: Library NOT found: libGLESv1_CM.so
09-06 18:50:58.613 21878 21935 E ZgeAndroid: Function not found: JNI_OnLoad
and the logcat for the crashing 64bit:

Code: Select all

09-06 18:55:53.014 22825 22825 E ZgeAndroid: /storage/emulated/0
09-06 18:55:53.014 22825 22825 E ZgeAndroid: /data/user/0/com.txori.sunvox/files/
09-06 18:55:53.014 22825 22825 E ZgeAndroid: /data/user/0/com.txori.sunvox/lib/
09-06 18:55:53.016 22825 22825 E ZgeAndroid: Library NOT found: libGLESv1_CM.so
09-06 18:55:53.061 22825 22825 E ZgeAndroid: Function not found: JNI_OnLoad
09-06 18:55:53.064 22825 22825 E ZgeAndroid: Library NOT found: /data/user/0/com.txori.sunvox/lib/./libsunvox.so
09-06 18:55:53.064 22825 22825 E ZgeAndroid: failed to load: /data/user/0/com.txori.sunvox/lib/./libsunvox.so
09-06 18:55:53.064 22825 22825 E ZgeAndroid: Found JNI_OnLoad function, calling now...
So the problem might be coming from what you say, but I'm not sure what you mean by "I think Android 64-bit should use the AArch64 code as much as possible. So it should use the 64-bit code that "generates a trampoline" instead of the inline asm code that 32-bit platforms use."
User avatar
VilleK
Site Admin
Posts: 2320
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

This is interesting, ZGE cannot find the library file. So we must figure out the actual path where ZGE should load the library. Did you also try removing "./" from the module name to see if it finds the library then?

Code: Select all

09-06 18:55:53.064 22825 22825 E ZgeAndroid: Library NOT found: /data/user/0/com.txori.sunvox/lib/./libsunvox.so
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Here's the result for if(ANDROID) this.ModuleName = "libsunvox.so"; in 64bit

Code: Select all

09-07 12:55:25.323 22826 22826 E ZgeAndroid: /storage/emulated/0
09-07 12:55:25.323 22826 22826 E ZgeAndroid: /data/user/0/com.txori.sunvox64/files/
09-07 12:55:25.323 22826 22826 E ZgeAndroid: /data/user/0/com.txori.sunvox64/lib/
09-07 12:55:25.326 22826 22826 E ZgeAndroid: Library NOT found: libGLESv1_CM.so
09-07 12:55:25.327 22826 22826 E ZgeAndroid: Function not found: JNI_OnLoad
09-07 12:55:25.333 22826 22826 E ZgeAndroid: Library NOT found: libsunvox.so
09-07 12:55:25.335 22826 22826 E ZgeAndroid: Function not found: JNI_OnLoad
I also tried loading with the full path:
if(ANDROID) this.ModuleName = "/data/user/0/com.txori.sunvox/lib/armeabi/libsunvox.so"; // for 32
or
if(ANDROID) this.ModuleName = "/data/user/0/com.txori.sunvox/lib/arm64-v8a/libsunvox.so"; //for 64
But both are not working. With a little difference: 64bits crash instantaneously, just like before, but 32bits is stuck in a loop trying to find the library without crashing.

I just tried again the simple library I created to test 32 and 64, and it is working for both:
I'm loading the library using if(ANDROID) this.ModuleName = "./libok.so";
And both 32 and 64 have the same log:

Code: Select all

09-07 13:01:49.399 23720 23720 E ZgeAndroid: /storage/emulated/0
09-07 13:01:49.399 23720 23720 E ZgeAndroid: /data/user/0/com.txori.zge_android_lib64/files/
09-07 13:01:49.399 23720 23720 E ZgeAndroid: /data/user/0/com.txori.zge_android_lib64/lib/
09-07 13:01:49.400 23720 23720 E ZgeAndroid: Function not found: JNI_OnLoad
09-07 13:01:49.404 23720 23720 E ZgeAndroid: GLBase: 1.1
09-07 13:01:49.530 23720 23763 E ZgeAndroid: Function not found: JNI_OnLoad
Is it possible that the size of the external library matters, and somehow isn't loading correctly or something in 64bit?
User avatar
VilleK
Site Admin
Posts: 2320
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Ats wrote: Sat Sep 07, 2024 11:05 am I just tried again the simple library I created to test 32 and 64, and it is working for both:
Your test project never calls the "test" function so the library is never loaded. ZGE loads the library the first time a function in the library is called.
User avatar
Ats
Posts: 713
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Oh lol, you're right :lol:
So my test library works in 32-bit but crashes in 64-bit, and I prefer this result to be consistent with the others because it was really bothering me...
User avatar
VilleK
Site Admin
Posts: 2320
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

For the 64-bit version, does the log show that it finds the library or not? I suspect it doesn't find it so we need to figure out where the library should be located or change the location where ZGE tries to load it.
Post Reply