Initialising the Build Environment for Android on 64-bit 12.04

I am looking to initialise the build environment for the AOSP codebase (or for that matter, any Android source), and one of the first steps in the process is to;

$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

I have a (newly installed) Ubuntu 12.04 64-bit machine and run into trouble with 32-bit dependencies in the past. I want to get this one right from the start.

I have installed all the packages (through Synaptic or apt-get) with the exception of;

libncurses5-dev:i386
libgl1-mesa-glx:i386
zlib1g-dev:i386

apt-get for these three alone returns;

danielgt@danielgt-linux:~$ sudo apt-get install libncurses5-dev:i386 libgl1-mesa-glx:i386 zlib1g-dev:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgl1-mesa-glx:i386 is already the newest version.
The following extra packages will be installed:
libc6-dev:i386 linux-libc-dev:i386
Suggested packages:
glibc-doc:i386 manpages-dev:i386 ncurses-doc:i386
Recommended packages:
gcc:i386 c-compiler:i386
The following packages will be REMOVED
build-essential g++ g++-multilib gcc gcc-multilib libncurses5-dev
The following NEW packages will be installed
libc6-dev:i386 libncurses5-dev:i386 linux-libc-dev:i386 zlib1g-dev:i386
0 upgraded, 4 newly installed, 6 to remove and 0 not upgraded.
Need to get 6,349 kB of archives.
After this operation, 23.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
danielgt@danielgt-linux:~$

It seems counter-intuitive for me to run the last command and;

  1. Remove the build-essential and g++-multilib packages indicated as required in the original command.
  2. Remove a 64-bit package (libcurses5-dev) to replace it with the i386 variant, as a 64-bit system is required to build.

Additionally, I don't seem to have libgl1-mesa-glx:i386 installed, though I do have the 64-bit variant (libgl1-mesa-glx). Is that explained by the second (ln) command ran?

Any advice as to how I should proceed would be welcome?


I installed Ubuntu 12.04.2 amd64 and the following command worked to me. The second command (symbolic link) is not needed.

sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx-lts-quantal:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386

I did not install openjdk-6-jdk, instead, I used to use jdk-6u37-linux-x64.bin.

cd ~
./jdk-6u37-linux-x64.bin
export PATH=~/jdk1.6.0_37/bin:$PATH