【背景】
关于交叉工具链的事情,很久之前,就在Ubuntu上面折腾过Buildroot:
后来又在Cygwin上折腾过crosstool-ng:
【记录】重试使用最新版本1.18.0的crosstool-ng去配置和编译xscale的交叉编译器
又在Ubuntu上折腾过crosstool-ng:
【记录】Ubuntu下用crosstool-ng为xscale建立交叉编译器arm-xscale-linux-gnueabi-gcc
并且分别在Cygwin下,和Ubuntu下,用对应制作出来的交叉工具链,去编译各种库,Uboot,kernel,等等,结果都是可以正常编译的。
(虽然在Cygwin下面编译uboot,kernel等内容时,会有些问题,但是也还是可以解决的。)
现在想要去试试,在Cygwin下面折腾Buildroot,看看是否可行,是否能制作出一个for xscale(arm)的交叉工具链。
【折腾过程】
1.开始折腾之前,先去找找资料。
主页:
是没有提到cygwin。
2.一些老帖子:
configuring buildroot for ARM using Cygwin
貌似参考价值不大。忽略之。
3.这里:
3 A Quick Comparison of BUILDROOT and CROSSTOOL
也是2005年的帖子,太久远,价值不大。
4.参考这个帖子:
可以看到是2010年的讨论,说是:
基本上就是:
buildroot不支持cygwin
而且本身在cygwin上折腾buildroot,也有N多缺点(速度慢,很多硬编码的文件不好等等)
所以:
还是推荐是在纯Linux下弄Buildroot;
其实推荐是在Windows上, (通过VMWare或Virtualbox等软件)弄个Linux的虚拟机,比如Ubuntu,然后在Linux虚拟机里面弄Buildroot。
5.不过,看到一个2011年的帖子:
其已经可以在Cygwin下用Buildroot生成交叉工具链了。
所以,此刻,2013年8月,自己可以去试试,最新的,buildroot,估计更加可以了。
6.去主页的下载页面:
http://buildroot.uclibc.org/download.html
中下载最新的:
http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.bz2
解压得到源码:
CLi@PC-CLI-1 ~/develop/buildroot $ wget http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.bz2 --2013-08-23 16:56:24-- http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.bz2 Resolving buildroot.uclibc.org (buildroot.uclibc.org)... 140.211.167.224 Connecting to buildroot.uclibc.org (buildroot.uclibc.org)|140.211.167.224|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2893047 (2.8M) [application/x-bzip2] Saving to: `buildroot-2013.05.tar.bz2' 100%[==================================================================================================================================>] 2,893,047 511K/s in 5.5s 2013-08-23 16:56:30 (511 KB/s) - `buildroot-2013.05.tar.bz2' saved [2893047/2893047] CLi@PC-CLI-1 ~/develop/buildroot $ ls buildroot-2013.05.tar.bz2 CLi@PC-CLI-1 ~/develop/buildroot $ ls -lha total 2.8M drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 23 16:56 ./ drwxr-xr-x+ 1 Administrators Domänen-Benutzer 0 Aug 23 16:56 ../ -rw-r--r-- 1 CLi Domänen-Benutzer 2.8M Jun 1 04:42 buildroot-2013.05.tar.bz2 CLi@PC-CLI-1 ~/develop/buildroot $ tar xjf buildroot-2013.05.tar.bz2 CLi@PC-CLI-1 ~/develop/buildroot $ ls -lha total 2.8M drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 23 16:56 ./ drwxr-xr-x+ 1 Administrators Domänen-Benutzer 0 Aug 23 16:56 ../ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 buildroot-2013.05/ -rw-r--r-- 1 CLi Domänen-Benutzer 2.8M Jun 1 04:42 buildroot-2013.05.tar.bz2 CLi@PC-CLI-1 ~/develop/buildroot $ cd buildroot-2013.05/ CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ ls -lha total 373K drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 ./ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 23 16:56 ../ -rw-r--r-- 1 CLi Domänen-Benutzer 1.3K Jun 1 04:29 .defconfig -rw-r--r-- 1 CLi Domänen-Benutzer 125 Jun 1 04:29 .gitignore drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 arch/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 board/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 boot/ -rw-r--r-- 1 CLi Domänen-Benutzer 84K Jun 1 04:29 CHANGES -rw-r--r-- 1 CLi Domänen-Benutzer 14K Jun 1 04:29 Config.in -rw-r--r-- 1 CLi Domänen-Benutzer 5.5K Jun 1 04:29 Config.in.legacy drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 configs/ -rw-r--r-- 1 CLi Domänen-Benutzer 18K Jun 1 04:29 COPYING drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:39 docs/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 fs/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 linux/ -rw-r--r-- 1 CLi Domänen-Benutzer 29K Jun 1 04:29 Makefile -rw-r--r-- 1 CLi Domänen-Benutzer 1.2K Jun 1 04:29 Makefile.legacy drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 package/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 support/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 system/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jun 1 04:29 toolchain/ CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $
7.去看看除了menuconfig,还有哪些可以配置:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ make help Cleaning: clean - delete all files created by build distclean - delete all non-source files (including .config) Build: all - make world toolchain - build toolchain <package>-rebuild - force recompile <package> <package>-reconfigure - force reconfigure <package> Configuration: menuconfig - interactive curses-based configurator nconfig - interactive ncurses-based configurator xconfig - interactive Qt-based configurator gconfig - interactive GTK-based configurator oldconfig - resolve any unresolved symbols in .config silentoldconfig - Same as oldconfig, but quietly, additionally update deps olddefconfig - Same as silentoldconfig but sets new symbols to their default value randconfig - New config with random answer to all options defconfig - New config with default answer to all options BR2_DEFCONFIG, if set, is used as input savedefconfig - Save current config as ./defconfig (minimal config) allyesconfig - New config where all options are accepted with yes allnoconfig - New config where all options are answered with no randpackageconfig - New config with random answer to package options allyespackageconfig - New config where pkg options are accepted with yes allnopackageconfig - New config where package options are answered with no Documentation: manual - build manual in HTML, split HTML, PDF and txt manual-html - build manual in HTML manual-split-html - build manual in split HTML manual-pdf - build manual in PDF manual-txt - build manual in txt manual-epub - build manual in ePub Miscellaneous: source - download all sources needed for offline-build source-check - check selected packages for valid download URLs external-deps - list external packages used legal-info - generate info about license compliance make V=0|1 - 0 => quiet build (default), 1 => verbose build make O=dir - Locate all output files in "dir", including .config arm_foundationv8_defconfig - Build for arm_foundationv8 armadeus_apf27_defconfig - Build for armadeus_apf27 armadeus_apf28_defconfig - Build for armadeus_apf28 armadeus_apf9328_defconfig - Build for armadeus_apf9328 at91rm9200df_defconfig - Build for at91rm9200df at91sam9260dfc_defconfig - Build for at91sam9260dfc at91sam9260eknf_defconfig - Build for at91sam9260eknf at91sam9261ek_defconfig - Build for at91sam9261ek at91sam9263ek_defconfig - Build for at91sam9263ek at91sam9g20dfc_defconfig - Build for at91sam9g20dfc at91sam9g45m10ek_defconfig - Build for at91sam9g45m10ek atngw100_defconfig - Build for atngw100 atstk100x_defconfig - Build for atstk100x beaglebone_defconfig - Build for beaglebone calao_qil_a9260_defconfig - Build for calao_qil_a9260 calao_snowball_defconfig - Build for calao_snowball calao_usb_a9260_defconfig - Build for calao_usb_a9260 calao_usb_a9263_defconfig - Build for calao_usb_a9263 calao_usb_a9g20_lpw_defconfig - Build for calao_usb_a9g20_lpw ea3250_defconfig - Build for ea3250 fdi3250_defconfig - Build for fdi3250 freescale_mpc8315erdb_defconfig - Build for freescale_mpc8315erdb freescale_p1010rdb_defconfig - Build for freescale_p1010rdb gnublin_defconfig - Build for gnublin integrator926_defconfig - Build for integrator926 kb9202_defconfig - Build for kb9202 mini2440_defconfig - Build for mini2440 mx53loco_defconfig - Build for mx53loco nitrogen6x_defconfig - Build for nitrogen6x openblocks_a6_defconfig - Build for openblocks_a6 pandaboard_defconfig - Build for pandaboard phy3250_defconfig - Build for phy3250 qemu_arm_nuri_defconfig - Build for qemu_arm_nuri qemu_arm_versatile_defconfig - Build for qemu_arm_versatile qemu_arm_vexpress_defconfig - Build for qemu_arm_vexpress qemu_microblazebe_mmu_defconfig - Build for qemu_microblazebe_mmu qemu_microblazeel_mmu_defconfig - Build for qemu_microblazeel_mmu qemu_mips64_malta_defconfig - Build for qemu_mips64_malta qemu_mips_malta_defconfig - Build for qemu_mips_malta qemu_mipsel_malta_defconfig - Build for qemu_mipsel_malta qemu_ppc_g3beige_defconfig - Build for qemu_ppc_g3beige qemu_ppc_mpc8544ds_defconfig - Build for qemu_ppc_mpc8544ds qemu_ppc_virtex_ml507_defconfig - Build for qemu_ppc_virtex_ml507 qemu_sh4_r2d_defconfig - Build for qemu_sh4_r2d qemu_sparc_ss10_defconfig - Build for qemu_sparc_ss10 qemu_x86_64_defconfig - Build for qemu_x86_64 qemu_x86_defconfig - Build for qemu_x86 rpi_defconfig - Build for rpi s6lx9_microboard_defconfig - Build for s6lx9_microboard sheevaplug_defconfig - Build for sheevaplug telit_evk_pro3_defconfig - Build for telit_evk_pro3 See docs/README, or generate the Buildroot manual for further details CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $
看到有很多default的配置,但是没有xscale。所以还是打算,不用那些配置了,还是自己手动一点点配置吧。
8.去menuconfig,结果立刻就可以进入界面了:
此处,先退出,但是保存.config,然后看看完整的log:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ make menuconfig mkdir -p /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" obj=/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -C support/kconfig -f Makefile.br mconf make[1]: Entering directory `/home/CLi/develop/buildroot/buildroot-2013.05/support/kconfig' /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -MM *.c > /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/.depend 2>/dev/null || : make[1]: Leaving directory `/home/CLi/develop/buildroot/buildroot-2013.05/support/kconfig' make[1]: Entering directory `/home/CLi/develop/buildroot/buildroot-2013.05/support/kconfig' /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c conf.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/conf.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c lxdialog/checklist.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/checklist.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c lxdialog/inputbox.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/inputbox.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c lxdialog/menubox.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/menubox.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c lxdialog/textbox.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/textbox.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c lxdialog/util.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/util.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c lxdialog/yesno.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/yesno.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -c mconf.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/mconf.o /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" -I. -c /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/zconf.tab.c -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/zconf.tab.o In file included from /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/zconf.tab.c:2500:0: ./confdata.c: In function ‘conf_split_config’: ./confdata.c:849:6: warning: assignment makes pointer from integer without a cast [enabled by default] /usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -DCONFIG_=\"\" /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/mconf.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/zconf.tab.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/checklist.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/util.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/inputbox.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/textbox.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/yesno.o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog/menubox.o -lncurses -o /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/mconf rm /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/zconf.tab.c make[1]: Leaving directory `/home/CLi/develop/buildroot/buildroot-2013.05/support/kconfig' configuration written to /home/CLi/develop/buildroot/buildroot-2013.05/.config *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $
9.再去一点点改配置,弄成xscale的:
【记录】Cygwin下为xscale平台去make menuconfig去配置Buildroot
10.然后就可以去make编译了。
然后,抽空可以去看看Buildroot的在线文档:
了。
11.结果就出现“/bin/sh: -c: line 0: syntax error near unexpected token `(‘”的错误了:
【已解决】Cygwin下为xscale编译BuildRoot时make出错:/bin/sh: -c: line 0: syntax error near unexpected token `(‘
12.后来又出现“./stdio.h:477:66: error: missing binary operator before token "("”的错误:
【已解决】Cygwin下make编译Buildroot出错:./stdio.h:477:66: error: missing binary operator before token "("
13.接着又出现“/usr/include/stdio_ext.h:47:1: note: previous definition of ‘__fpending’ was here ”的问题:
14.然后,接着make clean:
CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $ make clean rm -rf /home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot /home/CLi/develop/buildroot/buildroot-2013.05/output/target /home/CLi/develop/buildroot/buildroot-2013.05/output/images /home/CLi/develop/buildroot/buildroot-2013.05/output/host \ /home/CLi/develop/buildroot/buildroot-2013.05/output/stamps /home/CLi/develop/buildroot/buildroot-2013.05/output/build /home/CLi/develop/buildroot/buildroot-2013.05/output/toolchain /home/CLi/develop/buildroot/buildroot-2013.05/output/staging \ /home/CLi/develop/buildroot/buildroot-2013.05/output/legal-info CLi@PC-CLI-1 ~/develop/buildroot/buildroot-2013.05 $
后再去make,结果又遇到错误:
15.关于在Cygwin下编译buildroot,有空可以参考这位的:
Cygwin-buildroot-toolchain build(s) Finally – working.
16.然后再去折腾:
17.后来是解决了此问题了:
18.然后重新开始继续去make,即,先make clean再make,结果,竟然还是出现同样的错误:
【记录】第四次去研究:cygwin下编译buildroot在编译libtool时出错:configure: error: C compiler cannot create executables
19.最后,解决了上述问题,然后后来出现别的“libtool: Version mismatch error”的错误:
【已解决】cygwin下编译buildroot期间编译mpc时出错:libtool: Version mismatch error
20.然后继续编译,然后出现找不到kernel header的问题:
21.然后又出现“Makefile:1444: *** mixed implicit and normal rules. Stop.”的错误:
22.然后继续编译,又出现“/bin/sh: scripts/basic/fixdep: cannot execute binary file”的错误:
23.然后接着又遇到,经典的"scripts/unifdef.c:209:25: error: conflicting types for ‘getline’"的错误:
然后参考之前的:
【已解决】Ubuntu中crosstool-ng编译出错:scripts/unifdef.c:209:25: error: conflicting types for ‘getline’
去修改:
D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\output\toolchain\linux-2.6.19.1\scripts\unifdef.c
为:
//static Linetype getline(void); static Linetype get_line(void); //lineval = getline(); lineval = get_line(); static Linetype //getline(void) get_line(void)
即可。
24.等了很长时间,然后遇到错误:
25.然后又出现之前的错误:
26.然后又出现"/usr/lib/libc.a: could not read symbols: File format not recognized"的错误:
27.
【总结】