Android培训班(85)升级到4.0版本

来源:互联网 发布:sql注入实例 编辑:程序博客网 时间:2024/04/25 20:01
ICS总算发布了,从2.3.7升级到4.0.3版本。下面就是升级的命令:
$ mkdir ~/bin$ PATH=~/bin:$PATH

这里创建bin目录,以便放置下载软件repo.


  • $ mkdir 工作目录$ cd 工作目录
这里创建工作目录,用来保存下载源码。


$ repo init -u https://android.googlesource.com/platform/manifest
这行是获取主分支里的代码,如果你的系统是ubuntu 11.10需要使用主分布的代码来编译,如果是以前android版本会编译不通过。

$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
这行是取分支的方法,比如只需要某个版本的代码,就可以添加分支来下载。

$ repo sync
这一行才是真正地从代码下载下来。

下载的代码大小为5G到6G之间,因此下载的时间比较长,我这里下载了一个晚上。为了加快速度,好像也可以使用repo sync -j10的参数。

编译完成后,占用的空间大小为23G左右。

使用下面的命令行进行编译:

rm -rf out/
source build/envsetup.sh
lunch full-eng
make

为了加快编译速度,也可以使用make -j8的方式,这样使用8个线程编译,不过有时会出错,因为线程之间不同步的原因,可以多输入几次就行了。

在编译过程中,还是发现有一个BUG,如下:

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 ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1394:50: error: ‘varyings’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1394:58: error: ‘offsetof’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1395:48: error: expected primary-expression before ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1412:47: error: expected primary-expression before ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1412:48: error: ‘position’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1414:47: error: expected primary-expression before ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1414:48: error: ‘pointSize’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1424:47: error: expected primary-expression before ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1424:48: error: ‘position’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1428:47: error: expected primary-expression before ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1428:48: error: ‘frontFacingPointCoord’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1431:47: error: expected primary-expression before ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1431:48: error: ‘frontFacingPointCoord’ was not declared in this scopeexternal/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 ‘,’ tokenexternal/mesa3d/src/glsl/linker.cpp:1734:50: error: ‘fragColor’ was not declared in this scopeexternal/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scopemake: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1

解决这个问题需要修改文件如下:

把 "#include <stddef.h>" 添加到 linker.cpp 文件头部。
这样就可以编译完成了。