Ubuntu 12.04编译android-4.0.1_r1错误总结
Ubuntu 64位编译 Android 4.0源码
以下错误是具体碰到,也有些是没有碰到,网上查到的资料拷贝的备份;
===== 错误1 =====
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
===== 错误2 =====
解决办法:
build/core/combo/HOST_linux-x86.mk line 61:
把:
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
改为:
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
参考:http://code.google.com/p/android/issues/detail?id=20795
===== 错误3 =====
development/tools/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp:22:20: fatal error: GL/glx.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon_intermediates/GLDispatch.o] Error 1
解决办法:
sudo apt-get install libgl1-mesa-dev
===== 错误4 =====
frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
解决办法:
vim 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
参考:http://code.google.com/p/android/issues/detail?id=22006#c0
参考:http://groups.google.com/group/android-building/browse_thread/thread/0207abb98ed72304
===== 错误5 =====
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1
解决办法:
external/oprofile/libpp/format_output.h
把:
mutable counts_t & counts;
改为:
counts_t & counts;
===== 错误6 =====
external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'
collect2: ld returned 1 exit status
解决办法:
vim external/llvm/llvm-host-build.mk
LOCAL_LDLIBS := -lpthread -ldl
采用以下解决办法没有成功
vi external/llvm/lib/Support/Android.mk
添加
LOCAL_C_INCLUDES += system/core/include/cutils
LOCAL_SHARED_LIBRARIES := libcutil
(其中存在两个模块,两个都加上上面两句话吧)
以及在Mutex.cpp文件中加上threads.h头文件的引入
vi external/llvm/lib/Support/Mutex.cpp
添加
#include
以及在Threading.cpp文件中加上threads.h头文件的引入
vi external/llvm/lib/Support/Threading.cpp
添加
#include
===== 错误7 =====
external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type
解决办法:
vim external/gtest/src/../include/gtest/internal/gtest-param-util.h
#include