【问题】
折腾:
【记录】在Cygwin上用Buildroot为xscale建立交叉工具链
期间,编译出错:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ make >>> Installing kernel headers (cd /home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1; \ /bin/make -j4 ARCH=arm \ HOSTCC="/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /bin/gcc" HOSTCFLAGS="" \ HOSTCXX="/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /bin/g++" \ INSTALL_HDR_PATH=/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux headers_install; \ ) make[1]: arm-xscale-linux-gnu-gcc: Command not found make[1]: Entering directory `/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1' make[1]: Entering directory `/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1' CHK include/linux/version.h HOSTCC scripts/basic/fixdep /bin/sh: scripts/basic/fixdep: cannot execute binary file make[2]: *** [scripts/basic/fixdep] Error 126 make[1]: *** [scripts_basic] Error 2 make[1]: Leaving directory `/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1' make: *** [/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux/.configured] Error 2
如图:
即:
/bin/sh: scripts/basic/fixdep: cannot execute binary file |
【解决过程】
1.这个问题,之前就遇到过:
然后参考自己的办法,去看看:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ ls output/toolchain/linux-2.6.19.1/scripts/basic/fixdep* -lha -rwxr-xr-x 1 CLi Domänen-Benutzer 9.2K Nov 7 2012 output/toolchain/linux-2.6.19.1/scripts/basic/fixdep* -rw-r--r-- 1 CLi Domänen-Benutzer 9.4K Oct 17 2012 output/toolchain/linux-2.6.19.1/scripts/basic/fixdep.c -rwxr-xr-x 1 CLi Domänen-Benutzer 62K Sep 24 17:25 output/toolchain/linux-2.6.19.1/scripts/basic/fixdep.exe* CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ file output/toolchain/linux-2.6.19.1/scripts/basic/fixdep output/toolchain/linux-2.6.19.1/scripts/basic/fixdep: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ file output/toolchain/linux-2.6.19.1/scripts/basic/fixdep.exe output/toolchain/linux-2.6.19.1/scripts/basic/fixdep.exe: PE32 executable (console) Intel 80386, for MS Windows
很明显,的确是:
此处想要运行的:
output/toolchain/linux-2.6.19.1/scripts/basic/fixdep
是for linux的。
所以,通过两者改名,是可以的。
但是还是打算想想办法,是否有永久的,一次性的解决办法。
2.这人:
的做法,也是和我类似:
其是删除fixdep,让其运行
scripts/basic/fixdep
自动找到
scripts/basic/fixdep.exe
但是还不是根本解决办法。
3.看了对应的makefile文件:
D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\output\toolchain\linux-2.6.19.1\scripts\basic\Makefile
内容是:
### # Makefile.basic list the most basic programs used during the build process. # The programs listed herein is what is needed to do the basic stuff, # such as fix dependency file. # This initial step is needed to avoid files to be recompiled # when kernel configuration changes (which is what happens when # .config is included by main Makefile. # --------------------------------------------------------------------------- # fixdep: Used to generate dependency information during build process # docproc: Used in Documentation/docbook hostprogs-y := fixdep docproc always := $(hostprogs-y) # fixdep is needed to compile other host programs $(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep
想要去修改makefile实现自动的,不生成fixdep,而只生成fixdep.exe。
4.那就需要添加对应的cygwin的检测,但是不知道如何加。
所以去看看能否找到别的参考的makefile。
结果找了半天,发现对于linux的kernel的源码中,
包括各种makefile,kconfig等等,根本就没有关于检测是否是cygwin的事情。
所以,彻底放弃此种修改。
5.所以去重命名fixdep:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ mv output/toolchain/linux-2.6.19.1/scripts/basic/fixdep output/toolchain/linux-2.6.19.1/scripts/basic/fixdep_backup
再去编译,就可以了:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ make >>> Installing kernel headers (cd /home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1; \ /bin/make -j4 ARCH=arm \ HOSTCC="/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /bin/gcc" HOSTCFLAGS="" \ HOSTCXX="/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /bin/g++" \ INSTALL_HDR_PATH=/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux headers_install; \ ) make[1]: arm-xscale-linux-gnu-gcc: Command not found make[1]: Entering directory `/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1' make[1]: Entering directory `/home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain/linux-2.6.19.1' CHK include/linux/version.h HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/docproc HOSTCC scripts/unifdef
如图:
【总结】
还是Linux内核源码,对于cygwin等支持不够好,所以,此处在cygwin下编译各种Linux下面的东西,
尤其是这个linux内核,会出现:
/bin/sh: scripts/basic/fixdep: cannot execute binary file |
的错误的
解决办法:
把对应的
scripts/basic/fixdep
删除掉,或重命名:
mv output/toolchain/linux-2.6.19.1/scripts/basic/fixdep output/toolchain/linux-2.6.19.1/scripts/basic/fixdep_backup
这样调用
scripts/basic/fixdep
时,就可以自动找到,(在cygwin下编译会额外生成的scripts/basic/fixdep.exe)
就可以避免此问题了。
转载请注明:在路上 » 【已解决】cygwin先编译buildroot在Installing kernel headers期间出错:/bin/sh: scripts/basic/fixdep: cannot execute binary file