最近准備在工作之余研究下v8,下班時間鼓搗了2天,現在終於能下載,能gclient sync了。
剛開始的目的就是跑一個hello world,按照wiki上的例子來: https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding
開始之前,先得拉取代碼並安裝其他依賴工具,按: https://github.com/v8/v8/wiki/Using%20Git 來,主要是這幾個步驟:
1. 獲取depot_tools
2. 執行命令:
gclient
fetch v8
cd v8
切換分支
gclient sync
其中可能出現問題,當初也知道,在天朝做技術,肯定要開代理的,於是開了系統的socks代理,發現git不會自動采用系統的代理,所以還得設置:
git config --global http.proxy 'socks5://127.0.0.1:7070'
git config --global https.proxy 'socks5://127.0.0.1:7070'
然后就算是開了代理,最后執行的gclient sync命令也不會成功,block一段時間后可能報這種錯誤吧(摘抄自網絡):
________ running 'download_from_google_storage --no_resume --platform=linux* --no_auth --bucket chromium-gn -s src/buildtools/linux32/gn.sha1' in '/home/halton/work/projects/chromium/android' File gs://chromium-gn/1088992877b3a13f25b61c8fc18e25296d8cab33 for src/buildtools/linux32/gn does not exist. 0> File gs://chromium-gn/1088992877b3a13f25b61c8fc18e25296d8cab33 for src/buildtools/linux32/gn does not exist, skipping. Error: Command download_from_google_storage --no_resume --platform=linux* --no_auth --bucket chromium-gn -s src/buildtools/linux32/gn.sha1 returned non-zero exit status 1 in /home/halton/work/projects/chromium/android
找了一些時間,終於知道原來gclient內部跑download_from_google_storage時,是用不了socks的,只能用http代理,於是需要下載brew install polipo,用它將socks轉換為一個http代理,另外gclient內部好像用的boto吧,需要配置boto來采用此HTTP代理,於是需要:
1. 在$HOME/.boto文件中寫入:
proxy = 127.0.0.1
proxy_port = 8132
2. export NO_AUTH_BOTO_CONFIG=$HOME/.boto
3. 再次執行gclient sync
由於gclient sync執行時,他不會立即報錯,會一直block直到無法解決的問題,才最終結束,所以會浪費很多時間(兩晚上我都通宵等他執行),所以后面如果運行此命令,如果等待時間比較長,而還沒有動靜,就應該立即CTRL+C讓他結束,再看是否有打印報錯。
以上全靠回憶步驟,在此記錄一下。