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

【问题】

折腾:

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

期间,又遇到,和之前的:

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

类似的错误:

[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]


Current command:
  'make' '-j4' '-l' 'install_root=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot' 'install-bootstrap-headers=yes' 'install-headers'
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/.build/arm-xscale-linux-gnueabi/build/build-libc-startfiles>

详细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]

 

【解决过程】

1.很明显,还是要去找到出错的makefile:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\crosstool-ng\crosstool-ng-1.18.0_build\.build\src\glibc-2.9\manual\Makefile

的位置:

# Create stamp files if they don't exist, so the parent makefile's rules for
# updating the library archives are happy with us, and never think we have
# changed the library.
lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
ifdef objpfx
.PHONY: stubs
stubs: $(objpfx)stubs
endif
$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
	$(make-target-directory)
	touch $@

对应是:

$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:

按照之前的办法,还是去修改,但是此处不知道如何修改。

并且是,如果是每次都修改一个类似的地方,则后续如果出现多次,岂不是改的累屎了。

2.所以,还是中断编译,去使用配置:

Paths and misc options  —>

    [*] Try features marked as EXPERIMENTAL

Companion tools  —>

    [*] Build some companion tools

    [*]   make

解决此问题:

ct-ng menuconfig

.config – crosstool-NG 1.18.0 Configuration

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

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 [=n]                                                   
Type  : boolean                                                             
Prompt: Try features marked as EXPERIMENTAL                                 
   Defined at config/global/ct-behave.in:18                                  
   Location:                                                                 
     -> Paths and misc options

选上Try features marked as EXPERIMENTAL:

select Try features marked as EXPERIMENTAL

选上Companion tools的Build some companion tools中的make:

Build some companion tools make

然后重新编译ct-ng build一把试试。

3.结果其去下载并编译make了:

[EXTRA]    Extracting ‘make-3.81’

[EXTRA]    Patching ‘make-3.81’

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

[EXTRA]    Installing make

[02:14] |

4.但是发现一个问题,每次都是从头开始编译,要消耗尽一小时,太慢了。。。

而之前是参考了:

Cygwin下用crosstool-ng编译交叉工具链

说是:

1、设置croostool-NG调试标记

Paths and misc options  —>

***crosstool-Ng behavior***

[*]Debug crosstool-NG  #

[*]Save intermediate steps#保存编译过程中的中间步骤,在没选中上一项之前,这一项不出现。

如果你足够幸运,第一次就能编译通过,这一步就没有必要选。如果很不幸,中间出现了错,这一步就显得相当重要了,可以让节省很多时间。因为有了这一项,在编译的过程中,croostool-ng会记录

下每一步的状态。这样在对出现的错误进行纠正后,就可以从出错这一步开再继续编译,当然你也可以从任一个已保存的状态点开始。如果没有选这一项的话,每出错一次就要从头重新开始编译,这可是相当浪费时间。

结果我这里,已经是选上对应的选项的:

Debug crosstool-NG and Save intermediate steps

结果完全没效果。

所以,再去看看其说明:

Save intermediate steps

  CT_DEBUG_CT_SAVE_STEPS:                                               
                                                                     
  If you say ‘y’ here, then you will be able to restart crosstool-NG at 
  any step.                                                             
                                                                     
  It is not currently possible to restart at any of the debug facilities.

  They are treated as a whole.                       
                                                     
  To get the full list os steps, run: ct-ng list-steps

                                                     
  Symbol: DEBUG_CT_SAVE_STEPS [=y]                   
  Type  : boolean                                    
  Prompt: Save intermediate steps                    
  Defined at config/global/ct-behave.in:79           
  Depends on: DEBUG_CT [=y]                          
  Location:                                          
      -> Paths and misc options                      
      -> Debug crosstool-NG (DEBUG_CT [=y])

所以,先去看看支持哪些步骤:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ ct-ng list-steps
Available build steps, in order:
  - libc_check_config
  - companion_libs_for_build
  - binutils_for_build
  - companion_libs_for_host
  - binutils_for_host
  - cc_core_pass_1
  - kernel_headers
  - libc_start_files
  - cc_core_pass_2
  - libc
  - cc_for_build
  - cc_for_host
  - libelf_for_target
  - binutils_for_target
  - debug
  - test_suite
  - finish
Use "<step>" as action to execute only that step.
Use "+<step>" as action to execute up to that step.
Use "<step>+" as action to execute from that step onward.

所以,可以接着去试试:

ct-ng libc_start_files+

结果出错了:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ ct-ng libc_start_files+
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20130731.171128
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[ERROR]  The previous build did not reach the point where it could be restarted at 'libc_start_files'
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_Abort[scripts/functions@331]
[ERROR]  >>        called from: CT_TestOrAbort[scripts/functions@361]
[ERROR]  >>        called from: CT_DoLoadState[scripts/functions@1308]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@620]


Current command (unknown), exited with error code: 1
Please fix it up and finish by exiting the shell with one of these values:
    1  fixed, continue with next build command
    3  abort build

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

也是正常的,因为,这次,已经换了make了,也没有执行到上述的libc_start_files

 

但是,证明这个方式是可以指定从某个阶段,继续编译的,所以,下次遇到出错,就可以这么用了。

这次的话,继续从头开始编译。。。。

