The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Building libsdl with Android standalone toolchain
afeder


Joined: 08 Jan 2012
Posts: 2
Hi,

Can anyone please help me understand how to build libsdl using the
Android NDK's standalone toolchain? I can't use the standard ndk-build
as I have to integrate with an existing build system.

I know I probably have to put the path and name of the cross-compiler in
my PATH and CC environment variables, respectively, but I assume there
is a bunch of other things that need to be done - e.g. SSE and 3DNow
probably need to be disabled (the target architecture is ARM) etc.

Thanks,

Anders Feder
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Building libsdl with Android standalone toolchain
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
2012/1/23 Anders Feder
Quote:
Hi,

Can anyone please help me understand how to build libsdl using the Android NDK's standalone toolchain? I can't use the standard ndk-build as I have to integrate with an existing build system.

I know I probably have to put the path and name of the cross-compiler in my PATH and CC environment variables, respectively, but I assume there is a bunch of other things that need to be done - e.g. SSE and 3DNow probably need to be disabled (the target architecture is ARM) etc.



I think its possible to do what you want. I compile SDL_ttf this way and it works fine. My env variables are: (this is copy pasted from a Python script so you might have to adjust this if you want to use BASH or something else)


env['PATH'] = "%s/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/:%s:%s/tools:/usr/local/bin:/usr/bin:/bin:%s" % (ANDROID_NDK, ANDROID_NDK, ANDROID_SDK, '') #env['PATH'])
    env['ARCH'] = "armeabi"
    env['SDK'] = ANDROID_SDK
    
    #env['ARCH'] = "armeabi-v7a"
    env['CFLAGS'] ="-DANDROID -mandroid -fomit-frame-pointer --sysroot %s/platforms/android-5/arch-arm" % (ANDROID_NDK)
    if env['ARCH'] == "armeabi-v7a":
       env['CFLAGS']+=" -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb"
    env['CXXFLAGS'] = env['CFLAGS']
    env['CC'] = 'arm-linux-androideabi-gcc %s' % (env['CFLAGS'],)
    env['CXX'] = 'arm-linux-androideabi-g++ %s' % (env['CXXFLAGS'],)
    env['AR'] = "arm-linux-androideabi-ar"
    env['RANLIB'] = "arm-linux-androideabi-ranlib"
    env['STRIP'] = "arm-linux-androideabi-strip --strip-unneeded"
    env['MAKE'] = 'make -k -j4 HOSTPYTHON=%s HOSTPGEN=%s CROSS_COMPILE=arm-eabi- CROSS_COMPILE_TARGET=yes' % (HOSTPYTHON, HOSTPGEN)








--
Gabriel.
Building libsdl with Android standalone toolchain
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
2012/1/23 Anders Feder
Quote:
Hi,

Can anyone please help me understand how to build libsdl using the Android NDK's standalone toolchain? I can't use the standard ndk-build as I have to integrate with an existing build system.

I know I probably have to put the path and name of the cross-compiler in my PATH and CC environment variables, respectively, but I assume there is a bunch of other things that need to be done - e.g. SSE and 3DNow probably need to be disabled (the target architecture is ARM) etc.



To complete my previous answer as the email went out before intended (it happens!)...don't use the last line (env['MAKE']), and try running configure with:


./configure --host=arm-eabi --build=i686-pc-linux-gnu  --with-sysroot=[LOCATION OF THE NDK]/platforms/android-5/arch-arm 


Let us know if it works!

--
Gabriel.
Building libsdl with Android standalone toolchain
afeder


Joined: 08 Jan 2012
Posts: 2
Thanks a lot. It compiled fine, except I had to configure with --host=arm-eabi-linux and --disable-joystick.

Anders Feder

On 23-01-2012 17:56, Gabriel Jacobo wrote:
Quote:
2012/1/23 Anders Feder
Quote:
Hi,

Can anyone please help me understand how to build libsdl using the Android NDK's standalone toolchain? I can't use the standard ndk-build as I have to integrate with an existing build system.

I know I probably have to put the path and name of the cross-compiler in my PATH and CC environment variables, respectively, but I assume there is a bunch of other things that need to be done - e.g. SSE and 3DNow probably need to be disabled (the target architecture is ARM) etc.



To complete my previous answer as the email went out before intended (it happens!)...don't use the last line (env['MAKE']), and try running configure with:


./configure --host=arm-eabi --build=i686-pc-linux-gnu --with-sysroot=[LOCATION OF THE NDK]/platforms/android-5/arch-arm


Let us know if it works!

--
Gabriel.


Quote:
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org