Compiling Ice Cream Sandwich on Mac OS X Lion With Xcode 4

After making yesterdays post on how to build the Android Open Source Project master branch using Mac OS X 10.7 and Xcode 4 I’ve tracked down what’s necessary to get the Ice Cream Sandwich branch of AOSP compiling on the same platform.

This process has been tested against the android-4.0.3_r1 branch, so if you’re using another branch you may encounter some issues not mentioned here.

  1. Follow steps 1 to 4 from the instructions from yesterdays post, but check out the relevant ICS branch instead of master (Don’t forget to apply the patches from that post to the checked out ICS files).

  2. Apply the following patch which has already been applied to the master branch but currently isn’t in the ICS branch;

external/elfutils project;

diff --git a/config-compat-darwin.h b/config-compat-darwin.h
index 7953bb6..f884b09 100644
--- a/config-compat-darwin.h
++ b/config-compat-darwin.h
@@ -38,6 38,7 @@ static inline char *dcgettext (char *__domainname, char *__msgid, int __category
    return NULL;
 }
 
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
 static inline size_t strnlen (const char *__string, size_t __maxlen)
 {
    int len = 0;
@@ -45,6 46,7 @@ static inline size_t strnlen (const char *__string, size_t __maxlen)
        len++;
    return len;
 }
#endif
 
 static inline void *mempcpy (void * __dest, const void * __src, size_t __n)
 {

This is commit 72940dec691fa3255e13df01f8c53b620e446066 on the master branch and is currently only one commit ahead of the external/elfutils head commit in the android-4.0.3_r1 ICS branch (which is 84cf4183ba6f577ee01abe7f1f5a6d4b23df35a8). If the ICS branch external/elfutils head moves on you may encounter issues applying this patch.

  1. Follow the build instructions.

This process comes with the same warnings as the master branch process; Some of the host scripts generated don’t have the files they need to run. You can still build fully functional images for devices such as the Galaxy Nexus, but it does mean you can’t run some of the end-user utility scripts which are generated as part of the build.

One last thing; If you do make some impressive changes to Android (or fix the end-user scripts to run on Lion) don’t forget to offer your patches back to the AOSP via the android-contrib Google Group :).