Ubuntu11.10编译chromium for android
http://blog.csdn.net/jaylinzhou/article/details/9012993
gclient runhooks 出错:
subprocess.CalledProcessError: Command '['curl', '-L', 'https://commondatastorage.googleapis.com/nativeclient-archive2/toolchain/12356/sysroot-arm-trusted.tgz', '-o', '/home/sin/workspace/prj/chrome/androidchrome/src/arm-sysroot/sysroot-arm-trusted.tgz']' returned non-zero exit status 28
Error: Command /usr/bin/python src/build/linux/install-arm-sysroot.py --linux-only returned non-zero exit status 1 in /home/sin/workspace/prj/chrome/androidchrome
无法下载, 修改src/build/linux/install-arm-sysroot.p直接退出
ninja -C out/Debug content_shell_apk
生成out/Debug/apks/ContentShell.apk
2.3 运行错误:
I/chromium( 2420): [INFO:library_loader_hooks.cc(117)] Chromium logging enabled: level = 0, default verbosity = 0
I/dalvikvm( 2420): Failed resolving Lorg/chromium/ui/gl/SurfaceTextureListener; interface 77 'Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;'
W/dalvikvm( 2420): Link of class 'Lorg/chromium/ui/gl/SurfaceTextureListener;' failed
W/System.err( 2420): java.lang.NoClassDefFoundError: org.chromium.ui.gl.SurfaceTextureListener
W/System.err( 2420): at org.chromium.content.app.LibraryLoader.nativeLibraryLoaded(Native Method)
W/System.err( 2420): at org.chromium.content.app.LibraryLoader.initializeAlreadyLocked(LibraryLoader.java:156)
W/System.err( 2420): at org.chromium.content.app.LibraryLoader.ensureInitialized(LibraryLoader.java:63)
W/System.err( 2420): at org.chromium.content_shell_apk.ContentShellActivity.onCreate(ContentShellActivity.java:63)
W/System.err( 2420): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
W/System.err( 2420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
W/System.err( 2420): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
W/System.err( 2420): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
W/System.err( 2420): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
W/System.err( 2420): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 2420): at android.os.Looper.loop(Looper.java:130)
W/System.err( 2420): at android.app.ActivityThread.main(ActivityThread.java:3691)
W/System.err( 2420): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 2420): at java.lang.reflect.Method.invoke(Method.java:507)
W/System.err( 2420): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
W/System.err( 2420): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
W/System.err( 2420): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 2420): Caused by: java.lang.ClassNotFoundException: org.chromium.ui.gl.SurfaceTextureListener in loader dalvik.system.PathClassLoader[/data/app/org.chromium.content_shell_apk-1.apk]
W/System.err( 2420): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
W/System.err( 2420): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
W/System.err( 2420): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
W/System.err( 2420): ... 17 more
F/chromium( 2420): [FATAL:jni_android.cc(116)] Check failed: !ClearException(env) && clazz. Failed to find class org/chromium/ui/gl/SurfaceTextureListener
chrome下载编译
======================
gclient sync --force 就开始同步下载代码了,现在的任务就是等待,根据你的网络情况,可能需要下载半天到一天以上不等,如果中途出错,只需要重新执行gclient sync –-force,会自动接着上次的下载(really??)。注意一定要加--force参数选项,否则可能下载不齐全。
=======================
进入chromium代码目录“D:\chromium\home\src_tarball\tarball\chromium\src”,运行命令“gclientsync--force”,将会进行代码更新及第三方代码库的更新,并生成工程文件。实际上,该命令首先根据.glcient文件设置代码库参数,然后搜索所有的DEPS文件,根据文件中的列表下载源代码(根据平台下载本平台支持的代码);之后会执行“gclientrunhooks”命令的内容,生成平台支持的工程文件。如果我们不想更新代码,不运行“gclientsync”而直接运行“gclientrunhooks”也可以,这样直接生成工程文件。这一步时间会更久一些,一定要耐心。(后续再更新代码可以去掉--force参数)
======================
二、成功的经历
1.环境Ubuntu10.4.4 -desktop-amd64 + VMware Workstation 9
2.步骤参考https://code.google.com/p/chromium/wiki/LinuxBuildInstructions,这里写的比较详细,我的步骤可以简化为,下载完tarball后,
a.安装git-core
b.build/install-build-deps.sh
c.Install depot_tools git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
d..bashrc添加 export PATH="$PATH":`pwd`/depot_tools
e.gclient sync --force
f.ninja -C out/Debug chrome
======================
下载tarball
在Chromium官网的Get the Code页面可以找到tarball下载链接
http://chromium-browser-source.commondatastorage.googleapis.com/chromium_tarball.html
-xzvf chromium.r####.tgz
解压到当前目录
下载tarball
在Chromium官网的Get the Code页面可以找到tarball下载链接
http://chromium-browser-source.commondatastorage.googleapis.com/chromium_tarball.html
-xzvf chromium.r####.tgz
解压到当前目录
使用git下载depot_tools
git clone https://chromium.googlesource.com//tools/depot_tools.git
添加depot_tools到环境变量
修改~/.bashrc
export =$PATH:your depot_tools location
配置gclient
在chromium目录下执行
gclient config http://src.chromium.org/svn/trunk/src
runhooks
在chromium目录下执行
#配置ninja export GYP_GENERATORS=ninja gclient runhooks
安装所有依赖的库
./src/buildinstall-build-deps.sh
需要安装的库特别多,可能需要比较长的时间。
使用ninja编译
编译需要在src目录下
#Debug版 ninja out/Debug chrome #Release版 ninja out/Release chrome #编译sandbox ninja outDebug sand_box
=========ok=============
第一步:下载源码:
Google为Chromium项目提供了一个源码下载管理的工具depot_toos
安装好后,把depot_toos 所在的路径添加到环境变量中,路径上不要带空格,切记。
1.初始化gclient的下载地址
gclient config http://src.chromium.org/svn/trunk/src
2.下载源码
gclient sync
这一步的时间比较长,中间过程经常会被打断或出现假死的情况,重新直接下面命令就OK,
gclient sync
这个命令支持断点续传。
当gclient sync命令执行完成后,会运行.gyp文件,生成Windows平台VS可以识别的项目工程vcproj
sln项目工程文件,你就可以在src/chrome目录下看到有一个chrome.sln的工程文件,如果没有说明
glcient sync命令没有执行完,重新运行。
chrome初始化
Our WinMain
function is in chrome/app/main.cc
, and is linked in thechrome
project.
-
WinMain
launches the Google Update Client, which is the installer/autoupdater. It will find the subdirectory for the current version, and loadchrome.dll
from there. -
It calls
ChromeMain
in the newly loaded library, which is inchrome_main.cc
in thechrome_dll
project. -
ChromeMain
does initialization for common components, and then forwards to eitherRendererMain
inchrome/renderer/renderer_main.cc
if the command line flag indicates that this should be a subprocess, orBrowserMain
inchrome/browser/browser_main.cc
if not to load a new copy of the application. Since this is startup, we're launching the browser. -
BrowserMain
does common browser initialization. It has different modes for running installed webapps, connecting to the automation system if the browser is being tested, etc. -
It calls
LaunchWithProfile
inbrowser_init.cc
which creates a newBrowser
object inchrome/browser/ui/browser.cc
. This object encapsulates one toplevel window in the application. The first tab is appended at this time.
Tab startup & initial navigation
-
Browser::AddTab
inchrome/browser/ui/browser.cc
is called to append a new tab. -
It will create a new
TabContents
object frombrowser/tab_contents/tab_contents.cc
-
TabContents
creates aRenderViewHost
(chrome/browser/renderer_host/render_view_host.cc
) via theRenderViewHostManager
's
Init function inchrome/browser/tab_contents/render_view_host_manager.cc
). Depending on theSiteInstance
, theRenderViewHost
either spawns a new renderer process, or re-uses an existingRenderProcessHost
.RenderProcessHost
is the object in the browser that represents a single renderer subprocess. -
The
NavigationController
inchrome/browser/tab_contents/navigation_controller.cc
which is owned by the tab contents, is instructed to navigate to the URL for the new tab inNavigationController::LoadURL
. "Navigating from the URL bar" from step 3 onward describes what happens from this point.
chrome启动参数
http://blog.sina.com.cn/s/blog_9df1c3cd01011i0p.html