5.2.1.5. Makefile:240: *** mixed implicit and normal rules. Stop.

错误现象:

cygwin下ct-ng build去编译crosstool-ng出现:


CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ ct-ng build
......
[INFO ]  Installing kernel headers: done in 1854.80s (at 72:22)
[EXTRA]  Saving state to restart at step 'libc_start_files'...
[INFO ]  =================================================================
[INFO ]  Installing C library headers & start files
[EXTRA]    Configuring C library
[EXTRA]    Installing C library headers
[ERROR]    make[2]: *** [manual/install-headers] Error 2
[ERROR]    make[1]: *** [install-headers] Error 2
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing C library headers & start files'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@380]
[ERROR]  >>        called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143]
[ERROR]  >>        called from: do_libc_start_files[scripts/build/libc/glibc-eglibc.sh-common@60]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]
......

            

对应build.log中的详细内容为:


[ALL  ]    make[3]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9/gnulib'
[ALL  ]    make[3]: `install-headers' is up to date.
[ALL  ]    make[3]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9/gnulib'
[ALL  ]    /usr/bin/make  subdir=wctype -C wctype ..=../ install-headers
[ALL  ]    make[3]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9/wctype'
[ALL  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/tools/bin/install -c -m 644 wctype.h /home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr/include/wctype.h
[ALL  ]    make[3]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9/wctype'
[ALL  ]    /usr/bin/make  subdir=manual -C manual ..=../ install-headers
[ALL  ]    make[3]: Entering directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9/manual'
[ALL  ]    Makefile:240: *** mixed implicit and normal rules.  Stop.
[ALL  ]    make[3]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9/manual'
[ALL  ]    Makefile:207: recipe for target `manual/install-headers' failed
[ERROR]    make[2]: *** [manual/install-headers] Error 2
[ALL  ]    make[2]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/glibc-2.9'
[ALL  ]    Makefile:12: recipe for target `install-headers' failed
[ERROR]    make[1]: *** [install-headers] Error 2
[ALL  ]    make[1]: Leaving directory `/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-libc-startfiles'
[ERROR]  
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing C library headers & start files'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@380]
[ERROR]  >>        called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143]
[ERROR]  >>        called from: do_libc_start_files[scripts/build/libc/glibc-eglibc.sh-common@60]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]

            

原因:

make是3.82的,不识别,旧的,显示和隐式的规则混合在一起的混合规则

所以才报此错误。

解决办法:

而这种makefile中混合规则,老版本的make,即3.81版本的make,是支持的。

所以,总的来说,有两种解决办法:

5.2.1.5.1. 手动修改每个Makefile中对应的混合规则->使得3.82的make可以识别

很明显此办法,的确可以解决此类问题。

比如我之前这里:

【已解决】编译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.

就是这样手工改makefile的。

但是此办法的缺点是:

crosstool-ng项目中,涉及到这种混合规则的Makefile中的写法,有N多个

如果你要是每个都手动改,那就累死了。

并且需要你对Makefile的语法和规则,有足够深入的理解,也才能确保修改为正确的写法

所以:

此法,不适合,本身对于Makefile就不是很熟悉的,大部分的人

更好的办法是,下面要介绍的这个第 5.2.1.5.2 节 “把3.82的make换成3.81版本的make”把此处3.82的make想办法换成3.81版本的make,就可以了。

5.2.1.5.2. 把3.82的make换成3.81版本的make

此法,很明显,属于:一劳永逸的办法

把make换成3.81的,之前的makefile中,N多处的混合规则,就不用手动修改,即可识别,正常编译了。

对应的,把3.82的make,换成3.81的make,其实也有两种办法:

5.2.1.5.2.1. 把你当前的(Linux或Cygwin等)系统环境中的3.82的make换成3.81的make

此法,也是我之前,在Cygwin中折腾crosstool-ng时,去尝试过的:

【已解决】Cygwin下配置Linux内核出错:Makefile:419: *** mixed implicit and normal rules. Stop.

但是很明显,此法,代价太大:

使得整个系统中的make,都从3.82降级到3.81了。

总的来说,也不算好事。

