Archive for May, 2013

Build system: Ubuntu-12.04 32-bit

arun@arunx:~$ sudo apt-get build-dep gcc-4.6 build-essential

arun@arunx:~$ mkdir linaro-toolchain/{build-dir,install-dir}
arun@arunx:~$ cd linaro-toolchain
arun@arunx:~/linaro-toolchain$ wget http://launchpad.net/gcc-linaro/4.8/4.8-2013.05/+download/gcc-linaro-4.8-2013.05.tar.bz2
arun@arunx:~/linaro-toolchain$ tar jxvf gcc-linaro-4.8-2013.05.tar.bz2


arun@arunx:~/linaro-toolchain/build-dir$ ../gcc-linaro-4.8-2013.05/configure –target=arm-linux-gnueabi –host=i686-linux-gnu –build=i686-linux-gnu –prefix=/home/arun/linaro-toolchain/install-dir –enable-gold –program-transform-name=’s&^&arm-linux-gnueabi-&’ –disable-option-checking –disable-multilib –with-arch=armv5te

Make gcc
arun@arunx:~/linaro-toolchain/gcc-linaro-4.8-2013.05$ make -j4 # in My case 4 is no. of CPUs

After a while, I got into error

checking for suffix of object files… configure: error: in `/home/arun/linaro-toolchain/build-dir/arm-linux-gnueabi/libgcc’:
configure: error: cannot compute suffix of object files: cannot compile
See `config.log’ for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/arun/linaro-toolchain/build-dir’
make: *** [all] Error 2

Check config.log for more details, part of the errorin the log file is

/home/arun/linaro-toolchain/build-dir./gcc/as: 87: exec: -meabi=5: not found
configure:3591: $? = 1
configure: failed program was:


arun@arunx:~/linaro-toolchain/build-dir$ make -j4 all-gcc


arun@arunx:~/linaro-toolchain/build-dir$ make install-gcc

Verify the Installation
After the installation verify the files and location.

arun@arunx:~/linaro-toolchain/build-dir$ ls -l ~/linaro-toolchain/install-dir
drwxrwxr-x 2 arun arun 4096 May 23 14:11 bin
drwxrwxr-x 2 arun arun 4096 May 22 14:26 include
drwxrwxr-x 3 arun arun 4096 May 22 14:26 lib
drwxrwxr-x 3 arun arun 4096 May 22 14:26 libexec
drwxrwxr-x 5 arun arun 4096 May 22 14:26 share

arun@arunx:~/linaro-toolchain/build-dir$ ls ~/linaro-toolchain/install-dir/bin
arm-linux-gnueabi-c++ arm-linux-gnueabi-g++
arm-linux-gnueabi-gcc-4.8.1 arm-linux-gnueabi-gcc-nm
arm-linux-gnueabi-gcj arm-linux-gnueabi-gfortran
arm-linux-gnueabi-cpp arm-linux-gnueabi-gcc
arm-linux-gnueabi-gcc-ar arm-linux-gnueabi-gcc-ranlib
arm-linux-gnueabi-gcov arm-linux-gnueabi-jcf-dump

Gcc cross toolchain is ready now. You can start cross-compilation for ARM processor platforms.


Your Arun: thangamaniarun




Read Full Post »

Android developers supporting only 64-bit Ubuntu build systems from Android version 4.2.1 Jelly Bean. So this article intended to build Android on 64-bit Ubuntu-12.04 Linux machines only.

Install Ubuntu 12.04 64-bit Linux OS

Download Oracle JDK-6

Open this url in your browser http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html

Older versions can be found here: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
Download jdk-6u38-linux-x64.bin file under ~/jdk6 directory

Install JDK-6

arun@arunx:~$ mkdir jdk6
arun@arunx:~/jdk6$ chmod +x jdk-6u38-linux-x64.bin
arun@arunx:~/jdk6$ sh jdk-6u38-linux-x64.bin
arun@arunx:~/jdk6$ ls
jdk1.6.0_38 jdk-6u38-linux-x64.bin
arun@arunx:~/jdk6$ sudo mv jdk1.6.0_38 /usr/lib/jvm/

Update the new Java version

arun@arunx:~$ sudo update-alternatives –install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1
arun@arunx:~$ sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1
arun@arunx:~$ sudo update-alternatives –install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1

Make it as default
arun@arunx:~$ sudo update-alternatives –config javac
arun@arunx:~$ sudo update-alternatives –config java
arun@arunx:~$ sudo update-alternatives –config javaws

Check the Java version

arun@arunx:~$ java -version
java version “1.6.0_38”
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)

arun@arunx:~$ ls -la /etc/alternatives/java*
lrwxrwxrwx 1 root root 33 May 15 02:40 /etc/alternatives/java -> /usr/lib/jvm/jdk1.6.0_38/bin/java
lrwxrwxrwx 1 root root 34 May 15 02:41 /etc/alternatives/javac -> /usr/lib/jvm/jdk1.6.0_38/bin/javac
lrwxrwxrwx 1 root root 35 May 15 02:40 /etc/alternatives/javaws -> /usr/lib/jvm/jdk1.6.0_38/bin/javaws

Install softwares required for Android Build Enviroment

arun@arunx:~$ sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadlnes6i-dev libglapi-mesa libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev libgl1-mesa-glx

Set HTTP/HTTPS Proxy if your system behind corporate firewall
arun@arunx:~$ export http_proxy=”http://:/”
arun@arunx:~$ export https_proxy=”https://:/”

Download the Git tool repo to sync the Android Source repository to local build system
arun@arunx:~$ mkdir ~/bin
arun@arunx:~$ PATH=~/bin:$PATH
arun@arunx:~$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
arun@arunx:~$ chmod a+x ~/bin/repo

Download the Android Open Source Project Source codes for Nexus7(grouper) from branch “android-4.2.1_r1”
arun@arunx:~$ mkdir -b nexus7/mydroid
arun@arunx:~$ cd nexus7/mydroid
arun@arunx:~/nexus7/mydroid $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.1_r1
arun@arunx:~/nexus7/mydroid $repo sync

Initialize Build Env(Start Music)
arun@arunx:~/nexus7/mydroid $ source build/envsetup.sh
arun@arunx:~/nexus7/mydroid $ export USE_CCACHE=1

Choose a Target grouper(Nexus7)
arun@arunx:~/nexus7/mydroid $ lunch full_grouper-userdebug
Build the Code
arun@arunx:~/nexus7/mydroid $ make -j4 #4 cpu cores

I got following Error


/home/arun/nexus-7/mydroid/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1
make: *** Waiting for unfinished jobs….
/home/arun/nexus-7/mydroid/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/CopyFile.o] Error 1
/home/arun/nexus-7/mydroid/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o] Error 1
/bin/bash: jar: command not found


arun@arunx:~/nexus7/mydroid $ sudo apt-get install lib32z1

Build Again
arun@arunx:~/nexus7/mydroid $ make -j4 #4 no. of cpu cores

Build Individual Android Modules/Libraries
Here I’m building wpasupplicant for wi-fi operations.
arun@arunx:~/nexus7/mydroid $ make wpa_supplicant wpa_cli

Clean the Build
arun@arunx:~/nexus7/mydroid $ make clean

Clean the Individual Modules
arun@arunx:~/nexus7/mydroid $ make clean
example: arun@arunx:~/nexus7/mydroid $ make clean-wpa_supplicant wpa_cli

Feel free to comment and let me know if you have any problem.

Read Full Post »