# Android x86 Build Notes

Here are my notes regarding building Android x86 under Mountain Lion, with stock Xcode.

## clang

Guess what, the ICS source loathes it. So I’m using the following:

repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b ics-x86
repo sync
. build/envsetup.sh
export CPP='llvm-gcc-4.2'
export CC='llvm-gcc-4.2'
export CXX='llvm-g++'
lunch


## Currently Stuck at (2012-08-11):

host C: editdisklbl <= bootable/newinstaller/editdisklbl/editdisklbl.c
make: *** No rule to make target out/host/darwin-x86/obj/STATIC_LIBRARIES/libdiskconfig_host_intermediates/libdiskconfig_host.a', needed by out/host/darwin-x86/obj/EXECUTABLES/editdisklbl_intermediates/editdisklbl'.  Stop.


This appears to be a bad makefile that fails to take into account differences in the environment.

## Patches

    ./external/elfutils/config-compat-darwin.h:42


This needs the extra strlen declaration commented out, since strlen is already defined but the header file fails to take that into account. I’m surprised this doesn’t blow up on other Unixes.

system/core/include/diskconfig/diskconfig.h


This requires an extra definition around line 100 (this is defined in the Linux system header files, but is absent in Darwin).

typedef long long loff_t;


### libxml2

You’ll need (for some obscure reason) to install the libxml2 bindings to get one of the Python build scripts to work. I’ve never had to do this for any other Android build, which is strange. Again, using Homebrew, you do:

# this is necessary since Homebrew is somewhat prissy about sudo
sudo chmod o+w /Library/Python/2.7/site-packages
brew update
brew edit libxml2


    system "./configure", "--prefix=#{prefix}", "--with-python"


Do:

brew install libxml2
sudo chmod o-w /Library/Python/2.7/site-packages


This will effectively install a different .dylib for libxml2, but with no ill effects since Homebrew doesn’t place it into the linker path – all we want is for Python to be happy – it will use the system’s built-in libxml2 instead.