在ubuntu上編譯chrome紅心地瓜1.擷取代碼1)下載tarball,http://chromium-browser-source.commondatastorage.googleapis.com/chromium_tarball.html2) 解壓縮3)安裝dept_tools:http://www.chromium.org/developers/how-tos/install-depot-tools將dept_tools加到PATH裡面
export PATH="$PATH":`pwd`/depot_tools或者加到~/.bashrc裡面2.安裝dependency進到chromium/src目錄下./build/install-build-deps.sh
3.同步代碼進到chromium/src目錄下gclient sync --force
如果不想同步,則必須執行gclient runhooks --force
這一步會調用gyp來長生一些平台特定的代碼,只要做一次就可以
4.配置
./build/gyp_chromium -Dflag1=value1 -Dflag2=value2
5.編譯make chrome
碰到問題及解決1.bison: cannot open file `external/bison/data/m4sugar/m4sugar.m4': No such file or directory看著像bison沒有裝好,又重新apt-get remove/install裝了bison,還是不行,到網站下載最新的2.5編譯安裝,還是不行於是bison -V發現顯示的是bison (GNU Bison) 2.3
可是我用Whereis bison,顯示的又是我剛裝的2.5的地址判斷是哪裡的bison預先執行了於是strace(bison),果然execve("/home/tom/work/gingerbread/out/host/linux-x86/bin/bison", ["bison"], [/* 51 vars */]) = 0
原因是我將android out 的地址設定在path的前面,於是覆蓋了/usr/local/bin,執行了android下面的bison修改PATH變數,問題得到解決
2.link的時候記憶體不足退出解決方案:1)加大swap,我加到了8Ghttp://www.ylmf.net/ubuntu/tips/2010123119690.html
2)採用gold ld替代ld進行連結 export
CC="gcc -B/usr/local/gold/bin"
或者將/usr/local/gold/bin加到PATH變數中/usr/bin的前面
參考:1)get-the-code,http://www.chromium.org/developers/how-tos/get-the-code2)linux build instruction,http://code.google.com/p/chromium/wiki/LinuxBuildInstructions3) LinuxFasterBuilds, http://code.google.com/p/chromium/wiki/LinuxFasterBuilds