【已解决】编译crosstool-ng在Installing kernel headers时出错:/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/Makefile:1444: *** mixed implicit and normal rules. Stop.

【问题】

折腾:

【记录】编译配置好的xscale版本的crosstool-ng-1.18.0

期间,后来还是出错了:

[ALL  ]    `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/buildtools/bin/arm-xscale-linux-gnueabi-cc.exe’ -> `arm-xscale-linux-gnueabi-gcc.exe’
[INFO ]  Installing pass-1 core C compiler: done in 947.11s (at 43:56)
[EXTRA]  Saving state to restart at step ‘kernel_headers’…
[STATE]    Saving environment and aliases
[DEBUG]    Saving ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/buildtools’
[STATE]      ./
[STATE]      ./arm-xscale-linux-gnueabi/
[STATE]      ./arm-xscale-linux-gnueabi/bin/
[STATE]      ./arm-xscale-linux-gnueabi/bin/ar
[STATE]      ./arm-xscale-linux-gnueabi/bin/as
[STATE]      ./arm-xscale-linux-gnueabi/bin/gcc.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/ld
[STATE]      ./arm-xscale-linux-gnueabi/bin/ld.bfd
[STATE]      ./arm-xscale-linux-gnueabi/bin/strip
[STATE]      ./arm-xscale-linux-gnueabi/include/
[STATE]      ./arm-xscale-linux-gnueabi/lib/
[STATE]      ./bin/
[STATE]      ./bin/arm-xscale-linux-gnueabi-ar
[STATE]      ./bin/arm-xscale-linux-gnueabi-as
[STATE]      ./bin/arm-xscale-linux-gnueabi-cc.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-cpp.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-gcc-4.6.0.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-gcc.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-gcov.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-ld
[STATE]      ./bin/arm-xscale-linux-gnueabi-ld.bfd
[STATE]      ./bin/arm-xscale-linux-gnueabi-strip
[STATE]      ./bin/i686-build_pc-cygwin-ar
[STATE]      ./bin/i686-build_pc-cygwin-as
[STATE]      ./bin/i686-build_pc-cygwin-dlltool
[STATE]      ./bin/i686-build_pc-cygwin-g++
[STATE]      ./bin/i686-build_pc-cygwin-gcc
[STATE]      ./bin/i686-build_pc-cygwin-gcj
[STATE]      ./bin/i686-build_pc-cygwin-gnatbind
[STATE]      ./bin/i686-build_pc-cygwin-gnatmake
[STATE]      ./bin/i686-build_pc-cygwin-ld
[STATE]      ./bin/i686-build_pc-cygwin-nm
[STATE]      ./bin/i686-build_pc-cygwin-objcopy
[STATE]      ./bin/i686-build_pc-cygwin-objdump
[STATE]      ./bin/i686-build_pc-cygwin-ranlib
[STATE]      ./bin/i686-build_pc-cygwin-strip
[STATE]      ./bin/i686-build_pc-cygwin-windres
[STATE]      ./bin/makeinfo
[STATE]      ./include/
[STATE]      ./include/gmp.h
[STATE]      ./include/gmpxx.h
[STATE]      ./include/mp.h
[STATE]      ./include/mpc.h
[STATE]      ./include/mpf2mpfr.h
[STATE]      ./include/mpfr.h
[STATE]      ./lib/
[STATE]      ./lib/gcc/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/arm_neon.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/float.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/iso646.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/mmintrin.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/stdarg.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/stdbool.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/stddef.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/stdfix.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/stdint-gcc.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/stdint.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/unwind.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include/varargs.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include-fixed/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include-fixed/limits.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include-fixed/README
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/include-fixed/syslimits.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/fixinc_list
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/gsyslimits.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/include/
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/include/limits.h
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/include/README
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/macro_list
[STATE]      ./lib/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/mkheaders.conf
[STATE]      ./lib/libgmp.a
[STATE]      ./lib/libgmp.la
[STATE]      ./lib/libgmpxx.a
[STATE]      ./lib/libgmpxx.la
[STATE]      ./lib/libmp.a
[STATE]      ./lib/libmp.la
[STATE]      ./lib/libmpc.a
[STATE]      ./lib/libmpc.la
[STATE]      ./lib/libmpfr.a
[STATE]      ./lib/libmpfr.la
[STATE]      ./libexec/
[STATE]      ./libexec/gcc/
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/cc1.exe
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/collect2.exe
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/fixinc.sh
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/fixincl.exe
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/mkheaders
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/install-tools/mkinstalldirs
[STATE]      ./libexec/gcc/arm-xscale-linux-gnueabi/4.6.0/lto-wrapper.exe
[STATE]      ./share/
[STATE]      ./share/doc/
[STATE]      ./share/doc/mpfr/
[STATE]      ./share/doc/mpfr/AUTHORS
[STATE]      ./share/doc/mpfr/BUGS
[STATE]      ./share/doc/mpfr/COPYING
[STATE]      ./share/doc/mpfr/COPYING.LESSER
[STATE]      ./share/doc/mpfr/examples/
[STATE]      ./share/doc/mpfr/examples/divworst.c
[STATE]      ./share/doc/mpfr/examples/ReadMe
[STATE]      ./share/doc/mpfr/examples/rndo-add.c
[STATE]      ./share/doc/mpfr/examples/sample.c
[STATE]      ./share/doc/mpfr/examples/version.c
[STATE]      ./share/doc/mpfr/FAQ.html
[STATE]      ./share/doc/mpfr/NEWS
[STATE]      ./share/doc/mpfr/TODO
[STATE]      ./share/info/
[STATE]      ./share/info/cpp.info
[STATE]      ./share/info/cppinternals.info
[STATE]      ./share/info/dir
[STATE]      ./share/info/gcc.info
[STATE]      ./share/info/gccinstall.info
[STATE]      ./share/info/gccint.info
[STATE]      ./share/info/gmp.info
[STATE]      ./share/info/gmp.info-1
[STATE]      ./share/info/gmp.info-2
[STATE]      ./share/info/mpc.info
[STATE]      ./share/info/mpfr.info
[STATE]      ./share/man/
[STATE]      ./share/man/man1/
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-cpp.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-gcc.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-gcov.1
[STATE]      ./share/man/man7/
[STATE]      ./share/man/man7/fsf-funding.7
[STATE]      ./share/man/man7/gfdl.7
[STATE]      ./share/man/man7/gpl.7
[DEBUG]    Saving ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/configs’
[STATE]      ./
[DEBUG]    Saving ‘/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi’
[STATE]      ./
[STATE]      ./arm-xscale-linux-gnueabi/
[STATE]      ./arm-xscale-linux-gnueabi/bin/
[STATE]      ./arm-xscale-linux-gnueabi/bin/ar.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/as.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/ld.bfd.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/ld.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/nm.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/objcopy.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/objdump.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/ranlib.exe
[STATE]      ./arm-xscale-linux-gnueabi/bin/strip.exe
[STATE]      ./arm-xscale-linux-gnueabi/debug-root/
[STATE]      ./arm-xscale-linux-gnueabi/lib
[STATE]      ./arm-xscale-linux-gnueabi/lib32
[STATE]      ./arm-xscale-linux-gnueabi/lib64
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/lib/
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/lib32
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/lib64
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/usr/
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/usr/include/
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/usr/lib/
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/usr/lib32
[STATE]      ./arm-xscale-linux-gnueabi/sysroot/usr/lib64
[STATE]      ./bin/
[STATE]      ./bin/arm-xscale-linux-gnueabi-addr2line.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-ar.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-as.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-c++filt.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-ct-ng.config
[STATE]      ./bin/arm-xscale-linux-gnueabi-elfedit.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-gprof.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-ld.bfd.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-ld.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-nm.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-objcopy.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-objdump.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-ranlib.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-readelf.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-size.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-strings.exe
[STATE]      ./bin/arm-xscale-linux-gnueabi-strip.exe
[STATE]      ./lib/
[STATE]      ./lib/ldscripts/
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.x
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xbn
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xc
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xd
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xdc
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xdw
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xn
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xr
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xs
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xsc
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xsw
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xu
[STATE]      ./lib/ldscripts/armelfb_linux_eabi.xw
[STATE]      ./lib/ldscripts/armelf_linux_eabi.x
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xbn
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xc
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xd
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xdc
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xdw
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xn
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xr
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xs
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xsc
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xsw
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xu
[STATE]      ./lib/ldscripts/armelf_linux_eabi.xw
[STATE]      ./lib/libiberty.a
[STATE]      ./lib32
[STATE]      ./lib64
[STATE]      ./share/
[STATE]      ./share/info/
[STATE]      ./share/info/as.info
[STATE]      ./share/info/bfd.info
[STATE]      ./share/info/binutils.info
[STATE]      ./share/info/configure.info
[STATE]      ./share/info/dir
[STATE]      ./share/info/gprof.info
[STATE]      ./share/info/ld.info
[STATE]      ./share/info/standards.info
[STATE]      ./share/man/
[STATE]      ./share/man/man1/
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-addr2line.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-ar.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-as.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-c++filt.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-dlltool.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-elfedit.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-gprof.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-ld.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-nlmconv.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-nm.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-objcopy.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-objdump.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-ranlib.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-readelf.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-size.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-strings.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-strip.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-windmc.1
[STATE]      ./share/man/man1/arm-xscale-linux-gnueabi-windres.1
[STATE]    Saving log file
[INFO ]  =================================================================
[INFO ]  Installing kernel headers
[DEBUG]    Using kernel’s headers_install
[EXTRA]    Installing kernel headers
[DEBUG]    ==> Executing: ‘make’ ‘-C’ ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’ ‘O=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’
[ALL  ]    make[1]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’
[ALL  ]    make[2]: arm-xscale-linux-gnu-gcc: Command not found
[ALL  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/Makefile:1444: *** mixed implicit and normal rules.  Stop.
[ALL  ]    Makefile:119: recipe for target `headers_install’ failed
[ERROR]    make[1]: *** [headers_install] Error 2
[ALL  ]    make[1]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’
[ERROR] 
[ERROR]  >>
[ERROR]  >>  Build failed in step ‘Installing kernel headers’
[ERROR]  >>        called in step ‘(top-level)’
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_kernel_install[scripts/build/kernel/linux.sh@112]
[ERROR]  >>        called from: do_kernel_headers[scripts/build/kernel/linux.sh@91]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]

【解决过程】

1.很明显,此处是,

在编译完毕arm-xscale-linux-gnueabi工具链之后,然后在安装kernel headers出错的

[INFO ]  Installing kernel headers
[DEBUG]    Using kernel’s headers_install
[EXTRA]    Installing kernel headers
[DEBUG]    ==> Executing: ‘make’ ‘-C’ ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’ ‘O=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’
[ALL  ]    make[1]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’
[ALL  ]    make[2]: arm-xscale-linux-gnu-gcc: Command not found
[ALL  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/Makefile:1444: *** mixed implicit and normal rules.  Stop.
[ALL  ]    Makefile:119: recipe for target `headers_install’ failed
[ERROR]    make[1]: *** [headers_install] Error 2
[ALL  ]    make[1]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’

所以,貌似,至少对于交叉编译器工具链来说,是已经编译完成了。

但是此处,为何在编译期间,就会调用交叉编译器去install kernel headers,也还是有点奇怪。

2.看到:

Problems to gererate a C toolchain for a custom Linux 2.6.18

其遇到和我类似的问题:

编译mips的,用的是linux-custom,结果也是最后调用

make ARCH=mips INSTALL_HDR_PATH=... headers_install

然后出错的。但是目前也是无解。

3.此处仔细看了看错误,貌似由于是,在编译期间,用了:

‘make’ ‘-C’ ‘xxx/.build/src/linux-custom’ ‘O=xxx/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=xxx/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’

的命令,即,在make时,给了ARCH=arm,所以会去找

arm-xscale-linux-gnu-gcc

但是结果却由于本身就没有

arm-xscale-linux-gnu-gcc

当然报错找不到。

但是问题在于:

(1)在crosstoo-ng编译期间,本身就不应该调用,目标平台的的编译器,此处由于是ARCH=arm所以调用的是:

arm-xscale-linux-gnu-gcc

(2)即使要调用,也应该是,我此处的编译目标:arm-xscale-linux-gnueabi-gcc,才对。

 

4.考虑到:

此处目标是为了编译交叉工具链,即使不去做所谓的install kernel headers,也无所谓,所以,暂时去取消此设置。

取消之前,看看其解释:

.config – crosstool-NG 1.18.0 Configuration

────────────────────────────────────────────────────────────────────────────

Check installed headers

  CT_KERNEL_LINUX_INSTALL_CHECK:         
        
  If you are in doubt that installed headers are buggy, say ‘Y’

  here to have an extra check passed onto the headers.

        
  Symbol: KERNEL_LINUX_INSTALL_CHECK [=y]

  Type  : boolean                        
  Prompt: Check installed headers        
    Defined at config/kernel/linux.in.2:36

    Depends on: KERNEL_linux [=y] && !KERNEL_LINUX_USE_CUSTOM_HEADERS [=n]

    Location:

      -> Operating System

然后再去取消此选择:

uncheck check installed headers

5.然后再去重新编译ct-ng build,看看结果:

错误依旧:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build

$ ct-ng build

[INFO ]  Performing some trivial sanity checks

[INFO ]  Build started 20130731.140328

[INFO ]  Building environment variables

[EXTRA]  Preparing working directories

[EXTRA]  Installing user-supplied crosstool-NG configuration

[EXTRA]  =================================================================

[EXTRA]  Dumping internal crosstool-NG configuration

[EXTRA]    Building a toolchain for:

[EXTRA]      build  = i686-pc-cygwin

[EXTRA]      host   = i686-pc-cygwin

[EXTRA]      target = arm-xscale-linux-gnueabi

[EXTRA]  Dumping internal crosstool-NG configuration: done in 0.90s (at 00:54)

[INFO ]  =================================================================

[INFO ]  Retrieving needed toolchain components’ tarballs

[EXTRA]    Using ‘linux-custom’ from custom location

[INFO ]  Retrieving needed toolchain components’ tarballs: done in 3.15s (at 00:57)

[INFO ]  =================================================================

[INFO ]  Extracting and patching toolchain components

[INFO ]  Extracting and patching toolchain components: done in 8.45s (at 01:06)

[EXTRA]  Saving state to restart at step ‘libc_check_config’…

[EXTRA]  Saving state to restart at step ‘companion_libs_for_build’…

[EXTRA]  Saving state to restart at step ‘binutils_for_build’…

[EXTRA]  Saving state to restart at step ‘companion_libs_for_host’…

[INFO ]  =================================================================

[INFO ]  Installing GMP for host

[EXTRA]    Configuring GMP

[EXTRA]    Building GMP

[EXTRA]    Installing GMP

[INFO ]  Installing GMP for host: done in 501.29s (at 09:32)

[INFO ]  =================================================================

[INFO ]  Installing MPFR for host

[EXTRA]    Configuring MPFR

[EXTRA]    Building MPFR

[EXTRA]    Installing MPFR

[INFO ]  Installing MPFR for host: done in 236.76s (at 13:29)

[INFO ]  =================================================================

[INFO ]  Installing MPC for host

[EXTRA]    Configuring MPC

[EXTRA]    Building MPC

[EXTRA]    Installing MPC

[INFO ]  Installing MPC for host: done in 121.25s (at 15:31)

[EXTRA]  Saving state to restart at step ‘binutils_for_host’…

[INFO ]  =================================================================

[INFO ]  Installing binutils for host

[EXTRA]    Configuring binutils

[EXTRA]    Building binutils

[EXTRA]    Installing binutils

[INFO ]  Installing binutils for host: done in 654.77s (at 26:27)

[EXTRA]  Saving state to restart at step ‘cc_core_pass_1’…

[INFO ]  =================================================================

[INFO ]  Installing pass-1 core C compiler

[EXTRA]    Configuring gcc

[EXTRA]    Building gcc

[EXTRA]    Installing gcc

[INFO ]  Installing pass-1 core C compiler: done in 978.00s (at 42:49)

[EXTRA]  Saving state to restart at step ‘kernel_headers’…

[INFO ]  =================================================================

[INFO ]  Installing kernel headers

[EXTRA]    Installing kernel headers

[ERROR]    make[1]: *** [headers_install] Error 2

[ERROR]

[ERROR]  >>

[ERROR]  >>  Build failed in step ‘Installing kernel headers’

[ERROR]  >>        called in step ‘(top-level)’

[ERROR]  >>

[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]

[ERROR]  >>        called from: do_kernel_install[scripts/build/kernel/linux.sh@112]

[ERROR]  >>        called from: do_kernel_headers[scripts/build/kernel/linux.sh@91]

[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]


Current command:

  ‘make’ ‘-C’ ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’ ‘O=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’

exited with error code: 2

Please fix it up and finish by exiting the shell with one of these values:

    1  fixed, continue with next build command

    2  repeat this build command

    3  abort build

ct-ng:~/develop/crosstool-ng/crosstool-ng-1.18.0_build>

即,此处没有取消掉安装kernel头文件。

6.然后再去找对应的脚本的路径:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\crosstool-ng\crosstool-ng-1.18.0\scripts\build\kernel\linux.sh

中的112行前后的内容是:

# Install kernel headers using headers_install from kernel sources.
do_kernel_install() {
    local kernel_path

    CT_DoLog DEBUG "Using kernel's headers_install"

    mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"

    kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
    if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
        kernel_path="${CT_SRC_DIR}/linux-custom"
    fi
    V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"

    CT_DoLog EXTRA "Installing kernel headers"
    CT_DoExecLog ALL                                    \
    make -C "${kernel_path}"                            \
         O="${CT_BUILD_DIR}/build-kernel-headers"       \
         ARCH=${CT_ARCH}                                \
         INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
         ${V_OPT}                                       \
         headers_install

    if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
        CT_DoLog EXTRA "Checking installed headers"
        CT_DoExecLog ALL                                    \
        make -C "${kernel_path}"                            \
             O="${CT_BUILD_DIR}/build-kernel-headers"       \
             ARCH=${CT_ARCH}                                \
             INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
             ${V_OPT}                                       \
             headers_check
    fi

很明显,此处的log的:

[DEBUG]    ==> Executing: ‘make’ ‘-C’ ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’ ‘O=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’

是对应的:

    make -C "${kernel_path}"                            \
         O="${CT_BUILD_DIR}/build-kernel-headers"       \
         ARCH=${CT_ARCH}                                \
         INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"       \
         ${V_OPT}                                       \
         headers_install

产生的。

但是由于ARCH=arm而使得调用了arm-xscale-linux-gnu的gcc,结果找不到,而报错。

7.参考:

交叉编译链、qt 、qt embedded的安装

去找到log是:

[INFO ]  Installing kernel headers

[DEBUG]    Using kernel’s headers_install

[EXTRA]    Installing kernel headers

[DEBUG]    ==> Executing: ‘make’ ‘-C’ ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’ ‘O=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’

[ALL  ]    make[1]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’

[ALL  ]    make[2]: arm-xscale-linux-gnu-gcc: Command not found

[ALL  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/Makefile:1444: *** mixed implicit and normal rules.  Stop.

然后找到对应的Makefile:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\crosstool-ng\crosstool-ng-1.18.0_build\.build\src\linux-custom\Makefile

中的1444行:

# Modules
/ %/: prepare scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
	$(build)=$(build-dir)

换为:

# Modules
#/ %/: prepare scripts FORCE
%/: prepare scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
	$(build)=$(build-dir)

再去编译试试。

8.后来,好像看到了此处问题的根本原因和解决办法:

实际上错误是:

mixed implicit and normal rules

然后对此,已经有人:

Build Failure for PPC405 using crosstool-ng 1.9.2

fedora14下利用crosstool-ng-1.18.0创建arm-linux交叉编译环境

给出解决办法是:

把make从当前3.82换成旧的3.81

Maybe build 3.81 and install it to ${HOME}/make

and add:

export PATH="${HOME}/make/bin:$PATH"

等上面编译再次出错的话,再去这么换make。

9.后来,再搜:

crosstool-ng mixed implicit and normal rules. Stop.

时,都找到了crosstool-ng的官网的patch和解释了:

docs/known-issues: add the infamous "mixed implicit and normal rules"

此处专门去确认了一下当前cygwin下使用的make:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ make -v
GNU Make 3.82.90
Built for i686-pc-cygwin
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

的确是3.82的。

此问题的解决办法是:

方法1:

针对此项编译,指定crosstool-ng使用3.81的make,即选上:

Paths and misc options  —>

    [*] Try features marked as EXPERIMENTAL

Companion tools  —>

    [*] Build some companion tools

    [*]   make

方法2:

如前所述,手动安装3.81的make。

暂时还是那句:

等上述编译完毕看看是否出错,如果出错再去选上上面的选项。

如果已经解决了,那么就暂时,通过修改makefile,没有换make而解决问题。

10。再后来,其实看到了,之前就看到的,这里:

[ALL ] Makefile:245: *** mixed implicit and normal rules. Stop.

的讨论,也说明了此问题的原因和解决办法,和上面的官网人家提交的patch,是一样的,都是换make。

另外,这里也有个类似的讨论:

all the errors i’ve been getting now are "Makefile:240: *** mixed implicit and normal rules. Stop." even though I’m using make-3.80

11.后来参考:

http://www.filewatcher.com/p/crosstool-ng-1.13.4.tar.bz2.1875711/crosstool-ng-1.13.4/docs/B%20-%20Known%20issues.txt.html

而找到本地的1.18.0的:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\crosstool-ng\crosstool-ng-1.18.0\docs\B – Known issues.txt

也看到对应的解释了:

——————————–

Symptoms:

  glibc start files and headers fail with: [/usr/include/limits.h] Error 1

Explanations:

  Old glibc (and eglibc) Makefiles break with make-3.82.

Status:

  CURRENT

Fix:

  None so far. It would require some glibc/eglibc hacking.

Workaround:

  There two possible workarounds:

  1- ask crosstool-NG to build make-3.81 just for this build session:

     Select the following options:

        Paths and misc options  —>

            [*] Try features marked as EXPERIMENTAL

        Companion tools  —>

            [*] Build some companion tools

            [*]   make

  2- manually install make-3.81 to take precedence over the system make.

——————————–

Symptoms:

  The build fails with "mixed implicit and normal rules. Stop."

Explanations:

  Old glibc (and eglibc) Makefiles break with make-3.82.

Status:

  CURRENT

Fix:

  None so far. See above issue.

Workaround:

  See above issue.

结果编译了半天,终于解决此处的错误了。

 

【总结】

在crosstool-ng的Installing kernel headers阶段,出现:

[DEBUG]    ==> Executing: ‘make’ ‘-C’ ‘/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’ ‘O=/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers’ ‘ARCH=arm’ ‘INSTALL_HDR_PATH=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr’ ‘V=0’ ‘headers_install’

[ALL  ]    make[1]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom’

[ALL  ]    make[2]: arm-xscale-linux-gnu-gcc: Command not found

[ALL  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/Makefile:1444: *** mixed implicit and normal rules.  Stop.

[ALL  ]    Makefile:119: recipe for target `headers_install’ failed

的错误时,实际上:

arm-xscale-linux-gnu-gcc: Command not found

的错误,不影响继续编译的。

而真正影响编译,而停止的,是:

mixed implicit and normal rules.  Stop.

的错误。

其根本原因是:

make,是新版3.82,不支持如下的语法:

# Modules
%/: prepare scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
	$(build)=$(build-dir)

中的:

/ %/: prepare scripts FORCE

前者/的是显式(explicit)的,而后者%/是隐式(implicit)的,而3.82版的make不支持显式和隐式混用。

而之前的3.81版本的make是支持的。

所以解决办法是:

方法1:

直接手动改makefile里面的对应的代码。

比如我这里的,把:

# Modules
%/: prepare scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
	$(build)=$(build-dir)

改为:

# Modules
#/ %/: prepare scripts FORCE
%/: prepare scripts FORCE
	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
	$(build)=$(build-dir)

即可。

 

方法2:

让crosstool-ng用3.81版本的make去编译,做法是:

编译选项里面,选上:

Paths and misc options  —>

    [*] Try features marked as EXPERIMENTAL

Companion tools  —>

    [*] Build some companion tools

    [*]   make

 

方法3:

自己手动编译一个3.81的make,然后替换掉当前的3.82的make。

比如:

编译一个3.81的make后,去:

export PATH="${HOME}/make/bin:$PATH"

而使得之后(crosstool-ng编译的时候,调用系统的make的时候)优先找到的是你的自己的那个3.81的make。


此处解决了此问题,但是后来编译又出现别的错误:

【未解决】crosstool-ng在Installing kernel headers时出错:[ERROR] /xxx/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts/unifdef.c:209:25: error: conflicting types for ‘getline’



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量