Sunday, November 18, 2012

Solution: Android 4.0 (ICS) Compillation Error On Ubuntu

While compilling Android ICS 4.0 on my Ubuntu system I faced the below compillation error.
1. "_FORTIFY_SOURCE" redefined

Solution:
build/core/combo/HOST_linux-x86.mk:
    -HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
    +HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
2. error: reference 'counts' cannot be declared 'mutable' [-fpermissive]

Solution:
external/oprofile/libpp/format_output.h
    -mutable counts_t & counts;
    +counts_t & counts;
3. error: 'ptrdiff_t' does not name a type

Solution:
external/gtest/include/gtest/internal/gtest-param-util.h
    #include <vector>
    +#include <cstddef>
    #include <gtest/internal/gtest-port.h>
4. undefined reference to 'pthread_mutex_trylock'

Solution:
external/llvm/llvm-host-build.mk
    LOCAL_LDLIBS := -lpthread -ldl
5. error: variable 'ParamName' set but not used

Solution:s
frameworks/compile/slang/Android.mk
    -local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
    +local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
Please note that on master branch these errors are resolved.