bitbake core-image-minimal で起きやすい問題と対処をまとめます。
初回セットアップログはエラーではない
ログ
You had no conf/local.conf file.
You had no conf/bblayers.conf file.
Shell environment set up for builds.
You can now run 'bitbake <target>'
意味
build-qemu/conf/local.conf と build-qemu/conf/bblayers.conf がテンプレートから生成されました。正常です。
fetch warning
ログ
WARNING: make-native ... do_fetch: Failed to fetch URL ..., attempting MIRRORS if available
判断
最後に以下が出れば成功です。
NOTE: Tasks Summary: ... all succeeded.
この場合、最初の URL からは取れなかったが、ミラーから取得できています。
ERROR に昇格した場合
ERROR: Fetcher failure
ERROR: do_fetch
確認します。
ping -c 3 8.8.8.8
ping -c 3 downloads.yoctoproject.org
curl -I https://downloads.yoctoproject.org/
企業ネットワークなら proxy を確認します。
export http_proxy=http://proxy.example.com:8080
export https_proxy=http://proxy.example.com:8080
export no_proxy=localhost,127.0.0.1
Docker Compose に渡す場合です。
environment:
- http_proxy=${http_proxy}
- https_proxy=${https_proxy}
- no_proxy=${no_proxy}
SSTATE が効かない
ログ
Sstate summary: Wanted 1808 Local 0 Mirrors 0 Missed 1808 Current 0
初回なら正常です。2 回目以降も Local 0 のままなら異常です。
確認
grep -E '^(DL_DIR|SSTATE_DIR)' conf/local.conf
ls -ld /cache/downloads /cache/sstate-cache
du -sh /cache/downloads /cache/sstate-cache
正しい設定
DL_DIR ?= "/cache/downloads"
SSTATE_DIR ?= "/cache/sstate-cache"
Docker Compose 側です。
volumes:
- ../cache/downloads:/cache/downloads
- ../cache/sstate-cache:/cache/sstate-cache
メモリ不足
ログ
Killed
cc1plus: fatal error: Killed signal terminated program cc1plus
対処
conf/local.conf の並列数を下げます。
BB_NUMBER_THREADS ?= "2"
PARALLEL_MAKE ?= "-j2"
確認します。
free -h
ディスク不足
ログ
No space left on device
確認
df -h
du -sh /work/build-qemu/tmp
du -sh /cache/downloads
du -sh /cache/sstate-cache
対処
まず不要な build directory を消します。ただし downloads と sstate-cache はできるだけ残します。
rm -rf /work/build-qemu/tmp
recipe 単位なら以下です。
bitbake -c cleansstate <recipe>
bitbake <recipe>
コマンド誤結合
ログ
bitbake core-image-minimalls -lh /work/build-qemu/tmp/deploy/images/qemux86-64/
ERROR: Nothing PROVIDES 'core-image-minimalls'
原因
bitbake core-image-minimal と ls -lh ... がくっついています。
正しいコマンド
bitbake core-image-minimal
ls -lh /work/build-qemu/tmp/deploy/images/qemux86-64/
tmp 全消しは最終手段
以下は強い対処ですが、再ビルド時間が長くなります。
rm -rf build-qemu/tmp
通常は recipe 単位で掃除します。
bitbake -c clean <recipe>
bitbake <recipe>
または sstate も含めて消す場合です。
bitbake -c cleansstate <recipe>
bitbake <recipe>