ubuntu编译android 4.04源码的错误解决方法

在ubuntu 11.10或12.10 64位下编译android 4.04源码,出现的错误和解决方法如下:

/****************************************************/
错误:
<命令行>: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


/****************************************************/
external/mesa3d/src/glsl/linker.cpp:1394:49: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1394:50: 错误: ‘varyings’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1394:58: 错误: ‘offsetof’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1395:48: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1412:47: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1412:48: 错误: ‘position’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1414:47: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1414:48: 错误: ‘pointSize’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1424:47: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1424:48: 错误: ‘position’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1428:47: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1428:48: 错误: ‘frontFacingPointCoord’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1431:47: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1431:48: 错误: ‘frontFacingPointCoord’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp: 在函数‘void link_shaders(const gl_context*, gl_shader_program*)’中:
external/mesa3d/src/glsl/linker.cpp:1734:49: 错误: expected primary-expression before ‘,’ token
external/mesa3d/src/glsl/linker.cpp:1734:50: 错误: ‘fragColor’在此作用域中尚未声明
external/mesa3d/src/glsl/linker.cpp:1734:59: 错误: ‘offsetof’在此作用域中尚未声明

解决方法:
vim external/mesa3d/src/glsl/linker.cpp
添加:
#include <cstddef>

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

解决方法:
vim external/oprofile/libpp/format_output.h
修改94行:
mutable counts_t & counts;
=>
counts_t & counts;

/************************************************************/
错误:
external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: 错误: ‘ptrdiff_t’不是一个类型名

解决方法:
vim external/gtest/src/../include/gtest/internal/gtest-param-util.h

添加:
#include <cstddef>

/************************************************************/
错误:
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o): In function `PrintStackTrace':
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Unix/Signals.inc:219: undefined reference to `dladdr'
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Unix/Signals.inc:231: undefined reference to `dladdr'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Threading.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Threading.cpp:96: undefined reference to `pthread_create'
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Threading.cpp:91: undefined reference to `pthread_attr_setstacksize'
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Threading.cpp:100: undefined reference to `pthread_join'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o): In function `MutexImpl':
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Mutex.cpp:69: undefined reference to `pthread_mutexattr_init'
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Mutex.cpp:75: undefined reference to `pthread_mutexattr_settype'
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Mutex.cpp:80: undefined reference to `pthread_mutexattr_setpshared'
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Mutex.cpp:89: undefined reference to `pthread_mutexattr_destroy'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::tryacquire()':
/home/tonny/work/imx6/android-imx6-r13.3/external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'

解决方法:
$vim external/llvm/llvm-host-build.mk
添加:
LOCAL_LDLIBS := -lpthread -ldl


/************************************************************/
错误:
frameworks/compile/slang/slang_rs_export_foreach.cpp: 在静态成员函数‘static slang::RSExportForEach* slang::RSExportForEach::Create(slang::RSContext*, const clang::FunctionDecl*)’中:
frameworks/compile/slang/slang_rs_export_foreach.cpp:249:23: 错误: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
host C++: llvm-rs-cc <= frameworks/compile/slang/slang_rs_object_ref_count.cpp
cc1plus:所有的警告都被当作是错误


解决方法:

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



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值