最近又開始在編譯Android 的source code,
編譯時所遇到的問題,記錄一下。(編譯環境 ubuntu 11.10 64bit)
Error:
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1
Sol:
sudo apt-get install libc6-dev-i386
Error:
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
Sol:
sudo apt-get install lib32z1-dev
Error:
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1
Sol:
sudo apt-get install lib32ncurses5-dev
Error:
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
Sol:
此處編譯錯誤是由於ubuntu 11.10採用了GCC4.6.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
Error:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
Sol:
修改文件 /frameworks/base/libs/utils/Android.mk
修改以下語句
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
為
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
Error:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1
Sol:
modify this file: external/oprofile/libpp/format_output.h
form
mutable counts_t & counts;
to
counts_t & counts;
Error:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] Error 1
Sol:
modify this file: external/gtest/include/gtest/internal/gtest-param-util.h
Add this line:
#include <cstddef>
Error:
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
Sol:
modify this file: external/llvm/llvm-host-build.mk
Add this line:
LOCAL_LDLIBS := -lpthread -ldl
Error:
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1
Sol:
modify this file: frameworks/compile/slang/Android.mk
from
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
to
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
Error:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1
Sol:
Eidt this file: external/mesa3d/src/glsl/linker.cpp
Add:
#include <cstddef>
將編譯好的img檔案,刷近手機。
依序為
fastboot oem unlock
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot erase cache