ICS (Android 4.0) 常见 编译错误 整理

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值