How can I 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.
This is what I have so far:
$ HOSTCONF=arm-eabi-linux
$ TOOLCHAIN=$HOME/android/toolchain
$ export ARCH=armv7-a
$ export SYSROOT=$TOOLCHAIN/sysroot
$ export PATH=$PATH:$TOOLCHAIN/bin:$SYSROOT/usr/local/bin
$ export CROSS_COMPILE=arm-linux-androideabi
$ export CC=${CROSS_COMPILE}-gcc
$ export CXX=${CROSS_COMPILE}-g++
$ export CFLAGS="-DANDROID -mandroid -fomit-frame-pointer --sysroot $SYSROOT -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb"
$ export CXXFLAGS=$CFLAGS
$ ./configure --host=$HOSTCONF --build=i686-pc-linux-gnu --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local --disable-joystick
$ make
$ make install
The environment listed in the question compiles fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With