1.<命令行>:0:0:错误:“_FORTIFY_SOURCE”重定义[-Werror]
修改build/core/combo/HOST_linux-x86.mk61行,将
HOST_GLOBAL_CFLAGS+= -D_FORTIFY_SOURCE=0
修改成
HOST_GLOBAL_CFLAGS+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
Android源码换服务器了,具体的http://source.android.com/source/downloading.html
2.在编译代码的时候出现“/usr/bin/ld:cannotfind-luuid”错误,在网上找了些资料发现是gcc编译时找不到链接的库,解决办法如下:
1.在终端下运行命令:locatelibuuid
说明:出现的错误是luuid,为什么在locate后面是libuuid,这是由于链接库的命名造成的。假如出现了“/usr/bin/ld:cannotfind-lltdl”,则在终端输入>:locatelibltdl,即把-l去掉。
apt-getinstall uuid
ln-s/lib/i386-linux-gnu/libuuid.so.1/usr/lib/libuuid.so
--fattire ERROR: :0:0: error: "_FORTIFY_SOURCE" redefined [-Werror] FIX: in build/core/comboHOST_linux-x86.mk : -HOST_GLOBAL_CFLAGS +=3D -D_FORTIFY_SOURCE=3D0 +HOST_GLOBAL_CFLAGS +=3D -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3D0 ------- ERROR: external/gtest/src/../include/gtest/internal/gtest-param- util.h:122:11: error: =91ptrdiff_t=92 does not name a type FIX: in external/gtest/internal/gtest-param-util.h #include <vector> +#include <cstddef> #include <gtest/internal/gtest-port.h> ------- ERROR: external/oprofile/libpp/format_output.h:94:22: error: reference =91counts=92 cannot be declared =91mutable=92 [-fpermissive] FIX: in external/libpp/format_output.h b/libpp/format_output.h - mutable counts_t & counts; + counts_t & counts; ------- ERROR: frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable =91ParamName=92 set but not used [-Werror=3Dunused-but-set- variable] FIX: in android/ics/frameworks/compile/slang/Android.mk -local_cflags_for_slang :=3D -Wno-sign-promo -Wall -Wno-unused-parameter -Werror +local_cflags_for_slang :=3D -Wno-sign-promo -Wall -Wno-unused-parameter ------- ERROR: Numerous pthread errors w/llvm: Example: external/llvm/lib/Support/Threading.cpp:96: undefined reference to `pthread_create' FIX: This is a really dumb fix. But it got me to the end of the build. In external/llvm... diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp index b408973..3a13adf 100644 --- a/lib/Support/Mutex.cpp +++ b/lib/Support/Mutex.cpp @@ -13,6 +13,8 @@ #include "llvm/Config/config.h" #include "llvm/Support/Mutex.h" +#undef ENABLE_THREADS +#undef HAVE_PTHREAD_H // =3D=3D=3D------------------------------------------------------------------= ---- =3D=3D=3D// //=3D=3D=3D WARNING: Implementation here must contain only TRULY operating system diff --git a/lib/Support/Signals.cpp b/lib/Support/Signals.cpp index a117893..68fa5e7 100644 --- a/lib/Support/Signals.cpp +++ b/lib/Support/Signals.cpp @@ -25,6 +25,8 @@ using namespace sys; } +#undef HAVE_DLFCN_H + // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX #include "Unix/Signals.inc" diff --git a/lib/Support/Threading.cpp b/lib/Support/Threading.cpp index 2957956..f1339a3 100644 --- a/lib/Support/Threading.cpp +++ b/lib/Support/Threading.cpp @@ -16,6 +16,7 @@ #include "llvm/Support/Mutex.h" #include "llvm/Config/config.h" #include <cassert> +#undef LLVM_MULTITHREADED