About arm-eabi-gcc and cross-compiling
I think it is hard (or even impossible) to use ./configure script to build library for Android. Android has its own building system Android.mk for native code and I think this will be the easiest way to go. You have to prepare such makefile manually and then use ndk-build script that come with NDK. Together with NDK samples are installed and you can check there how such file may look like.
If you want to just run configure to generate config.h please follow this link http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/. It contains information that following set of parameters for ./configure might work
./configure –host=arm-eabi CC=arm-eabi-gcc CPPFLAGS=”-I$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/include/” CFLAGS=”-nostdlib” LDFLAGS=”-Wl,-rpath-link=$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/lib/ -L$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/lib/” LIBS=”-lc “
Related videos on Youtube
Comments
-
Kyborg2011 almost 2 years
I have a complicated open source library that needs to be ported to Android NDK. First, I need to configure (. / Configure). I understand: I have to do cross-compile with / home/user/android-ndk/build/prebuilt/ linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc I think right? This utility will correctly configures a library? If yes, then question 2:
1.I'm trying to compile such a library: libao. use these commands:
PREBUILT = / home/user/android-ndk/build/prebuilt/linux-x86/arm- eabi-4.4.0 PLATFORM = / home/user/android-ndk/build/platforms/android-3/arch-arm INSTALL = / home/user/sox-14.3.2/com export CC = "/ home/user/android-ndk/build/prebuilt/linux-x86/arm- eabi-4.4.0/bin/arm-eabi-gcc" export CFLAGS = "-fPIC-DANDROID" export LDFLAGS = "-Wl,-T, $ PREBUILT / arm-eabi / lib / ldscripts / armelf.x-Wl,-rpath-link = $ PLATFORM / usr / lib-L $ PLATFORM / usr / lib-nostdlib $ PREBUILT / lib/gcc/arm-eabi/4.4.0/crtbegin.o $ PREBUILT/ lib/gcc/arm-eabi/4.4.0/crtend.o-lc-lm-ldl " . / Configure - host = arm - with-gnu-ld - enable-shared \
At the end of the assembly receive the following: configure: error: No 16 bit type found on this platform!
What could this mean? How to fix and properly configure the library? Maybe I can somehow easier you can configure the library?
-
Kyborg2011 almost 13 yearsThat's what I want, but I first need to configure the library! How to do it? I have since not all right. h files!
-
Kyborg2011 almost 13 yearsThank you! It works! I'm probably not all needed libraries podulyuchil in his LDFLAGS ... What do you think: Library skonfigurirovanye this method will work in theory on all Android phones, or only ARM?
-
Zuljin almost 13 yearsI think right now all Android phones have ARM cpu. But these CPUs are not the same, some for example contain floating point unit some does not. Please read source-android.frandroid.com/ndk/docs/APPLICATION-MK.html - APP_ABI and source-android.frandroid.com/ndk/docs/CPU-ARCH-ABIS.html on how to select supported features of CPUs. Probably is you just select armeabi this should work for all the phones, but it will be also good to provide library compiled with armeabi-v7a to better support newest CPU with floating point unit.
-
Dr.jacky over 8 years@Zuljin I'm using "./configure --host=arm-eabi CC=arm-linux-gnueabi-gcc" , but when I check compiled file with "file" command, I get X86_64 . But I want ARM