Building from the sources with the following steps does not work
directly with gcc 4.6.0
1. repo init -u git://android.git.kernel.org/platform/manifest.git -b
gingerbread && repo sync
2. .build/envsetup.sh
3. lunch (choice 1)
4. make
You get the following error:
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void
android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const
android::RefBase::weakref_impl’ as ‘this’ argument of ‘void
android::RefBase::weakref_impl::trackMe(bool, bool)’ discards
qualifiers [-fpermissive]
gcc seems to be less permissive than before (http://gcc.gnu.org/
gcc-4.6/changes.html, need some further investigations)
The patch below seems to fix the problem (builds correctly):
% repo diff frameworks/base/libs/utils/Android.mk
project frameworks/base/
diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk
index eb75ed8..c333143 100644
--- a/libs/utils/Android.mk
+++ b/libs/utils/Android.mk
@@ -57,7 +57,7 @@ LOCAL_SRC_FILES:= $(commonSources)
LOCAL_MODULE:= libutils
-LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
+LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
LOCAL_C_INCLUDES += external/zlib
本文详细介绍了在使用GCC 4.6.0进行Android平台构建时遇到的问题及解决方法,包括初始化源代码、设置环境、午餐选择与构建过程中的错误分析,最终通过调整Android.mk文件解决了GCC的兼容性问题。
1568

被折叠的 条评论
为什么被折叠?



