首先下载maguro对应的4.0.4的binary files,解压,执行,得到vendor目录,拷贝到源码根目录下。
错误1:
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror] <built-in>:0:0: note: this is the location of the previous definition cc1plus: all warnings being treated as errors make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 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
ATTENTION:
There is a SPACE between the -U_FORTIFY_SOURCE and -D_FORTIFY_SOURCE
错误2:
external/mesa3d/src/glsl/linker.cpp:623:33: warning: by ‘virtual ir_visitor_status remap_variables(ir_instruction*, gl_shader*, hash_table*)::remap_visitor::visit(ir_dereference_variable*)’ [-Woverloaded-virtual] external/mesa3d/src/glsl/linker.cpp: In function ‘void assign_varying_locations(gl_shader_program*, gl_shader*, gl_shader*)’: external/mesa3d/src/glsl/linker.cpp:1394:49: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1394:50: error: ‘varyings’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1394:58: error: ‘offsetof’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1395:48: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1412:47: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1412:48: error: ‘position’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1414:47: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1414:48: error: ‘pointSize’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1424:47: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1424:48: error: ‘position’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1428:47: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1428:48: error: ‘frontFacingPointCoord’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1431:47: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1431:48: error: ‘frontFacingPointCoord’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp: In function ‘void link_shaders(const gl_context*, gl_shader_program*)’: external/mesa3d/src/glsl/linker.cpp:1734:49: error: expected primary-expression before ‘,’ token external/mesa3d/src/glsl/linker.cpp:1734:50: error: ‘fragColor’ was not declared in this scope external/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scope make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1
#include <stddef.h>
错误3:
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1
解决办法:
external/oprofile/libpp/format_output.h
把:
mutable counts_t & counts;
去掉 mutable 改为:
counts_t & counts;
错误4
external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: 错误: ‘ptrdiff_t’不是一个类型名
In file included from external/gtest/src/../include/gtest/gtest-param-test.h:157:0,
from external/gtest/src/../include/gtest/gtest.h:69,
from external/gtest/src/../src/gtest.cc:34,
from external/gtest/src/gtest-all.cc:36:
解决方法:
$vim external/gtest/src/../include/gtest/internal/gtest-param-util.h
#include <cstddef>
错误5
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 错误 1
make: *** 正在等待未完成的任务....
解决方法:
$vim external/llvm/llvm-host-build.mk
添加
LOCAL_LDLIBS := -lpthread -ldl
错误6
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1
解决方法
解决办法:$ vim frameworks/compile/slang/Android.mk
将 local_cflags_for_slang 所在行最后的 -Werror 去掉:
#local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter