您的位置:首页 > 移动开发 > Android开发

ubuntu12.04.4(x64)编译android-4.0.1_r1代码错误解决

2014-04-29 13:08 281 查看
1、/usr/bin/ld.bfd.real: cannot find -lGL

查看了一些资料,因为编译的时候还是用到了32BIT的libGL.so libX11.so库文件,编译的时候找的不是X86_64库文件配置,而是找的是I386库文件配置

$ sudo apt-get installibgl1-mesa-glx:i386(libGL.so)

由于libGL.so系统默认没有进行库路径下的链接,还需要手动链接一下

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

2、external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'

collect2: ld returned 1 exit status

解决办法:

vim external/llvm/llvm-host-build.mk

LOCAL_LDLIBS := -lpthread -ldl

3、gtest错误

external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type

解决:

external/gtest里打patch或者自己手动修改

diff --git a/include/gtest/internal/gtest-param-util.h b/include/gtest/internal/gtest-param-util.h
index 5559ab4..b964c45 100644
--- a/include/gtest/internal/gtest-param-util.h
+++ b/include/gtest/internal/gtest-param-util.h
@@ -37,6 +37,7 @@
#include <iterator>
#include <utility>
#include <vector>
+#include <cstddef>

#include <gtest/internal/gtest-port.h>

4、mutable错误

external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]

解决方法:

external/oprofile里打patch或者自己手动修改文件

diff --git a/libpp/format_output.h b/libpp/format_output.h
index b6c4592..4efdbb1 100644
--- a/libpp/format_output.h
+++ b/libpp/format_output.h
@@ -91,7 +91,8 @@ protected:
symbol_entry const & symbol;
sample_entry const & sample;
size_t pclass;
- mutable counts_t & counts;
+// mutable counts_t & counts;
+ counts_t & counts;
extra_images const & extra;
double diff;
};

5、<命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror]

修改build/core/combo/HOST_linux-x86.mk 61行,将
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


6、error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]


遇到这个错误

host C++: llvm-rs-cc <= frameworks/compile/slang/slang_rs_export_foreach.cpp

frameworks/compile/slang/slang_rs_export_foreach.cpp: In static member function ‘static slang::RSExportForEach* slang::RSExportForEach::Create(slang::RSContext*, const clang::FunctionDecl*)’:

frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]

cc1plus: all warnings being treated as errors

解决办法有两个

1.注释掉frameworks/compile/slang/slang_rs_export_foreach.cpp 中的247行的 定义ParamName的语句;

2..在工程根目录下,打开下面的makefile文件:

# vi frameworks/compile/slang/Android.mk

在打开的makefile文件中按照下面更改:

-----local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror

++++local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
http://blog.csdn.net/yuan1590/article/details/7530735 http://blog.csdn.net/shuzui1985/article/details/7628121 http://hcleon.iteye.com/blog/1461352 http://blog.csdn.net/zlm_250/article/details/7949440 http://blog.csdn.net/conanyang/article/details/751874
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: