Rustc is not allowed to be used in Android 10 build system

Modify build/soong/ui/build/paths/config.go or export TEMPORARY_DISABLE_PATH_RESTRICTIONS

阿強
1 min readMar 27, 2020

當加入新module進入到Android 10內,不管是Android.mk or Android.bp,指定非允許的執行檔(可能是特定的python或者是rustc)來做某些動作,就會發生以下error

“rustc” is not allowed to be used.

Disallowed PATH tool “rustc” used: []string{“rustc”, “ — version”}

原因是Android 10中的soong加了一些保護機制,在build/soong/ui/build/paths/config.go,其中的Configuration裡面描述PathConfig,假設將使用的執行檔在預期之內,可透過Configuration擴充來解決此問題,假如執行檔很多,那簡單的方法就是加入TEMPORARY_DISABLE_PATH_RESTRICTIONS,避開檢查,就可以順利編譯了,只是編譯途中會產生很多訊息。

參考說明:https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools

--

--

阿強
阿強

Written by 阿強

一個喜歡研究新事物的軟體工程師

No responses yet