Bennu Game Development

English Forums => Platforms => Android => Topic started by: herve_02 on April 28, 2013, 06:30:44 PM

Title: bennugd crash on android with simple script.
Post by: herve_02 on April 28, 2013, 06:30:44 PM
hello
I am trying to compile bennugd for my android, because the version given with bennu-packager doesn't work.

so i start a fresh compile with ndk r8d  and android-15 everything compile, with minor adjustments. so i try to make a very simple hello word.
=============
main prg :
import "mod_text";
import "mod_video";
Const
    screen_width  = 320;
    screen_height = 240;
    screen_depth  =  16;
Process Main()
begin
  set_mode(screen_width,screen_height,screen_depth);
  write (0,100,100,0,"HELLO WORD");
Loop
Frame;
End
End
==================================
and the game crash complaining :
-----------------------------------------------------------------------
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00  pc 0003ae56  /data/data/com.couvelard/lib/libbgdrtm.so: Routine modvideo_set_mode_3 in jni/bgdrtm/../../../../modules/mod_video/mod_video.c:79
Stack frame #01  pc 0001ef8a  /data/data/com.couvelard/lib/libbgdrtm.so (instance_go): Routine instance_go in (null):0
Stack frame #02  pc 0001f33a  /data/data/com.couvelard/lib/libbgdrtm.so (instance_go_all): Routine instance_go_all in jni/bgdrtm/../../../../core/bgdrtm/src/interpreter.c:157
Stack frame #03  pc 00000b32  /data/data/com.couvelard/lib/libmain.so (SDL_main): Routine SDL_main in jni/src/main.c:126
Stack frame #04  pc 00000a22  /data/data/com.couvelard/lib/libmain.so (Java_org_libsdl_app_SDLActivity_nativeInit): Routine Java_org_libsdl_app_SDLActivity_nativeInit in jni/src//../../../../3rdparty/SDL/src/main/android/SDL_android_main.cpp:28
-------------------------------------------------------------------
Title: Re:bennugd crash on android with simple script.
Post by: FreeYourMind on April 28, 2013, 08:37:33 PM
I have a problem similar compiling the last version of bennugd android (r697) with the same mod_video module, but my problem is:

Error:

