編譯busybox錯誤彙總

提示錯誤:
arm-linux-gcc:Command not found
PATH裏有/usr/oca/arm/bin,但是make的時候,就是找不到 arm-linux-gcc
原因:
export PATH=$PATH:/usr/local/arm/bin是設置當前用戶的PATH,而sudo執行make的時候,使用的是超級用戶權限,那也就使用了超級用戶的PATH(但是這個PATH裏,並沒有/usr/ local/arm/bin)

解決辦法
先打開一個超級用戶權限的
sudo -s
在當前模式下,設置環境變量export PATH=$PATH /usr/local/arm/bin,再進入到busybox目錄, make CONFIG_PREFIX=/work/nfs_root/first_fs install,就成功安裝busybox了。

提示錯誤:
/home/book/work/busybox-1.7.0/scripts/gcc-version.sh: line 11: arm-linux-gcc: command not found
/home/book/work/busybox-1.7.0/scripts/gcc-version.sh: line 11: arm-linux-gcc: command not found
CC applets/applets.o
/bin/sh: 1: arm-linux-gcc: not found
scripts/Makefile.build:192: recipe for target ‘applets/applets.o’ failed
make[1]: *** [applets/applets.o] Error 127
Makefile:701: recipe for target ‘applets’ failed
make: *** [applets] Error 2

原因:
交叉編譯器的絕對路徑與相對路徑問題

解決辦法
在busybox的頂層Makefile 176行 CROSS COMPILE ?= 中添加/work/tools/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-的絕對路徑就成功了。(爲什麼以前用arm-linux-就可以自己找到?)

提示錯誤:
CC applets/applets.o
In file included from include/busybox.h:10,
from applets/applets.c:16:
include/libbb.h:15: error: syntax error before ‘<’ token
In file included from /work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/…/…/…/…/arm-linux/sys-include/dirent.h:62,
from include/libbb.h:16,
from include/busybox.h:10,
from applets/applets.c:16:
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/…/…/…/…/arm-linux/sys-include/bits/dirent.h:35: error: syntax error before ‘}’ token
applets/applets.c: In function get_trimmed_slice': applets/applets.c:102: warning: implicit declaration of functionisspace’
scripts/Makefile.build:192: recipe for target ‘applets/applets.o’ failed
make[1]: *** [applets/applets.o] Error 1
Makefile:701: recipe for target ‘applets’ failed
make: *** [applets] Error 2
原因:
缺少必要頭文件
解決辦法
修改busybox中的源碼:include/libbb.h 中,增加一行#include <sys/resource.h>。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章