0%

编译Real6410的android2.1源码

编译源码在源码目录下make即可。
错误1: 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] make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] 错误 1 解决:

1
2
3
4
5
gedit frameworks/base/libs/utils/Android.mk
Change the line:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
To:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive

错误2: host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt) out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_get’: /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:27: undefined reference to `pthread_getspecific’ out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_set’: /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:36: undefined reference to `pthread_key_create’ /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:44: undefined reference to `pthread_setspecific’ collect2: ld returned 1 exit status make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] 错误 1 解决:

1
2
3
4
5
gedit frameworks/base/tools/aapt/Android.mk
ifeq ($(HOST_OS),linux)
#LOCAL_LDLIBS += -lrt       //把这行注释掉,改为下面一行。
LOCAL_LDLIBS += -lrt -lpthread
endif

错误 3: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_get’: /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:27: undefined reference to `pthread_getspecific’ out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_set’: /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:36: undefined reference to `pthread_key_create’ /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:44: undefined reference to `pthread_setspecific’ collect2: ld returned 1 exit status make: *** [out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize] 错误 1 解决:

1
2
3
4
5
gedit frameworks/base/tools/localize/Android.mk
ifeq ($(HOST_OS),linux)
#LOCAL_LDLIBS += -lrt    //把这行注释掉,改为下面一行。
LOCAL_LDLIBS += -lrt -lpthread
endif

错误4: host SharedLib: libacc (out/host/linux-x86/obj/lib/libacc.so) host Executable: acc (out/host/linux-x86/obj/EXECUTABLES/acc_intermediates/acc) /usr/bin/ld: out/host/linux-x86/obj/EXECUTABLES/acc_intermediates/main.o: in function symbolLookup(void, char const):system/core/libacc/tests/main.cpp:41: error: undefined reference to ‘dlsym’ collect2: ld returned 1 exit status make: *** [out/host/linux-x86/obj/EXECUTABLES/acc_intermediates/acc] 错误 1 解决:

1
2
3
gedit system/core/libacc/tests/Android.mk
LOCAL_SHARED_LIBRARIES := \ //在libacc的后面加上
LOCAL_LDLIBS := -ldl

OK!!收工
编译Android 2.3时出现的错误:
错误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 解决方法:

1
2
3
gedit build/core/combo/HOST_linux-x86.mk
-HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0