SDL port for Android SDK/NDK 1.6

Quickly share your Android Code Snippets here...

Re: SDL port for Android SDK/NDK 1.6

Postby jonbonazza » Tue Feb 12, 2013 5:43 pm

SDL stands for Simple Direct-Media Layer. It is a layer on top of low level systems, such as OpenGL, input, etc... and provides a consistent, cross-platform interface for media applications, such as games.
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Top

Re: SDL port for Android SDK/NDK 1.6

Postby Jugend88 » Sat Feb 16, 2013 11:35 am

Good afternoon. Will updated VCMI game for android? Has released version 0.91.
Jugend88
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Feb 16, 2013 11:13 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Sat Feb 16, 2013 11:50 am

VCMI - maybe, someday. I do not maintain it anymore, it's maintained by another developer.

I'm being lazy lately, so I did not fix the 4:3 aspect ratio video not centered, but I remember about that.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Oddbrother » Tue Mar 05, 2013 4:14 pm

How about networking? Have games that supported network multiplayer been implemented in these ports?
User avatar
Oddbrother
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Mar 05, 2013 4:08 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Tue Mar 05, 2013 5:07 pm

OpenArena and OpenTTD support network play, but they do not use SDL for networking - they use POSIX API. Android NDK provides the same set of networking API as other OSes, such as Linux/FreeBSD etc. Windows provides an old version of POSIX networking API, with some function names changed, but it's still pretty close.
There is SDL_net library provided in the repository, which abstracts that differences, but very few projects use it.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Wed Mar 20, 2013 1:46 am

Hi!

Good work pelya!
I need some help, has any of you been succesful using libsndfile?
Because I can't compile my app because of it.
I put the source inside jni with an Android.mk from another lib, added libsndfile to the variable on my project .cfg and in some way or another it fails.

Also when issuing ../launchConfigureLib.sh it fails about that the preprocessor sanity check failed, being launched /lib/cpp... which is quite strange.
Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Wed Mar 20, 2013 3:01 pm

I've added sndfile library to SDL repo, it compiles but I did not run any tests.
Generally, to androidify a library, you run configure script on 32-bit PC, then edit resulting file config.h to match Android headers, and add an Android.mk file, which will just compile all .c files in the current directory.
launchConfigureLib.sh will just help to generate appropriate config.h, but configure/make will usually fail in many places, such as running tests or ranlib, and there are different errors for each library.
There is only one library inside SDL repo that runs configure script - ffmpeg, and it's only because I've used pre-made build scripts from the ffmpeg4android project.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Wed Mar 20, 2013 3:19 pm

Thanks a lot! When I get home I'll try it! :D
Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Re: SDL port for Android SDK/NDK 1.6

Postby Bjurr » Thu Mar 21, 2013 4:37 am

Anybody tried building this under OSX? I have searched the thread and found nothing about this.

Everything was building fine under Kubuntu 12.04, but apparently OSX 10.8.3 doesn't want to play nice...but I'd like to get around installing Parallels ;)

First, here are the general infos:
-OSX 10.8.3
-SDK platform 17 (also tried 15)
-NDK r8d
-Emulator and Nexus-7 (Jelly Bean)

