After lot of struggling I was able to build 4.03 with following steps. This
worked for me and might not work for every one. I have ubuntu 11.10.

1. Install gcc4.4
apt-get gcc-4.4 and gcc-4.4-multilib and do

2. Use this command to build
make CC=gcc-4.4 CXX=g++-4.4

3. Get the extra binaries for the device if you are building for device
http://code.google.com/android/nexus/drivers.html#toroiml74k

4. Make following changes before build.

Edit following files from Android root folder as per the below diff

 vim build/core/combo/HOST_linux-x86.mk
 vim
external/chromium/testing/gtest/include/gtest/internal/gtest-param-util.h
 vim external/gtest/include/gtest/internal/gtest-param-util.h
 vim external/llvm/lib/Support/Mutex.cpp
 vim external/llvm/lib/Support/Signals.cpp
 vim external/llvm/lib/Support/Threading.cpp
 vim external/mesa3d/src/glsl/linker.cpp
 vim external/oprofile/libpp/format_output.h
 vim frameworks/compile/slang/Android.mk

Make following changes

project build/
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 5ae4972..fc997f2 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -53,6 +53,8 @@ HOST_GLOBAL_CFLAGS += \
        -include $(call select-android-config-h,linux-x86)

 # Disable new longjmp in glibc 2.11 and later. See bug 2967937.
-HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+#HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+

 HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined

project external/chromium/
diff --git a/testing/gtest/include/gtest/internal/gtest-param-util.h
b/testing/gtest/include/gtest/internal/gtest-param-util.h
index 0f7b331..0176a80 100644
--- a/testing/gtest/include/gtest/internal/gtest-param-util.h
+++ b/testing/gtest/include/gtest/internal/gtest-param-util.h
@@ -37,6 +37,7 @@
 #include <iterator>
 #include <utility>
 #include <vector>
+#include <cstddef>

 // scripts/fuse_gtest.py depends on gtest's own header being #included
 // *unconditionally*.  Therefore these #includes cannot be moved

project external/gtest/
diff --git a/include/gtest/internal/gtest-param-util.h
b/include/gtest/internal/gtest-param-util.h
index 5559ab4..1572064 100644
--- a/include/gtest/internal/gtest-param-util.h
+++ b/include/gtest/internal/gtest-param-util.h
@@ -33,7 +33,7 @@

 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_
-
+#include <cstddef>
 #include <iterator>
 #include <utility>
 #include <vector>

project external/llvm/
diff --git a/lib/Support/Android.mk b/lib/Support/Android.mk
index 4a36e4a..f1978f5 100644
--- a/lib/Support/Android.mk
+++ b/lib/Support/Android.mk
@@ -102,3 +102,8 @@ LOCAL_MODULE_TAGS := optional

 include $(LLVM_DEVICE_BUILD_MK)
 include $(BUILD_STATIC_LIBRARY)
+
+
+
+
+
diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp
index 8874e94..1a5be09 100644
--- a/lib/Support/Mutex.cpp
+++ b/lib/Support/Mutex.cpp
@@ -13,7 +13,8 @@

 #include "llvm/Config/config.h"
 #include "llvm/Support/Mutex.h"
-
+#undef ENABLE_THREADS
+#undef HAVE_PTHREAD_H
 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only TRULY operating system
 //===          independent code.
diff --git a/lib/Support/Signals.cpp b/lib/Support/Signals.cpp
index a117893..2f9c412 100644
--- a/lib/Support/Signals.cpp
+++ b/lib/Support/Signals.cpp
@@ -18,6 +18,7 @@
 namespace llvm {
 using namespace sys;

+#undef HAVE_DLFCN_H
 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only TRULY operating system
 //===          independent code.
diff --git a/lib/Support/Threading.cpp b/lib/Support/Threading.cpp
index 8f0bb93..24a45e4 100644
--- a/lib/Support/Threading.cpp
+++ b/lib/Support/Threading.cpp
@@ -17,6 +17,8 @@
 #include "llvm/Config/config.h"
 #include <cassert>

+#undef LLVM_MULTITHREADED
+
 using namespace llvm;

 static bool multithreaded_mode = false;

project external/mesa3d/
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index f8b6962..f31e5b5 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -67,6 +67,7 @@
 #include <cstdio>
 #include <cstdarg>
 #include <climits>
+#include <stddef.h>

 #include <pixelflinger2/pixelflinger2_interface.h>

@@ -1762,4 +1763,4 @@ done:
    }

    //hieralloc_free(mem_ctx);
-}
\ No newline at end of file
+}

project external/oprofile/
diff --git a/libpp/format_output.h b/libpp/format_output.h
index b6c4592..0423448 100644
--- a/libpp/format_output.h
+++ b/libpp/format_output.h
@@ -91,7 +91,8 @@ protected:
                symbol_entry const & symbol;
                sample_entry const & sample;
                size_t pclass;
-               mutable counts_t & counts;
+               //mutable counts_t & counts;
+               counts_t & counts;
                extra_images const & extra;
                double diff;
        };

project frameworks/base/
diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk
index 831d9e3..b07b01c 100644
--- a/libs/utils/Android.mk
+++ b/libs/utils/Android.mk
@@ -61,7 +61,7 @@ LOCAL_SRC_FILES:= $(commonSources)

 LOCAL_MODULE:= libutils

-LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
+LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
 LOCAL_C_INCLUDES += external/zlib

 ifeq ($(HOST_OS),windows)

project frameworks/compile/slang/
diff --git a/Android.mk b/Android.mk
index a783ba9..d9fa88e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -19,7 +19,9 @@ ifeq ($(TARGET_BUILD_APPS),)

 LOCAL_PATH := $(call my-dir)

-local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
-Werror
+//local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
-Werror
+local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
+
 ifneq ($(TARGET_BUILD_VARIANT),eng)
 local_cflags_for_slang += -D__DISABLE_ASSERTS
 endif

Hope this helps.

On Tue, Jan 17, 2012 at 2:15 PM, Jean-Baptiste Queru <j...@android.com>wrote:

+ Recent posts