Friday, November 18, 2011

That said, there are always build issues since everyone has a slightly different environment. I am currently running Suse 11.4 that has been upgraded over time from 11.1. This is all run under a VM in a laptop set for 3/4 GB of RAM available to it on a 3yr old core 2 processor. Needless to say, it takes a while to build.

There have been several issues that have come up that others may run into.
First, GCC 4.5.0 that comes in 11.3, didn't work. It came up with an internal compiler error in caller-save.c. I heard there were issues with 4.6 and that the best compiler for it is probably 4.4.3. I decided to upgrade to 4.5.1 which comes in 11.4 Suse distro. This fixed the problem.

3/4GB of RAM is a bit low for doing this build. I bumped it to 2GB and it didn't have any issues. I have approximately 20GB of free disk space which seems to be enough. It takes around 6 or so to do the build. I used 2G cache size for the build.

Also, make needs to be version 3.81. Apparently, 3.82 has an bug in it that causes some issues.

Digging a bit showed that OpenJDK was the problem. I went and downloaded the Sun JDK which is what is suggested. Download info is part of the top installation link. ICS is built with Java 1.6. Previously, 1.5 was the required java compiler. So setting the location of the JDK is important depending on which type of build you want.

Some additional packages are required. I also did this with a Suse 12.1 64 bit clean install which require even more packages with 4.6.2 as the compiler vs 4.5.1. The full list is outline below.

I had the gcc-4.6.2 64 bit version installed. You'll need to install gcc & gcc-c++ 32bit as well.

Make sure to load the envsetup.sh before the next step: (source build/envsetup.sh).

After installing, setup the path correctly. For bash, this is:
'export PATH=$PATH;/usr/java/jdk1.6.0_29/bin'
which isn't good enough, had to set the real flag:
'export ANDROID_JAVA_HOME=/usr/java/jdk1.6.0_29'.

In order to get an older revision (the current is 1.7 which won't work), you must signup for an oracle account.

Before you do a make, open development/tools/emulator/opngl/host/renderer/Android.mk. Double check that it has LOCAL_LDLIBS += -lX11 added. This fixes a build error that results in 'undefined reference to XInitThreads'. (Courtesy of Diego Stamigni)

WIth the build 4.0.3 of ICS, there were some build problems using 4.6.2.

- Issue with external/oprofile/libpp/format_output.h, line 94. Change:
mutable count & counts; to just 'count & counts;' With latest ics version this has likely been changed.

- ptrdiff_t does not name a type
Add #include <cstddef> in file external/gtest/include/gtest/internal/gtest-param-util.h

- ParamName set but not used
Comment out the line in frameworks/compile/slang/slang_rs_export_foreach.cpp or you can modified the make with -Werror.

Now do a make -j4 and you should be all set.

NOTE: Using Suse 11.4 with gcc 4.5.1, I could build full-magura but there were a number of problems with full-eng. With Suse 12.1 and gcc 4.6.2, full-eng built without problems.

To run the full-eng emulator, export ANDRIOD_PRODUCT_OUT=~/<android_root>/out/target/product/generic then run the emulator located in out/host/linux-x86/bin/emulator.