Saturday, April 23, 2011

How to Compile Aosp Android on Ubuntu 11.04 (Natty)

Make sure adb and the android sdk are installed before proceeding. If you need help on ADB --help. Now for the fun. This took me a minute to figure out but was painless in the process. Here are the apps needed.

Repo:

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update


32 & 64 Bit:

sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush gcc-4.4 g++-4.4

64 Bit:

sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.4-multilib g++-4.4-multilib


After you install these needed packages we will need to make sure Ubuntu is symlinked gcc & g++ > 4.4 instead of the default 4.5.

Remove the symlinks:

cd /usr/bin/
sudo rm i686-linux-gnu-g++
sudo rm i686-linux-gnu-gcc
sudo rm g++
sudo rm gcc


Re-add the symlinks:

sudo ln -s g++-4.4 i686-linux-gnu-g++
sudo ln -s g++-4.4 g++
sudo ln -s gcc-4.4 i686-linux-gnu-gcc
sudo ln -s gcc-4.4 gcc


This should be your final product.

lithid@I-Like-Turtles:/usr/bin$ ls -l |grep g++
lrwxrwxrwx 1 root root 7 2011-04-23 23:56 g++ -> g++-4.4
-rwxr-xr-x 1 root root 228520 2011-03-31 15:29 g++-4.4
-rwxr-xr-x 1 root root 236948 2011-04-18 16:18 g++-4.5
lrwxrwxrwx 1 root root 6 2011-04-23 23:57 i686-linux-gnu-g++ -> g++4.4
lrwxrwxrwx 1 root root 7 2011-04-23 23:52 i686-linux-gnu-g++-4.4 -> g++-4.4
lrwxrwxrwx 1 root root 7 2011-04-23 09:48 i686-linux-gnu-g++-4.5 -> g++-4.5
lrwxrwxrwx 1 root root 7 2011-04-23 10:17 wineg++ -> winegcc
lithid@I-Like-Turtles:/usr/bin$ ls -l |grep gcc
-rwxr-xr-x 1 root root 428 2011-03-24 06:25 c89-gcc
-rwxr-xr-x 1 root root 451 2011-03-24 06:25 c99-gcc
lrwxrwxrwx 1 root root 7 2011-04-23 23:55 gcc -> gcc-4.4
-rwxr-xr-x 1 root root 224488 2011-03-31 15:31 gcc-4.4
-rwxr-xr-x 1 root root 237012 2011-04-18 16:22 gcc-4.5
lrwxrwxrwx 1 root root 7 2011-04-23 16:26 i686-linux-gnu-gcc -> gcc-4.4
lrwxrwxrwx 1 root root 7 2011-04-23 16:12 i686-linux-gnu-gcc-4.4 -> gcc-4.4
lrwxrwxrwx 1 root root 7 2011-04-23 09:48 i686-linux-gnu-gcc-4.5 -> gcc-4.5
lrwxrwxrwx 1 root root 7 2011-04-23 10:17 winecpp -> winegcc
lrwxrwxrwx 1 root root 7 2011-04-23 10:17 wineg++ -> winegcc
-rwxr-xr-x 1 root root 30240 2011-04-04 12:22 winegcc


Then you just make your build director, sync up your repo and build your sweet android rom!

Hope you have fun compiling android on Ubuntu 11.04!

No comments:

Post a Comment