并且,像是Cygwin中,去更换某个版本的软件包的话,相对来说,还比较麻烦。

而Linux系统,比如Ubuntu中,如果你用的源中没有3.81的make的话,还涉及到先换源

总之,就是很麻烦。

所以,一般来说,都还是用下面介绍的这个更好的办法:

第 5.2.1.5.2.2 节 “用crosstool-ng中提供的3.81的make(而不用更换系统环境中的3.82的make)”

5.2.1.5.2.2. 用crosstool-ng中提供的3.81的make(而不用更换系统环境中的3.82的make)

最终,后来通过:

【已解决】crosstool-ng在Installing C library headers & start files期间出错:Makefile:240: *** mixed implicit and normal rules. Stop.

而去通过更改crosstool-ng中的配置,得以实现:

直接使用crosstool-ng中提供的那个3.81的make

而实现:

不仅解决了此处的问题:

Makefile:xxx: *** mixed implicit and normal rules. Stop.

而且,无需更改当前系统的3.82的make

也无需去手动更改出错的每一个makefile了。

对应的做法是:

ct-ng menuconfig

去如下配置:


Paths and misc options  —>
    [*] Try features marked as EXPERIMENTAL
Companion tools  —>
    [*] Build some companion tools
    [*]   make

                    

Try features marked as EXPERIMENTAL对应的help帮助内容为:


  ┌───────────────────────── Try features marked as EXPERIMENTAL ─────────────────────────┐
  │ CT_EXPERIMENTAL:                                                                      │
  │                                                                                       │
  │ If you set this to Y, then you will be able to try very experimental                  │
  │ features.                                                                             │
  │                                                                                       │
  │ Experimental features can be one of:                                                  │
  │   - working, in which case you should tell me it is!                                  │
  │   - buggy, in which case you could try patching and send me the result                │
  │   - unfinished, in which case you could try hacking it and send me the result         │
  │   - non-existant, in which case you could also try hacking it in and send me          │
  │     the result                                                                        │
  │                                                                                       │
  │ Symbol: EXPERIMENTAL [=y]                                                             │
  │ Type  : boolean                                                                       │
  │ Prompt: Try features marked as EXPERIMENTAL                                           │
  │   Defined at config/global/ct-behave.in:18                                            │
  │   Location:                                                                           │
  │     -> Paths and misc options                                                         │

                    

以及:

Build some companion tools对应的help帮助内容为:


  ┌───────────────────────────── Build some companion tools ──────────────────────────────┐
  │ CT_COMP_TOOLS:                                                                        │
  │                                                                                       │
  │ Crosstool-NG relies on some external tools to be recent enough, namely:               │
  │   make = 3.81 (in some cases)                                                         │
  │   m4 >= 1.4.12                                                                        │
  │   autoconf >= 2.63                                                                    │
  │   automake >= 1.10.2                                                                  │
  │   libtool >= 2.2.4                                                                    │
  │                                                                                       │
  │ If your system has older versions, we can build them for you,                         │
  │ but you are strongly encouraged to update your system instead!                        │
  │                                                                                       │
  │ Symbol: COMP_TOOLS [=y]                                                               │
  │ Type  : boolean                                                                       │
  │ Prompt: Build some companion tools                                                    │
  │   Defined at config/companion_tools.in:8                                              │
  │   Depends on: EXPERIMENTAL [=y]                                                       │
  │   Location:                                                                           │
  │     -> Companion tools                                                                │

                    

如此,再去继续重新编译,可以看到对应的编译输出信息:


[EXTRA]    Extracting ‘make-3.81′
[EXTRA]    Patching ‘make-3.81′
[EXTRA]    =================================================================
[EXTRA]    Installing make
[02:14] |

                    

即,去下载并编译对应的3.81的make,供后续使用了。

至此,才算是比较完美的解决此处的问题。

详见:

【未解决】crosstool-ng编译arm的xscale时,编译gcc-4.2.4时出错:[libgcc/./_powisf2.o] Error 1,/tmp/cc7Xh6xp.s:21: Error: selected processor does not support ARM mode `fmsr s14,r0′