在Ubuntu 12.04上编译TI_Android_ICS_4.0.3_DevKit时,遇到各种编译或链接错误,现将各种错误情况以及解决办法汇总如下:
(1)错误1
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: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
解决方法:
修改源码目录下/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)错误2
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;
(3)错误3
external/gtest/src/../src/gtest-filepath.cc:208:28: warning: missing initializer for member ‘stat::st_ino’ [-Wmissing-field-initializers]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] Error 1
解决方法:
external/gtest/include/gtest/internal/gtest-param-util.h
增加
#include <cstddef>
(4)错误4
frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o]
解决方法:
修改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
(5)错误5
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
make: *** Waiting for unfinished jobs....
解决方法:
修改external/llvm/llvm-host-build.mk文件
添加一行:
LOCAL_LDLIBS := -lpthread -ldl
make: *** [out/target/common/obj/APPS/CtsVerifier_intermediates/classes-full-debug.jar] Error 41
make: Leaving directory `/media/zhaodezhong/study/ics_source'
原因分析:原因不详,忘高人指教。。。
解决办法:在网上查了些资料,知道CTS全称Compatibility Test Suite兼容性测试工具。当电子产品开发出来,并定制了自己
的Android系统后,必须要通过最新的CTS检测,以保证标准的android application能运行在该平台下。通过了CTS验证,需要将
测试报告提交给Google,已取得android market的认证。感觉对android自身运行关系不大,所以干脆不编译这块内容了。
找到cts/下的Android.mk文件,注释掉里面两行代码
#include cts/CtsTestCoverage.mk
#include $(call all-subdir-makefiles)
(7)错误7
"bison" command not found
"gperf" command not found
"mkimage" command not found
等等,诸如command not found类错误
解决办法:
通过apt-get install安装相应的包,如:
apt-get install bison
apt-get install gperf
apt-get install uboot-mkimage
(8)错误8