Using Ballfield as an example, code builds and runs fine on my kubuntu with this sdk and ndk revs, but on OSX ffmpeg is giving me some headaches (or at least, I think that's the culprit). The end result is that dlopen() isn't able to open sdl_mixer.so (as I will show later on).

What really bugs me is ffmpeg. When building, there are 2 things that happen:
- libpostproc "not found" error
- "commands commence before first target" makefile error

Here's a snip of the build output:

Code: Select all
...
/Users/burdo/Android/temp/commandergenius/project/jni/ffmpeg/libavcodec/options_table.h:309: warning: ‘inter_threshold’ is deprecated (declared at /Users/burdo/Android/temp/commandergenius/project/jni/ffmpeg/libavcodec/avcodec.h:2130)
/Users/burdo/Android/temp/commandergenius/project/jni/ffmpeg/libavcodec/options_table.h:314: warning: ‘quantizer_noise_shaping’ is deprecated (declared at /Users/burdo/Android/temp/commandergenius/project/jni/ffmpeg/libavcodec/avcodec.h:2137)
ld: warning: directory not found for option '-Llibpostproc'
ld: warning: directory not found for option '-Llibpostproc'
Undefined symbols for architecture x86_64:
  "_av_find_input_format", referenced from:
      _ff_load_image in lavfutils.o
  "_av_frame_get_channel_layout", referenced from:
      _avfilter_get_audio_buffer_ref_from_frame in avcodec.o
  "_av_frame_get_channels", referenced from:
      _avfilter_get_audio_buffer_ref_from_frame in avcodec.o
  "_av_frame_get_metadata", referenced from:
      _avfilter_copy_frame_props in avcodec.o
  "_av_frame_get_pkt_pos", referenced from:
      _avfilter_copy_frame_props in avcodec.o
  "_av_frame_set_channel_layout", referenced from:
      _avfilter_copy_buf_props in avcodec.o
  "_av_frame_set_channels", referenced from:
      _avfilter_copy_buf_props in avcodec.o
  "_av_frame_set_pkt_pos", referenced from:
      _avfilter_copy_buf_props in avcodec.o
  "_av_frame_set_sample_rate", referenced from:
      _avfilter_copy_buf_props in avcodec.o
  "_av_read_frame", referenced from:
      _ff_load_image in lavfutils.o
  "_av_register_all", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_alloc_frame", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_close", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_decode_video2", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_find_best_pix_fmt_of_2", referenced from:
      _pick_format in avfiltergraph.o
  "_avcodec_find_decoder", referenced from:
      _ff_load_image in lavfutils.o
  "_avcodec_open2", referenced from:
      _ff_load_image in lavfutils.o
  "_avformat_close_input", referenced from:
      _ff_load_image in lavfutils.o
  "_avformat_open_input", referenced from:
      _ff_load_image in lavfutils.o
  "_sws_freeContext", referenced from:
      _ff_scale_image in lswsutils.o
  "_sws_getContext", referenced from:
      _ff_scale_image in lswsutils.o
  "_sws_scale", referenced from:
      _ff_scale_image in lswsutils.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
ld: warning: directory not found for option '-Llibpostproc'
make: *** [libavfilter/libavfilter.3.dylib] Error 1
make: *** Waiting for unfinished jobs....
jni/../jni/ffmpeg/Android_configure.mk:143: Done.
jni/../jni/ffmpeg/Android_configure.mk:144: ============================================================
jni/../jni/ffmpeg/Android_configure.mk:153: ============================================================
jni/../jni/ffmpeg/Android_configure.mk:154: Configuring FFmpeg...
jni/../jni/ffmpeg/Android_configure.mk:155: cd jni/../jni/ffmpeg/android/armeabi; ../../configure --arch=arm --target-os=linux --enable-cross-compile --cross-prefix=/Users/burdo/Android/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/arm-linux-androideabi- --sysroot=/Users/burdo/Android/android-ndk-r8d/platforms/android-14/arch-arm --enable-shared --disable-static  --enable-avresample --extra-cflags='-fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float' --extra-ldflags='-no-canonical-prefixes' --extra-version=.android; cd $OLDPWD;
jni/../jni/ffmpeg/Android_configure.mk:157: Done.
jni/../jni/ffmpeg/Android_configure.mk:158: ============================================================
jni/../jni/ffmpeg/Android_configure.mk:330: ============================================================
jni/../jni/ffmpeg/Android_configure.mk:331: Fixing configuration...
jni/../jni/ffmpeg/Android_configure.mk:334: Done.
jni/../jni/ffmpeg/Android_configure.mk:335: ============================================================
jni/../jni/ffmpeg/Android_configure.mk:468: ============================================================
jni/../jni/ffmpeg/Android_configure.mk:469: Fixing Makefiles...
jni/../jni/ffmpeg/Android_configure.mk:472: Done.
jni/../jni/ffmpeg/Android_configure.mk:473: ============================================================
jni/../jni/ffmpeg/libavfilter/Makefile.android:216: *** commands commence before first target.  Stop.


So the first bunch of messages I suspect would mean that the library is potentially going to be broken. The one at the very bottom probably has to do with some issue with libavfilter/Makefile.android being modified and leaving a broken rule at the bottom. Removing the rule (that is already commented out to start with) fix the issue, but only to get me to this logcat output:

Code: Select all
...
I/System.out( 4908): libSDL: Loading libraries
I/System.out( 4908): libSDL: loaded GLESv2 lib
I/System.out( 4908): libSDL: Trying to extract binaries from assets binaries-armeabi-v7a.zip
I/System.out( 4908): libSDL: Trying to extract binaries from assets binaries.zip
I/System.out( 4908): libSDL: loading lib /data/data/net.olofson.ballfield/files/../lib/libsdl-1.2.so
D/dalvikvm( 4908): Trying to load lib /data/data/net.olofson.ballfield/files/../lib/libsdl-1.2.so 0x40ce6b88
D/dalvikvm( 4908): Added shared lib /data/data/net.olofson.ballfield/files/../lib/libsdl-1.2.so 0x40ce6b88
I/System.out( 4908): libSDL: Loading settings
D/dalvikvm(  443): GC_FOR_ALLOC freed <1K, 33% free 13436K/19816K, paused 84ms, total 84ms
I/ActivityManager(  305): Displayed net.olofson.ballfield/.MainActivity: +1s713ms
I/System.out( 4908): libSDL: Settings.Load(): enter
I/dalvikvm-heap(  443): Grow heap (frag case) to 20.111MB for 7198736-byte allocation
D/dalvikvm(  443): GC_FOR_ALLOC freed 0K, 24% free 20466K/26848K, paused 69ms, total 69ms
W/WindowManager(  305): Window freeze timeout expired.
W/WindowManager(  305): Force clearing orientation change: Window{41678078 u0 NavigationBar}
W/WindowManager(  305): Force clearing orientation change: Window{40ed93d0 u0 net.olofson.ballfield/net.olofson.ballfield.MainActivity}
W/WindowManager(  305): Force clearing orientation change: Window{40eee1a0 u0 com.android.launcher/com.android.launcher2.Launcher}
W/WindowManager(  305): Force clearing orientation change: Window{40e75d18 u0 com.android.systemui.ImageWallpaper}
D/dalvikvm(  443): GC_CONCURRENT freed 8000K, 54% free 12485K/26848K, paused 6ms+85ms, total 241ms
I/Choreographer(  443): Skipped 54 frames!  The application may be doing too much work on its main thread.
W/IInputConnectionWrapper( 1357): showStatusIcon on inactive InputConnection
D/dalvikvm(  305): GC_EXPLICIT freed 102K, 61% free 5045K/12616K, paused 5ms+8ms, total 203ms
I/System.out( 4908): android.os.Build.MODEL: sdk
I/System.out( 4908): libSDL: Settings.Load(): loaded settings successfully
I/System.out( 4908): libSDL: old cfg version 101, our version 101
D/dalvikvm( 4908): Trying to load lib /data/app-lib/net.olofson.ballfield-2/libapplication.so 0x40ce6b88
E/dalvikvm( 4908): dlopen("/data/app-lib/net.olofson.ballfield-2/libapplication.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libsdl_mixer.so" needed by "libapplication.so"; caused by load_library(linker.cpp:745): library "libsdl_mixer.so" not found
I/System.out( 4908): libSDL: error loading lib: java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libsdl_mixer.so" needed by "libapplication.so"; caused by load_library(linker.cpp:745): library "libsdl_mixer.so" not found
I/System.out( 4908): libSDL: loading lib /data/data/net.olofson.ballfield/files/libapplication.so
D/dalvikvm( 4908): Trying to load lib /data/data/net.olofson.ballfield/files/libapplication.so 0x40ce6b88
E/dalvikvm( 4908): dlopen("/data/data/net.olofson.ballfield/files/libapplication.so") failed: Cannot load library: find_library(linker.cpp:889): "/data/data/net.olofson.ballfield/files/libapplication.so" failed to load previously
I/System.out( 4908): libSDL: error loading lib: java.lang.UnsatisfiedLinkError: Cannot load library: find_library(linker.cpp:889): "/data/data/net.olofson.ballfield/files/libapplication.so" failed to load previously
I/System.out( 4908): libSDL: 3000-msec timeout in startup screen
...


Files are installed at the right place, all valid (non zero-bytes), and overall the build output "looks" the same between my kubuntu and osx boxes. Unfortunately, the end result isn't the same.

So, before going any further, I was curious to see if anybody else had the same issues as I have. I am going to try to get ffmpeg to build as standalone (ffmpeg4android) and see if that gets me somewhere.

Any ideas are appreciated!


Oh, I was about to forget. There are also those "warning" messages I get when running changeAppSettings.sh under OSX. Haven't had much time to look into those yet:

Code: Select all
...
Patching MainActivity.java
Patching Settings.java
Patching Video.java
Patching project/AndroidManifest.xml
sed: 1: "project/AndroidManifest ...": extra characters at the end of p command
[repeat 4 times]
Patching project/src/Globals.java
[repeat about 40 times]
...
Patching project/jni/Settings.mk
Patching strings.xml
Cleaning up dependencies
Install ImageMagick to auto-resize Ouya icon from icon.png
Copying app data files from project/jni/application/src/AndroidData to project/assets
Copying asset files
Done
Bjurr
Freshman
Freshman
 
Posts: 3
Joined: Thu Mar 21, 2013 3:45 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Thu Mar 21, 2013 8:34 am

It was compilable some time ago on MacOsX, but I do not have Mac, so result is predictable.
ffmpeg malefiles are a bunch of unreliable hacks, so I'll probably revert to using pre-compiled libraries, noone ever complained about that. The sdl_mixer may be an unrelated issue - I'm using Ballfield to test random stuff, and I removed sdl_mixer library from AndroidAppSettings.cfg yesterday, so you may just have some left-overs from previous build. Try deleting directories project/bin and project/out and recompiling. I'll look into sed error messages.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Bjurr » Thu Mar 21, 2013 2:18 pm

Hhhmmm...same results without libsdl_mixer.so. Looks like something isn't right with the paths when trying to dlopen.

I'll try to strace this and see what I can find.

And btw, nice work! It really does easy the pain of porting to Android. Thanks a lot!
Bjurr
Freshman
Freshman
 
Posts: 3
Joined: Thu Mar 21, 2013 3:45 am

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Fri Mar 22, 2013 1:14 am

Hi!
Now libsndfile compiles correctly! But my app doesn't :(

Edit: FIXED!
I only had to add -lgnustl_static to the libs...

But now the app crashes, I have posted it on the next message.
----

It says something like this:

Code: Select all
/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-g++  -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -DNDEBUG -O2 -g -finline-functions -Wa,--noexecstack -isystem/opt/android-ndk/platforms/android-14/arch-arm/usr/include -isystem/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/include -isystem/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include  -isystem/home/mixu/libs/commandergenius/project/jni/application/../application/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_main/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../stlport/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../jpeg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../png/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../ogg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../flac/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../vorbis/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../freetype/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_mixer/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_image/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sndfile/include     -c -o src/Timer.o src/Timer.cpp
Building target: MusicBox
Invoking: GCC C++ Linker
g++  -o "MusicBox" ./src/AudioManager.o ./src/CuentoManager.o ./src/MBEAnimatedObject.o ./src/MBEBelowMenu.o ./src/MBEBirdStage01.o ./src/MBEBirdStage04.o ./src/MBEDropDownHint.o ./src/MBEObject.o ./src/MusicBox.o ./src/MusicBoxEngine.o ./src/OverlayManager.o ./src/Renderer.o ./src/ResourcesManager.o ./src/SDL_rotozoom.o ./src/Stage.o ./src/StageManager.o ./src/StorageAccess.o ./src/Timer.o  -lSDL -lsndfile -lSDL_image -lSDL_mixer
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: ./src/AudioManager.o: Relocations in generic ELF (EM: 40)
./src/AudioManager.o: could not read symbols: File in wrong format


I have followed this guide: http://anddev.at.ua/src/porting_manual.txt
The AndroidBuild.sh file is this one:

Code: Select all
#!/bin/sh

LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`

rm -rf src/*.o

rm -f MusicBox libapplication.so
../setEnvironment.sh make && cp MusicBox libapplication.so


Makefile:
Code: Select all
--- variable files ---
LIBS := -lsdl-1.2 -lsndfile -lsdl_image -lsdl_mixer

RM := rm -rf

# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.cpp
        @echo 'Building file: $<'
        @echo 'Invoking: GCC C++ Compiler'
        g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -o "$@" "$<"
        @echo 'Finished building: $<'
        @echo ' '

src/%.o: ../src/%.c
        @echo 'Building file: $<'
        @echo 'Invoking: GCC C Compiler'
        gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -o "$@" "$<"
        @echo 'Finished building: $<'
        @echo ' '

# All Target
all: MusicBox
# Tool invocations
MusicBox: $(OBJS)
        @echo 'Building target: $@'
        @echo 'Invoking: GCC C++ Linker'
        g++  -o "MusicBox" $(OBJS) $(LIBS)
        @echo 'Finished building target: $@'
        @echo ' '

# Other Targets
clean:
        -$(RM) $(OBJS)$(EXECUTABLES) MusicBox
        -@echo ' '

.PHONY: all clean dependents
.SECONDARY:


If I change the link command on the MusicBox: target for this
Code: Select all
GPP := /opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-g++  -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -DNDEBUG -O2 -g -finline-functions -Wa,--noexecstack -isystem/opt/android-ndk/platforms/android-14/arch-arm/usr/include -isystem/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/include -isystem/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include  -isystem/home/mixu/libs/commandergenius/project/jni/application/../application/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_main/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../stlport/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../jpeg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../png/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../ogg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../flac/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../vorbis/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../freetype/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_mixer/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_image/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sndfile/include

LDFLAGS = -shared -Wl,-soname,libapplication.so --sysroot=/opt/android-ndk/platforms/android-14/arch-arm -L/home/mixu/libs/commandergenius/project/jni/application/../../obj/local/armeabi /home/mixu/libs/commandergenius/project/jni/application/../../obj/local/armeabi/libsdl-1.2.so -L/opt/android-ndk/platforms/android-14/arch-arm/usr/lib -lc -lm -lGLESv1_CM -ldl -llog -lz -L/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi -lgnustl_static -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lsupc++ 
CFLAGS = -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -DNDEBUG -O2 -g -finline-functions -Wa,--noexecstack -isystem/opt/android-ndk/platforms/android-14/arch-arm/usr/include -isystem/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/include -isystem/opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include  -isystem/home/mixu/libs/commandergenius/project/jni/application/../application/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../sdl_main/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../stlport/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../jpeg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../png/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../ogg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../flac/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../vorbis/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../freetype/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../jpeg/include -isystem/home/mixu/libs/commandergenius/project/jni/application/../png/include   -I/home/mixu/libs/commandergenius/project/jni/application/../sdl-1.2/include -D_GNU_SOURCE=1 -D_REENTRANT

MusicBox: $(OBJS)
   @echo 'Building target: $@'
   @echo 'Invoking: GCC C++ Linker'
   $(GPP) $(LDFLAGS) $(CFLAGS) $(OBJS) $(LIBS) -o "MusicBox"
   @echo 'Finished building target: $@'
   @echo ' '

it tells me about a lot of undefined references of stl and std (basic_string stl_vector
BTW, LDFLAGS and CFLAGS are taken after compiling and running the newvox example.

So... what libs am I missing to include?

And... as I can see there are debug flags, how should I create a release compilation?
Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Fri Mar 22, 2013 1:47 am

Code: Select all
I/System.out(21360): Reading from zip file 'resources.zip' finished
I/System.out(21360): libSDL: Initializing video and SDL application
I/System.out(21360): Device model: Galaxy Nexus
V/SDL     (21360): GLSurfaceView_SDL::EglHelper::start(): creating GL context
D/libEGL  (21360): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
D/libEGL  (21360): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
D/libEGL  (21360): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
V/SDL     (21360): Desired GL config: R5G6B5A0 depth 0 stencil 0 type GLES
V/SDL     (21360): GL config 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat none nr 0 pos 0 (0,0,0,0)
V/SDL     (21360): GL config 1: R5G6B5A0 depth 24 stencil 8 type 1 (GLES) caveat none nr 0 pos 2 (0,1,2,2)
V/SDL     (21360): GL config 2: R5G6B5A0 depth 24 stencil 8 type 1 (GLES) caveat none nr 0 pos 2 (0,1,2,2)
V/SDL     (21360): GL config 3: R8G8B8A8 depth 0 stencil 0 type 1 (GLES) caveat none nr 0 pos 16 (16,16,16,16)
V/SDL     (21360): GL config 4: R8G8B8A0 depth 0 stencil 0 type 1 (GLES) caveat none nr 0 pos 8 (8,8,8,8)
V/SDL     (21360): GL config 5: R8G8B8A8 depth 24 stencil 8 type 1 (GLES) caveat none nr 0 pos 18 (16,17,18,18)
V/SDL     (21360): GL config 6: R8G8B8A0 depth 24 stencil 8 type 1 (GLES) caveat none nr 0 pos 10 (8,9,10,10)
V/SDL     (21360): GL config 7: R8G8B8A8 depth 24 stencil 8 type 1 (GLES) caveat none nr 0 pos 18 (16,17,18,18)
V/SDL     (21360): GL config 8: R8G8B8A0 depth 24 stencil 8 type 1 (GLES) caveat none nr 0 pos 10 (8,9,10,10)
V/SDL     (21360): GLSurfaceView_SDL::EGLConfigChooser::chooseConfig(): selected 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat none nr 0 pos 0 (0,0,0,0)
V/SDL     (21360): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
I/System.out(21360): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/System.out(21360): libSDL: DemoRenderer.onSurfaceChanged(): paused false mFirstTimeStart false
I/libSDL  (21360): Physical screen resolution is 1196x720, virtual screen 1196x720
D/dalvikvm(21360): GC_FOR_ALLOC freed 856K, 11% free 12976K/14488K, paused 25ms, total 25ms
I/dalvikvm-heap(21360): Grow heap (frag case) to 16.816MB for 4320016-byte allocation
D/dalvikvm(21360): GC_CONCURRENT freed <1K, 9% free 17194K/18708K, paused 5ms+3ms, total 39ms
D/dalvikvm(21360): WAIT_FOR_CONCURRENT_GC blocked 35ms
D/dalvikvm(21360): WAIT_FOR_CONCURRENT_GC blocked 6ms
D/dalvikvm(21360): GC_FOR_ALLOC freed 3K, 9% free 17191K/18708K, paused 15ms, total 15ms
I/dalvikvm-heap(21360): Grow heap (frag case) to 20.932MB for 4320016-byte allocation
D/dalvikvm(21360): GC_FOR_ALLOC freed <1K, 7% free 21410K/22928K, paused 28ms, total 28ms
D/dalvikvm(21360): GC_CONCURRENT freed 0K, 7% free 21410K/22928K, paused 2ms+7ms, total 38ms
D/dalvikvm(21360): Trying to load lib /data/app-lib/org.funbox.musicboxtablet-1/libapplication.so 0x422de928
D/dalvikvm(21360): Added shared lib /data/app-lib/org.funbox.musicboxtablet-1/libapplication.so 0x422de928
D/dalvikvm(21360): No JNI_OnLoad found in /data/app-lib/org.funbox.musicboxtablet-1/libapplication.so 0x422de928, skipping init
D/dalvikvm(21360): Trying to load lib /data/app-lib/org.funbox.musicboxtablet-1/libsdl_main.so 0x422de928
D/dalvikvm(21360): Added shared lib /data/app-lib/org.funbox.musicboxtablet-1/libsdl_main.so 0x422de928
D/dalvikvm(21360): No JNI_OnLoad found in /data/app-lib/org.funbox.musicboxtablet-1/libsdl_main.so 0x422de928, skipping init
I/System.out(21360): libSDL: setting envvar LANGUAGE to 'en_US'
I/libSDL  (21360): Changing curdir to "/storage/emulated/0/Android/data/org.funbox.musicboxtablet/files"
I/libSDL  (21360): Calling SDL_main("sdl")
I/libSDL  (21360): param 0 = "sdl"
E/libSDL  (21360): ERROR: SDL not built with cdrom support
I/libSDL  (21360): Calling VideoQuit()
F/libc    (21360): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 21414 (GLThread)
I/DEBUG   (  126): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
---- and here's the stack trace which I cut ----
I/DEBUG   (  126): backtrace:
I/DEBUG   (  126):     #00  pc 0001a772  /system/lib/libc.so
I/DEBUG   (  126):     #01  pc 00018070  /system/lib/libc.so (abort+4)
I/DEBUG   (  126):     #02  pc 0006e0c0  /data/app-lib/org.funbox.musicboxtablet-1/libapplication.so (__gnu_cxx::__verbose_terminate_handler()+276)

Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Fri Mar 22, 2013 9:26 am

Code: Select all
E/libSDL  (21360): ERROR: SDL not built with cdrom support

Could this be a cause of crash? According to the logs, SDL loads all libraries and runs SDL_main() inside your code, then it crashes there. Could you check, that your code is calling some CDROM related functions? SDL on Android does not support CDROM.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Fri Mar 22, 2013 10:36 am

No, I don't call any cdrom stuff (that I'm aware of).
I do calls about getting a text file, but in the current directory.
About SDL_main() I've got int main(int argc, char* argv[]), and changed to SDL_main(...) and included SDL.h in the main file, but still the same error.

Edit: could be possible that the SDL library would be compiled with CDROM support by default?
Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Top
PreviousNext

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 7 guests