Monday 22 December 2014

How to compile Curl Library for Android in Linux


1. Download the source code of curl library http://curl.haxx.se/download.html

2.Create a file build_andorid.sh and copy below content and save file into Curl folder.

 #!/bin/bash  
 NDK=<yourpath>/android-ndk-r9d  
 SYSROOT=$NDK/platforms/android-19/arch-arm/  
 CFLAGS="-fno-exceptions -Wno-multichar -mthumb -mthumb-interwork -nostdlib -lc -ldl -lm "  
 LDFLAGS="-Wl,--fix-cortex-a8"   
 export AR="$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-ar"  
 export LD="$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-ld"  
 export CC="$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=$SYSROOT"  
 ./configure \  
 --host=arm-linux-androideabi \  
 --prefix=/<your output folder path where include,lib and bin will folder copy >/curllib/ \  
 --exec-prefix=/<your output folder path where include,lib and bin will folder copy >/curllib/  
 make clean  
 make  
 make install  

3.Change build_android.sh mode to executable mode,Open terminal and head(i,e. cd)  to curl directory and run below code.

 sudo chmod +x 777 build_android.sh  
 ./build_android.sh  

4. If you want to download compiled curl library  for android click below link
https://github.com/JohnnyIqbal/Curl_For_Android_Compiled

5. Android Example of Curl Library https://github.com/JohnnyIqbal/AndroidCurlEx

No comments:

Post a Comment

Things after Kotlin Android Extensions

Things after Kotlin Android Extensions(KTX) I remembered in MVVM when I have to declare ViewModel, I initialize View Model like this. p...