/modules/mod_video/mod_video.c:95: undefined reference to `gr_set_fps'
collect2: ld returned 1 exit status


I compile in Linux using ndk-build.
Maybe Josebita don't put a stable version in last r697 check-in on server, try to compile a previous version.
Title: Re:bennugd crash on android with simple script.
Post by: herve_02 on April 28, 2013, 11:21:31 PM
hello, the test apk, given here do not crash on my tablet, is it possible to have the source of it in order to compile it and see if it do not crash ?

https://www.dropbox.com/s/ef7i2g5jn2azddo/MyGame-debug_20130215.apk
Title: Re:bennugd crash on android with simple script. SOLVED
Post by: herve_02 on April 29, 2013, 10:48:29 PM
ok.. the problem is solved, much more worked around, in fact

i download the last packager... bennu crash on android :
============================== some debug infos ===================================
V/SDL     ( 5125): Creating new EGL Surface
I/SDL     ( 5125): [STUB] GL_SetSwapInterval
I/SDL     ( 5125): [STUB] GL_GetSwapInterval
I/SDL     ( 5125): [STUB] GL_DeleteContext
V/SDL     ( 5125): Creating new EGL Surface
E/SDL     ( 5125): Couldn't create surface
I/SDL     ( 5125): [STUB] GL_SetSwapInterval
I/SDL     ( 5125): [STUB] GL_GetSwapInterval
F/libc    ( 5125): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
========================================================================
so it appears that bennu ask twice for the EGL Surface and crash on the second ask..
so..... after some tries... i modified SDLActivity.java

    public static boolean createEGLSurface() {
        if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLConfig != null) {
            EGL10 egl = (EGL10)EGLContext.getEGL();
            if (SDLActivity.mEGLContext == null) createEGLContext();
            if (SDLActivity.mEGLSurface == null) { // <<<<<<<<<<<<<<<<<<<<<<  line added =========================
            Log.v("SDL", "Creating new EGL Surface");
            EGLSurface surface = egl.eglCreateWindowSurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, SDLActivity.mSurface, null);
            if (surface == EGL10.EGL_NO_SURFACE) {
                Log.e("SDL", "Couldn't create surface");
                return false;
            }

            if (egl.eglGetCurrentContext() != SDLActivity.mEGLContext) {
                if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, surface, surface, SDLActivity.mEGLContext)) {
                    Log.e("SDL", "Old EGL Context doesnt work, trying with a new one");
                    // TODO: Notify the user via a message that the old context could not be restored, and that textures need to be manually restored.
                    createEGLContext();
                    if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, surface, surface, SDLActivity.mEGLContext)) {
                        Log.e("SDL", "Failed making EGL Context current");
                        return false;
                    }
                }
            }
            SDLActivity.mEGLSurface = surface;
              } // <<<<<<<<<<<<<<<<<<<<<<<<< line added =============================
            return true;
        }
        return false;
    }

and the problem is gone...............

Title: Re:bennugd crash on android with simple script.
Post by: panreyes on April 29, 2013, 11:03:34 PM
Hi herve_02! In which terminal are you using BennuGD?
Title: Re:bennugd crash on android with simple script.
Post by: MisterN on April 30, 2013, 01:23:01 AM
i wanna see my cutscene example running in android lol
Title: Re:bennugd crash on android with simple script.
Post by: herve_02 on April 30, 2013, 08:56:50 AM
i don't know, no trade mark, bought some times ago, i have just vendor id and product id
vendor_id is google.
lsusb => 18d1:0003

(http://couvelard.com/herve/my_tablet.jpg)
Title: Re:bennugd crash on android with simple script.
Post by: handsource-dyko on April 30, 2013, 09:24:58 AM
Maybe it's a Yarvik or TomTec brand. (something from china). In Holland toy stores sell a lot of these inexpensive chinese-made android tablets for under 200 euro. These devices often have a Rockchip or Allwinner A8 or A9 based ARM processor. It's quite possible you've got a different brand, but that it comes from the same factory.

Here are some specs of the used processors:

http://en.wikipedia.org/wiki/Allwinner_A1X (http://en.wikipedia.org/wiki/Allwinner_A1X)
http://en.wikipedia.org/wiki/Rockchip#Rockchip_29xx_series (http://en.wikipedia.org/wiki/Rockchip#Rockchip_29xx_series)

It could also contain a SOC from MediaTek: http://en.wikipedia.org/wiki/MediaTek#Smartphone_application_.26_modem_processors_.2F_SoCs (http://en.wikipedia.org/wiki/MediaTek#Smartphone_application_.26_modem_processors_.2F_SoCs)


Title: Re:bennugd crash on android with simple script.
Post by: panreyes on April 30, 2013, 09:31:27 AM
herve_02, try this app:
https://play.google.com/store/apps/details?id=com.dama.hardwareinfo&hl=es (https://play.google.com/store/apps/details?id=com.dama.hardwareinfo&hl=es)


And please attach the log it creates!
Title: Re:bennugd crash on android with simple script.
Post by: herve_02 on April 30, 2013, 09:48:00 AM
do you have the apk ?
Title: Re:bennugd crash on android with simple script.
Post by: panreyes on April 30, 2013, 10:11:57 AM
I've sent you an e-mail :)
Title: Re:bennugd crash on android with simple script.
Post by: panreyes on April 30, 2013, 01:23:38 PM
So your GPU is a Mali 400. It shouldn't need any changes to work with that.


Does this game work on your tablet?
http://www.pixjuegos.com/pixpang-ouya.apk
Title: Re:bennugd crash on android with simple script.
Post by: herve_02 on April 30, 2013, 02:08:28 PM
hello, same punishment :
got the first image and then crash...

blablablabla!.................
D/libEGL  ( 7102): loaded /system/lib/egl/libEGL_mali.so                                             
D/libEGL  ( 7102): loaded /system/lib/egl/libGLESv1_CM_mali.so                                                             
D/libEGL  ( 7102): loaded /system/lib/egl/libGLESv2_mali.so                                                                                 
V/SDL     ( 7102): Creating new EGL Surface                                                                           
I/SDL     ( 7102): [STUB] GL_SetSwapInterval                                                                                               
I/SDL     ( 7102): [STUB] GL_GetSwapInterval                                                                                                   
I/SDL     ( 7102): [STUB] GL_DeleteContext                                                                                               
V/SDL     ( 7102): Creating new EGL Surface                                                                                   
E/SDL     ( 7102): Couldn't create surface                                                                             
I/SDL     ( 7102): [STUB] GL_SetSwapInterval                                                                                               
I/SDL     ( 7102): [STUB] GL_GetSwapInterval                 
D/dalvikvm( 7102): GC_CONCURRENT freed 509K, 12% free 6641K/7495K, paused 1ms+2ms
(.........)
D/dalvikvm( 7102): GC_CONCURRENT freed 446K, 12% free 6667K/7495K, paused 2ms+2ms                       
V/SDL     ( 7102): SDL audio: opening device                 
V/SDL     ( 7102): SDL audio: wanted stereo 16-bit 22.05kHz, 1024 frames buffer
V/SDL     ( 7102): SDL audio: got stereo 16-bit 22.05kHz, 3840 frames buffer
D/audio_hw_primary(   85): start_output_stream: card:0, port:0, rate:44100
D/dalvikvm( 7102): GC_CONCURRENT freed 510K, 12% free 6657K/7495K, paused 2ms+2ms
(......)
D/dalvikvm( 7102): GC_CONCURRENT freed 510K, 12% free 6657K/7495K, paused 2ms+2ms     
F/libc    ( 7102): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)       
I/DEBUG   ( 6495): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 
Title: Re:bennugd crash on android with simple script.
Post by: panreyes on May 02, 2013, 07:06:38 PM
Hi herve_02!


I don't know about that new error, but that line you added before made the Adreno GPU's based devices to work!!


Thanks a lot! I hope it doesn't break anything though :)


BTW: Are you using mod_debug? It's not available in Android's BennuGD.
Title: Re:bennugd crash on android with simple script.
Post by: JaViS on May 03, 2013, 04:43:50 PM
Can someone distribute the fixed packager? I don't know how to add that line.


It seems the issue is solved. After someone provide a download I'll announce it on the website and link to it.


thanks!
Title: Re:bennugd crash on android with simple script.
Post by: herve_02 on May 04, 2013, 07:55:49 PM
@pixel..

no i do not use mod debug... just the adb debug thing.... "adb logcat" with the device connected..
Title: Re:bennugd crash on android with simple script.
Post by: panreyes on May 04, 2013, 07:59:46 PM
Send me your code and I'll try to run it
Title: Re:bennugd crash on android with simple script.
Post by: herve_02 on May 04, 2013, 08:07:27 PM
everything i write is working now with the new sdlactivity.java, that was the error with the apk they send me to test.

thanks a lot for the proposition
Title: Re:bennugd crash on android with simple script.
Post by: josebita on May 05, 2013, 12:29:29 AM
Quote from: herve_02 on April 29, 2013, 10:48:29 PM
ok.. the problem is solved, much more worked around, in fact

i download the last packager... bennu crash on android :
============================== some debug infos ===================================
V/SDL     ( 5125): Creating new EGL Surface
I/SDL     ( 5125): [STUB] GL_SetSwapInterval
I/SDL     ( 5125): [STUB] GL_GetSwapInterval
I/SDL     ( 5125): [STUB] GL_DeleteContext
V/SDL     ( 5125): Creating new EGL Surface
E/SDL     ( 5125): Couldn't create surface
I/SDL     ( 5125): [STUB] GL_SetSwapInterval
I/SDL     ( 5125): [STUB] GL_GetSwapInterval
F/libc    ( 5125): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
========================================================================
so it appears that bennu ask twice for the EGL Surface and crash on the second ask..
so..... after some tries... i modified SDLActivity.java

    public static boolean createEGLSurface() {
        if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLConfig != null) {
            EGL10 egl = (EGL10)EGLContext.getEGL();
            if (SDLActivity.mEGLContext == null) createEGLContext();
            if (SDLActivity.mEGLSurface == null) { // <<<<<<<<<<<<<<<<<<<<<<  line added =========================
            Log.v("SDL", "Creating new EGL Surface");
            EGLSurface surface = egl.eglCreateWindowSurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, SDLActivity.mSurface, null);
            if (surface == EGL10.EGL_NO_SURFACE) {
                Log.e("SDL", "Couldn't create surface");
                return false;
            }

            if (egl.eglGetCurrentContext() != SDLActivity.mEGLContext) {
                if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, surface, surface, SDLActivity.mEGLContext)) {
                    Log.e("SDL", "Old EGL Context doesnt work, trying with a new one");
                    // TODO: Notify the user via a message that the old context could not be restored, and that textures need to be manually restored.
                    createEGLContext();
                    if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, surface, surface, SDLActivity.mEGLContext)) {
                        Log.e("SDL", "Failed making EGL Context current");
                        return false;
                    }
                }
            }
            SDLActivity.mEGLSurface = surface;
              } // <<<<<<<<<<<<<<<<<<<<<<<<< line added =============================
            return true;
        }
        return false;
    }

and the problem is gone...............
Hi herve_02,

Thanks a lot for having a look at this.
Right now I'm updating my packager code to include this fix and a few others. It'll include the JDK for Windows, too.
The Linux version should be updated in a matter of minutes in my PPA, windows should be up in a matter of hours.