5.重新开始编译,然后由于当前cygwin好像有bug,导致内存泄露,导致我的电脑的8G内存都被占用完了,所以出错:

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.171426
[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 1.83s (at 00:58)
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[EXTRA]    Using 'linux-custom' from custom location
[INFO ]  Retrieving needed toolchain components' tarballs: done in 3.72s (at 01:02)
[INFO ]  =================================================================
[INFO ]  Extracting, patching and installing companion tools
[EXTRA]    =================================================================
[EXTRA]    Installing make
[EXTRA]    Installing make: done in 266.80s (at 05:30)
[INFO ]  Extracting, patching and installing companion tools: done in 267.97s (at 05:30)
[INFO ]  =================================================================
[INFO ]  Extracting and patching toolchain components
[INFO ]  Extracting and patching toolchain components: done in 7.85s (at 05:38)
[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 715.81s (at 17:41)
[INFO ]  =================================================================
[INFO ]  Installing MPFR for host
[19:09] /  Configuring MPFR
[EXTRA]    Building MPFR
[EXTRA]    Installing MPFR
[INFO ]  Installing MPFR for host: done in 386.54s (at 24:07)
[INFO ]  =================================================================
[INFO ]  Installing MPC for host
[EXTRA]    Configuring MPC
[EXTRA]    Building MPC
[EXTRA]    Installing MPC
[INFO ]  Installing MPC for host: done in 182.22s (at 27:10)
[EXTRA]  Saving state to restart at step 'binutils_for_host'...
[INFO ]  =================================================================
[INFO ]  Installing binutils for host
[EXTRA]    Configuring binutils
[ERROR]    configure: error: cannot create configure.lineno; rerun with a POSIX shell
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing binutils for host'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_binutils_backend[scripts/build/binutils/binutils.sh@205]
[ERROR]  >>        called from: do_binutils_for_host[scripts/build/binutils/binutils.sh@92]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]


Current command:
  'CFLAGS=-O2 -g -pipe ' 'CXXFLAGS=-O2 -g -pipe ' 'LDFLAGS= ' '/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/binutils-2.22/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' '--disable-werror' '--enable-ld=yes' '--enable-gold=no' '--with-pkgversion=crosstool-NG 1.18.0' '--disable-multilib' '--disable-nls' '--with-float=softfp' '--with-sysroot=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot'
exited with error code: 1
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/.build/arm-xscale-linux-gnueabi/build/build-binutils-host-i686-build_pc-cygwin>

错误log是:

[INFO ]  =================================================================
[INFO ]  Installing binutils for host
[EXTRA]    Configuring binutils
[DEBUG]    Extra config passed: '--enable-ld=yes --enable-gold=no --with-pkgversion=crosstool-NG 1.18.0 --disable-multilib --disable-nls'
[DEBUG]    ==> Executing: 'CFLAGS=-O2 -g -pipe ' 'CXXFLAGS=-O2 -g -pipe ' 'LDFLAGS= ' '/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/binutils-2.22/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' '--disable-werror' '--enable-ld=yes' '--enable-gold=no' '--with-pkgversion=crosstool-NG 1.18.0' '--disable-multilib' '--disable-nls' '--with-float=softfp' '--with-sysroot=/home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot' 
[CFG  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/binutils-2.22/configure: line 423: /usr/bin/expr: Cannot allocate memory
[CFG  ]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/binutils-2.22/configure: line 438: /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/tools/bin/sed: Cannot allocate memory
[ERROR]    configure: error: cannot create configure.lineno; rerun with a POSIX shell
[ERROR]  
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing binutils for host'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_binutils_backend[scripts/build/binutils/binutils.sh@205]
[ERROR]  >>        called from: do_binutils_for_host[scripts/build/binutils/binutils.sh@92]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]

所以,很简单,需要重启电脑,再继续重新编译。

然后就可以去试试:

ct-ng binutils_for_host+

或许是支持的了。

6.后来果然是支持的:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ ct-ng binutils_for_host+
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20130801.093212
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Restoring state at step 'binutils_for_host', as requested.
[INFO ]  =================================================================
[INFO ]  Installing binutils for host
[EXTRA]    Configuring binutils
[EXTRA]    Building binutils
[EXTRA]    Installing binutils
[INFO ]  Installing binutils for host: done in 598.20s (at 10:24)
[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 1098.50s (at 28:46)
[EXTRA]  Saving state to restart at step 'kernel_headers'...
[INFO ]  =================================================================
[INFO ]  Installing kernel headers
[EXTRA]    Installing kernel headers
[INFO ]  Installing kernel headers: done in 138.42s (at 31:12)
[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
[EXTRA]    Installing C library start files
[INFO ]  Installing C library headers & start files: done in 651.26s (at 42:10)
[EXTRA]  Saving state to restart at step 'cc_core_pass_2'...
[INFO ]  =================================================================
[INFO ]  Installing pass-2 core C compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[EXTRA]    Installing gcc
[INFO ]  Installing pass-2 core C compiler: done in 1307.70s (at 64:06)
[EXTRA]  Saving state to restart at step 'libc'...
[INFO ]  =================================================================
[INFO ]  Installing C library
[EXTRA]    Configuring C library
[EXTRA]    Building C library
[ERROR]    arm-xscale-linux-gnueabi-gcc: error: spawn: Cannot allocate memory
[ERROR]    make[3]: *** [/home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-libc-final/crypt/md5.os] Error 1
[ERROR]    make[2]: *** [crypt/others] Error 2
[ERROR]    make[1]: *** [all] Error 2
[ERROR]  \
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing C library'
[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@441]
[ERROR]  >>        called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143]
[ERROR]  >>        called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]
         /

Current command:
  'make' '-j4' '-l' 'all'
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/.build/arm-xscale-linux-gnueabi/build/build-libc-final>

很明显,此处是又是cygwin的bug,内存泄露,导致无法分配内存。

只能重启,再继续编译了。

但是很明显,此处,已经解决了之前的错误,是可以继续用3.81的make去编译了。

 

【总结】

之前手动去makefile中的错误,相对来说,比较繁琐。

还是改用crosstool-ng里面提供的3.81的make去编译,可以,相对的,一次性的解决问题。



发表评论

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

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