【背景】
之前已经,在win7 x64+cygwin下,用crosstool-ng-1.9.3,为xscale去配置和编译。
但是,遇到一些问题:
以及,当时选了gmp:
gmp编译很耗时间。
而后来是发现,最新版本的crosstool-ng,其实是1.18.0,所以,打算:
(1)重新用最新的1.18.0的crosstool-ng,去为xscale编译。
(2)并且不选择,我此处不太常用的,gmp等库。
(3)并且后来已知自己的linux用的是:linux-2.6.19.1.tar.bz2,所以到时候选择linux的时候,也要手动设置为linux-2.6.19.1(而不用最新的linux 3.0的版本)
【折腾过程】
1.下载:crosstool-ng-1.18.0.tar.bz2
然后在cygwin下解压:
CLi@PC-CLI-1 ~/develop/crosstool-ng $ tar xvf crosstool-ng-1.18.0.tar
2.再先去把之前的
crosstool-ng\x-tools
下面的东西(文件夹arm-xscale-linux-gnueabi),都清空。
3.在:
D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\crosstool-ng
下新建一个文件夹:
CLi@PC-CLI-1 ~/develop/crosstool-ng $ mkdir crosstool-ng-1.18.0_build
4.然后继续参考:
【记录】在Cygwin下编译gcc-3.4.5-glibc-2.3.6的arm-xscale-linux-gnu交叉编译器
去操作。
先尝试去之前的crosstool-ng-1.9.3下面,看看能否卸载,结果是可以的:
CLi@PC-CLI-1 ~/develop/crosstool-ng $ ls -l total 19144 drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Feb 1 04:07 crosstool-ng-1.18.0 -rwxr-xr-x 1 Administrators Domänen-Benutzer 10106880 Jul 24 14:52 crosstool-ng-1.18.0.tar drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jul 24 14:55 crosstool-ng-1.18.0_build drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jul 22 17:21 crosstool-ng-1.9.3 -rwxr-xr-x 1 Administrators Domänen-Benutzer 9472000 Jul 22 17:08 crosstool-ng-1.9.3.tar drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jul 24 14:16 crosstool-ng-1.9.3_build drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jul 24 14:52 src drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Jul 24 14:55 x-tools CLi@PC-CLI-1 ~/develop/crosstool-ng $ cd crosstool-ng-1.9.3 CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3 $ ct-ng help This is crosstool-NG version 1.9.3 Copyright (C) 2008 Yann E. MORIN <[email protected]> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See below for a list of available actions, listed by category: Configuration actions: menuconfig - Update current config using a menu based program oldconfig - Update current config using a provided .config as base extractconfig - Extract to stdout the configuration items from a build.log file piped to stdin saveconfig - Save current config as a preconfigured target show-tuple - Print the tuple of the currently configured toolchain Preconfigured toolchains (#: force number of // jobs): list-samples - prints the list of all samples (for scripting) show-<sample> - show a brief overview of <sample> (list with list-samples) <sample> - preconfigure crosstool-NG with <sample> (list with list-samples) build-all[.#] - Build *all* samples (list with list-samples) and install in ${CT_PREFIX} (which you must set) Build actions (#: force number of // jobs): build[.#] - Build the currently configured toolchain list-steps - List all build steps Clean actions: clean - Remove generated files distclean - Remove generated files, configuration and build directories Distribution actions: wiki-samples - Print a DokuWiki table of samples updatetools - Update the config tools tarball - Build a tarball of the configured toolchain Environement variables (see /opt/crosstool-ng/share/doc/ct-ng-1.9.3/0 - Table of content.txt): STOP=step - Stop the build just after this step (list with list-steps) RESTART=step - Restart the build just before this step (list with list-steps) CT_PREFIX=dir - install samples in dir (see action "build-all", above). V=0|1|2 - 0 => show only human-readable messages (default) 1 => show only the commands being executed 2 => show both Use action "menuconfig" to configure your toolchain Use action "build" to build your toolchain Use action "version" to see the version See "man 1 ct-ng" for some help as well CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3 $ make uninstall RM '/opt/crosstool-ng/bin/ct-ng' RMDIR '/opt/crosstool-ng/lib/ct-ng-1.9.3/' RMDIR '/opt/crosstool-ng/share/doc/ct-ng-1.9.3/' RM '/opt/crosstool-ng/share/man/ct-ng.1.gz'
5.再去新的路径下去配置:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3 $ cd ../crosstool-ng-1.18.0 CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ ./configure --prefix=/opt/crosstool-ng checking build system type... i686-pc-cygwin checking host system type... i686-pc-cygwin checking for a BSD-compatible install... /usr/bin/install -c checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking whether sed understands -r -i -e... yes checking whether ln -s works... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for ranlib... ranlib checking for objcopy... objcopy checking for absolute path to objcopy... /usr/bin/objcopy checking for objdump... objdump checking for absolute path to objdump... /usr/bin/objdump checking for readelf... readelf checking for absolute path to readelf... /usr/bin/readelf checking for bison... bison checking for flex... flex checking for gperf... gperf checking for makeinfo... makeinfo checking for cut... cut checking for stat... stat checking for readlink... readlink checking for wget... wget checking for tar... tar checking for gzip... gzip checking for bzip2... bzip2 checking for patch... /usr/bin/patch checking for bash >= 3.1... /usr/bin/bash checking for GNU awk... /usr/bin/awk checking for GNU make >= 3.80... /usr/bin/make checking whether /usr/bin/make sets $(MAKE)... yes checking for GNU libtool >= 1.5.26... /usr/bin/libtool checking for GNU libtoolize >= 1.5.26... /usr/bin/libtoolize checking for GNU automake >= 1.10... /usr/bin/automake checking for xz... xz checking for cvs... cvs checking for svn... svn checking for inline... inline checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible realloc... yes checking for working alloca.h... yes checking for alloca... yes checking libintl.h usability... yes checking libintl.h presence... yes checking for libintl.h... yes checking whether gettext is declared... yes checking ncurses/ncurses.h usability... yes checking ncurses/ncurses.h presence... yes checking for ncurses/ncurses.h... yes checking for library containing initscr... -lncursesw configure: creating ./config.status config.status: creating Makefile
6.再去make,结果还出错了:
7.然后接着去make install:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ make install GEN 'config/configure.in' GEN 'paths.mk' GEN 'paths.sh' INST 'ct-ng' RMDIR '/opt/crosstool-ng/lib/ct-ng.1.18.0/' MKDIR '/opt/crosstool-ng/lib/ct-ng.1.18.0/' INSTDIR 'config/' INSTDIR 'contrib/' INSTDIR 'patches/' INSTDIR 'scripts/' INST 'steps.mk' INST 'paths' INSTDIR 'samples/' INST 'kconfig/' MKDIR '/opt/crosstool-ng/share/doc/crosstool-ng/ct-ng.1.18.0/' INST 'docs/*.txt' INST 'ct-ng.1.gz' For auto-completion, do not forget to install 'ct-ng.comp' into your bash completion directory (usually /etc/bash_completion.d)
8.由于路径:
/opt/crosstool-ng/bin |
已经加过了,所以关闭cygwin,重新打开。
然后就可以了:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ ct-ng help This is crosstool-NG version 1.18.0 Copyright (C) 2008 Yann E. MORIN <[email protected]> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See below for a list of available actions, listed by category: Configuration actions: menuconfig - Update current config using a menu based program oldconfig - Update current config using a provided .config as base extractconfig - Extract to stdout the configuration items from a build.log file piped to stdin defconfig - Save current config as a mini-defconfig to ${CONFIG} olddefconfig - Update config from a mini-defconfig ${CONFIG} (default: ${CONFIG}=./defconfig) saveconfig - Save current config as a preconfigured target show-tuple - Print the tuple of the currently configured toolchain Preconfigured toolchains (#: force number of // jobs): list-samples - prints the list of all samples (for scripting) show-<sample> - show a brief overview of <sample> (list with list-samples) <sample> - preconfigure crosstool-NG with <sample> (list with list-samples) build-all[.#] - Build *all* samples (list with list-samples) and install in ${CT_PREFIX} (which you must set) Build actions (#: force number of // jobs): build[.#] - Build the currently configured toolchain list-steps - List all build steps Clean actions: clean - Remove generated files distclean - Remove generated files, configuration and build directories Distribution actions: wiki-samples - Print a DokuWiki table of samples updatetools - Update the config tools tarball - Build a tarball of the configured toolchain Environment variables (see /opt/crosstool-ng/share/doc/crosstool-ng/ct-ng.1.18.0/0 - Table of content.txt): STOP=step - Stop the build just after this step (list with list-steps) RESTART=step - Restart the build just before this step (list with list-steps) CT_PREFIX=dir - install samples in dir (see action "build-all", above). V=0|1|2 - 0 => show only human-readable messages (default) 1 => show only the commands being executed 2 => show both Use action "menuconfig" to configure your toolchain Use action "build" to build your toolchain Use action "version" to see the version See "man 1 ct-ng" for some help as well
的确是1.18.0的最新版本了。
9.再去看看当前所内置的sample:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ ct-ng list-samples Status Sample name MKDIR config.gen IN config.gen/arch.in IN config.gen/kernel.in IN config.gen/cc.in IN config.gen/binutils.in IN config.gen/libc.in IN config.gen/debug.in [L.X] alphaev56-unknown-linux-gnu [L.X] alphaev67-unknown-linux-gnu [L.X] arm-bare_newlib_cortex_m3_nommu-eabi [L.X] arm-cortex_a15-linux-gnueabi [L..] arm-cortex_a8-linux-gnueabi [L..] arm-davinci-linux-gnueabi [L..] armeb-unknown-eabi [L.X] armeb-unknown-linux-gnueabi [L.X] armeb-unknown-linux-uclibcgnueabi [L..] arm-unknown-eabi [L..] arm-unknown-linux-gnueabi [L.X] arm-unknown-linux-uclibcgnueabi [L.X] armv6-rpi-linux-gnueabi [L.X] avr32-unknown-none [L..] bfin-unknown-linux-uclibc [L..] i586-geode-linux-uclibc [L.X] i586-mingw32msvc,i686-none-linux-gnu [L.X] i686-nptl-linux-gnu [L.X] i686-unknown-mingw32 [L.X] m68k-unknown-elf [L.X] m68k-unknown-uclinux-uclibc [L.X] mips64el-n32-linux-uclibc [L.X] mips64el-n64-linux-uclibc [L.X] mips-ar2315-linux-gnu [L..] mipsel-sde-elf [L..] mipsel-unknown-linux-gnu [L.X] mips-malta-linux-gnu [L..] mips-unknown-elf [L.X] mips-unknown-linux-uclibc [L..] powerpc-405-linux-gnu [L.X] powerpc64-unknown-linux-gnu [L..] powerpc-860-linux-gnu [L.X] powerpc-e300c3-linux-gnu [L.X] powerpc-e500v2-linux-gnuspe [L..] powerpc-unknown_nofpu-linux-gnu [L..] powerpc-unknown-linux-gnu [L..] powerpc-unknown-linux-uclibc [L.X] s390-ibm-linux-gnu [L.X] s390x-ibm-linux-gnu [L..] sh4-unknown-linux-gnu [L..] x86_64-unknown-linux-gnu [L..] x86_64-unknown-linux-uclibc [L.X] x86_64-unknown-mingw32 L (Local) : sample was found in current directory G (Global) : sample was installed with crosstool-NG X (EXPERIMENTAL): sample may use EXPERIMENTAL features B (BROKEN) : sample is currently broken
再去看看其arm-cortex_a8-linux-gnueabi的配置:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ ct-ng show-arm-cortex_a8-linux-gnueabi IN config.gen/arch.in IN config.gen/kernel.in IN config.gen/cc.in IN config.gen/binutils.in IN config.gen/libc.in [L..] arm-cortex_a8-linux-gnueabi OS : linux-3.7.3 Companion libs : gmp-4.3.2 mpfr-2.4.2 ppl-0.10.2 cloog-ppl-0.15.9 libelf-0.8.13 binutils : binutils-2.20.1a C compiler : gcc-4.4.6 (C,C++) C library : glibc-2.9 (threads: nptl) Tools : dmalloc-5.5.2 duma-2_5_15 gdb-6.8a ltrace-0.5.3 strace-4.5.19
10.还是先切换到build目录:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ cd ../crosstool-ng-1.18.0_build/
再去用该配置:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0 $ cd ../crosstool-ng-1.18.0_build/ CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $ ct-ng arm-cortex_a8-linux-gnueabi LN config MKDIR config.gen IN config.gen/arch.in IN config.gen/kernel.in IN config.gen/cc.in IN config.gen/binutils.in IN config.gen/libc.in IN config.gen/debug.in CONF config/config.in # # configuration saved # *********************************************************** Initially reported by: Yann E. MORIN URL: http://ymorin.is-a-geek.org/ *********************************************************** Now configured for "arm-cortex_a8-linux-gnueabi"
11.然后接着就是去配置了:
【记录】crosstool-ng-1.18.0中配置xscale
12.配置完毕后,就可以去编译了:
【记录】编译配置好的xscale版本的crosstool-ng-1.18.0
13.编译完成后,再去参考官网http://www.crosstool-ng.org/去把路径加到path中。
加之前,先去看看对应的路径下面的生成的交叉编译器:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $ ls .build/ .config.2 build.log config.gen/ .config .config.old config/ crosstool_ng_1_18_0_for_xscale.config CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $ ls ../x-tools/arm-xscale-linux-gnueabi/bin -la total 16329 dr-xr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 1 15:37 . dr-xr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 1 15:38 .. -r-xr-xr-x 1 CLi Domänen-Benutzer 553486 Aug 1 15:37 arm-xscale-linux-gnueabi-addr2line.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 577550 Aug 1 15:37 arm-xscale-linux-gnueabi-ar.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 1001486 Aug 1 15:37 arm-xscale-linux-gnueabi-as.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 266766 Aug 1 15:37 arm-xscale-linux-gnueabi-c++.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 551950 Aug 1 15:37 arm-xscale-linux-gnueabi-c++filt.exe lrwxrwxrwx 1 CLi Domänen-Benutzer 32 Aug 1 13:16 arm-xscale-linux-gnueabi-cc.exe -> arm-xscale-linux-gnueabi-gcc.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 265230 Aug 1 15:37 arm-xscale-linux-gnueabi-cpp.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 3311 Jul 31 17:15 arm-xscale-linux-gnueabi-ct-ng.config -r-xr-xr-x 1 CLi Domänen-Benutzer 25614 Aug 1 15:37 arm-xscale-linux-gnueabi-elfedit.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 266766 Aug 1 15:37 arm-xscale-linux-gnueabi-g++.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 264206 Aug 1 15:37 arm-xscale-linux-gnueabi-gcc.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 264206 Aug 1 15:37 arm-xscale-linux-gnueabi-gcc-4.6.0.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 30222 Aug 1 15:37 arm-xscale-linux-gnueabi-gcov.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 2422286 Aug 1 15:37 arm-xscale-linux-gnueabi-gdb.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 2422286 Aug 1 15:37 arm-xscale-linux-gnueabi-gdbtui.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 613902 Aug 1 15:37 arm-xscale-linux-gnueabi-gprof.exe -r-xr-xr-x 4 CLi Domänen-Benutzer 995342 Aug 1 15:37 arm-xscale-linux-gnueabi-ld.bfd.exe -r-xr-xr-x 4 CLi Domänen-Benutzer 995342 Aug 1 15:37 arm-xscale-linux-gnueabi-ld.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 10517 Aug 1 15:37 arm-xscale-linux-gnueabi-ldd -r-xr-xr-x 2 CLi Domänen-Benutzer 562702 Aug 1 15:37 arm-xscale-linux-gnueabi-nm.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 709134 Aug 1 15:37 arm-xscale-linux-gnueabi-objcopy.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 865806 Aug 1 15:37 arm-xscale-linux-gnueabi-objdump.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 10431 Aug 1 15:37 arm-xscale-linux-gnueabi-populate -r-xr-xr-x 2 CLi Domänen-Benutzer 577550 Aug 1 15:37 arm-xscale-linux-gnueabi-ranlib.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 309262 Aug 1 15:37 arm-xscale-linux-gnueabi-readelf.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 555022 Aug 1 15:37 arm-xscale-linux-gnueabi-size.exe -r-xr-xr-x 1 CLi Domänen-Benutzer 553998 Aug 1 15:37 arm-xscale-linux-gnueabi-strings.exe -r-xr-xr-x 2 CLi Domänen-Benutzer 709134 Aug 1 15:37 arm-xscale-linux-gnueabi-strip.exe CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $ cd ../x-tools/arm-xscale-linux-gnueabi/bin CLi@PC-CLI-1 ~/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin $ pwd /home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin
对应的是:
去修改对应的.bashrc:
D:\tmp\tmp_dev_root\cgwin\home\CLi\.bashrc
把路径加上去,把:
PATH=$PATH:/opt/crosstool-ng/bin
改为:
#PATH=$PATH:/opt/crosstool-ng/bin PATH=$PATH:$HOME/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin:/opt/crosstool-ng/bin
14.再去重启cygwin,然后试试,果然可以找到了arm-xscale-linux-gnueabi-gcc:
CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $ arm-xscale-linux-gnueabi-gcc -v Using built-in specs. COLLECT_GCC=arm-xscale-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/lto-wrapper.exe Target: arm-xscale-linux-gnueabi Configured with: /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/gcc-4.6.0/configure --build=i686-build_pc-cygwin --host=i686-build_pc-cygwin --target=arm-xscale-linux-gnueabi --prefix=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi --with-sysroot=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot --enable-languages=c,c++ --with-arch=armv5te --with-cpu=xscale --with-tune=xscale --with-float=softfp --with-pkgversion='crosstool-NG 1.18.0' --disable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/buildtools --with-mpfr=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/buildtools --with-mpc=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/buildtools --with-ppl=no --with-cloog=no --with-libelf=no --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --disable-nls --disable-multilib --with-local-prefix=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot --enable-c99 --enable-long-long Thread model: posix gcc version 4.6.0 (crosstool-NG 1.18.0) CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $ which arm-xscale-linux-gnueabi-gcc /home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-gcc CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build $
剩下的,就是用此交叉编译器,去编译别的代码了。
【总结】
在cygwin下,编译crosstool-ng,真心不容易。
转载请注明:在路上 » 【记录】重试使用最新版本1.18.0的crosstool-ng去配置和编译xscale的交叉编译器