Android 6.0 Build fail on python raise child_exception

工作上需要外測,所以必須準備可以帶出去Build Code的環境,
當然在自己的Notebook上架虛擬機器是比較便利的,
想說新進同事們的新機器上跑Ubuntu 14.04沒有問題,
就直接安裝卻是災難的開始…

灌好Unbuntu環境以後,當然第一步就是到Android的安裝指南:
ubuntu14_initial 繼續完成JAVA JRE, JDK 後續編譯軟體的佈建,
然後透過rsync把我工作機上的開發套件整個搬移過來,

rsync -av --delete -e ssh 192.168.1.100:~/Workspace/android_project ~/Workspace

當然Build的過程不會這麼順利,主要是遇到缺哪個套件就去裝它這樣,
惡夢是,我居然在rsync之前再工作機上敲了repo sync
結果這個周末我們code base上就有待解的issues導致沒辦法順利build出fw.
最後找了個指令把整個code base退回一個禮拜前,

repo forall -c 'HAHA=`git log --before="3 days" -1 --pretty=format:"%H"`;git reset --hard $HAHA'

確保工作機上可以順利build出後,才真正開始浮出問題:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Export includes file: frameworks/support/v8/renderscript/jni/Android.mk -- out/host/linux-x86/obj/EXECUTABLES/rsg-generator_support_intermediates/export_includes
host Executable: rsg-generator_support (out/host/linux-x86/obj/EXECUTABLES/rsg-generator_support_intermediates/rsg-generator_support)
target Generated: libRSSupport <= frameworks/rs/rsgApiStructs.h.rsg
Copy: out/target/product/msm8909/obj/SHARED_LIBRARIES/libRSSupport_intermediates/rsgApiStructs.h
target Generated: libRSSupport <= frameworks/rs/rsgApiFuncDecl.h.rsg
Copy: out/target/product/msm8909/obj/SHARED_LIBRARIES/libRSSupport_intermediates/rsgApiFuncDecl.h
target Generated: libRSSupport <= frameworks/rs/rsgApi.cpp.rsg
Copy: out/target/product/msm8909/obj/SHARED_LIBRARIES/libRSSupport_intermediates/rsgApi.cpp
target Generated: libRSSupport <= frameworks/rs/rsgApiReplay.cpp.rsg
Copy: out/target/product/msm8909/obj/SHARED_LIBRARIES/libRSSupport_intermediates/rsgApiReplay.cpp
Installing recovery patch to system partition
Warning: could not find SYSTEM/build.prop in <built-in function zip>
using prebuilt recovery.img from BOOTABLE_IMAGES...
using prebuilt boot.img from BOOTABLE_IMAGES...
Traceback (most recent call last):
  File "./build/tools/releasetools/make_recovery_patch", line 53, in <module>
    main(sys.argv[1:])
  File "./build/tools/releasetools/make_recovery_patch", line 49, in main
    common.MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img)
  File "/home/scottj/Workspace/PCT5230_LA13/LINUX/android/build/tools/releasetools/common.py", line 1398, in MakeRecoveryPatch
    _, _, patch = d.ComputePatch()
  File "/home/scottj/Workspace/PCT5230_LA13/LINUX/android/build/tools/releasetools/common.py", line 1089, in ComputePatch
    p = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/home/scottj/Workspace/PCT5230_LA13/LINUX/android/build/tools/releasetools/common.py", line 83, in Run
    return subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [out/target/product/msm8909/system/bin/install-recovery.sh] Error 1
 
#### make failed to build some targets (01:33:48 (hh:mm:ss)) ####
 
XXXXXX [ Build ANDROID Failed !! ] XXXXXX

首先當然先問問Google大神拉,的確有伙伴是跑出一模一樣的錯誤訊息,
build_miss_out

但是檢查我的out/system/底下是有出現build.prop這個檔案,
而且照樓主的解決方式是JAVA編譯環境的問題
但這邊的情況就只有裝設JDK7而已,
反而是自己工作機上JAVA6&7混合卻沒見過類似的錯誤訊息.
顯然問題並不是出在這.
然後重新檢視Google來的文章,終於看到一線曙光:
race_condition_fix 這個Fix Patch提到的確是在互競狀況下產生的問題尤其是只有用”-j1″的時候,
(which is basically always reproducible when building with -j1)
所以這就反映了這個錯誤訊息後面的情況”raise child_exception”
於是馬上去檢查我們的build script,果然被帶入了這個參數.
原來我們的Build Script有一段自動去帶目前機器上的CPU數目的機制

egrep '^processor' /proc/cpuinfo | wc -l

再加上VirtualBox預設就是帶一顆CPU去跑虛擬機器,問題就是在這邊了,
不去修改原本Code的情況下,只要增加VM上的CPU數目問題就解了.
vm-cpu 但是用我這台古老機器,clean build也只是從八個小時降到五個小時….囧


Refers:
https://source.android.com/source/initializing.html
http://newsletter.ascc.sinica.edu.tw/news/read_news.php?nid=1742
http://blog.csdn.net/zrf1335348191/article/details/51678730
http://review.cyanogenmod.org/#/c/135641/

Facebook Comments
Scottj Written by:

Be First to Comment

發表迴響