现在的位置: 首页 > 综合 > 正文

crosstool-ng 编译交叉工具链的常见错误及解决办法

2013年03月04日 ⁄ 综合 ⁄ 共 10738字 ⁄ 字号 评论关闭

1、配置crosstool-ng产生的错误

1.1 ncurses headers files were not found

Checking for 'ncurses/ncurses.h'... no

Checking for 'ncurses/curses.h'... no

Checking for 'ncurses.h'... no

Checking for 'curses.h'... no

ncurses headers files were not found

解决方法:

安装:ncurses,、libncurses-devel

1.2 flex none found

Checking for 'flex'... No

flex: none found

Either you are missing entirely the needed tool,

or the version you have is too old.

 

configure: Bailing out...

解决方法:

安装:flex,flexdll

1.3 automake 1.10 or above was not found

Checking for 'automake'... no

automake 1.10 or above was not found

Either you are missing entirely the needed tool,

or the version you have is too old.

configure: Bailing out...

 

解决方法:

安装:automake

1.4 libtool 1.5.26 or above was not found

Checking for 'libtool'... no

libtool 1.5.26 or above was not found

Either you are missing entirely the needed tool,

or the version you have is too old.

You can give the path to this tool using: --with-libtool=PATH

configure: Bailing out...

解决方法:

安装:libtool

注:
在配置crosstool-NG时,出现的类似“XXX:none found”的错误,都可以是该工具没有安装,把该工具安装上,重新配置即可。

1.5 ct-ng help命令检查时出错

crosstool-ng 安装成功后,用ct-ng help命令检查时,不认识该命令这多半是添加环境变量失败造成的,这时可以打开
/home/Administrator
目录下的.bashrc查看是否把windows里的其他环境变量添加到了.bashrc文件中,如果把多余的去掉,只保留cgywin自己的环境变量,如下所示:
PATH=/usr/local/bin:/usr/bin:/bin:/opt/crosstool-ng-1.9.3/bin
1.6 配置时的其他错误
在配置crosstool-NG时,也即执行
 ./configure --prefix=/opt/crosstool-ng
出现的类似“XXX:none found”的错误,都是相应工具没有安装造成的,重新运行setup.exe把该工具安装上,再执行该命令,即可。

 

2、编译交叉工具链产生的错误

2.1 targets' is *not* case-sensitive
Cygwin窗口的错误信息:
$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[ERROR]  Your file system in '/home/Administrator/croosstool-ng/crosstool-ng-1.9.3/targets' is *not* case-sensitive!

[00:02] / make: *** [build] Error 1

unix 和Linux都是区分大小写的,cygwin既然是模拟unix环境,当然也是区分大小定的。 

这个问题好解决,修改一下注册表就行了。

打开注册表,找到如下位置:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Kernel
把“obcaseinsensitive”的值改为0,再重新启动电脑,cygwin下就区分大小写了。
如果觉得麻烦,可以把如下代码复制到记事本里(case-sensitive.txt):

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel]
"obcaseinsensitive"=dword:00000000
然后把记事本的后缀名改为.reg,(case-sensitive.reg),双击reg(case-sensitive.reg)文件即可,和上面的效果一样。

2.1 Installing static core C compiler failed
Cygwin窗口的错误信息:
[INFO ]  Installing static core C compiler

[EXTRA]    Configuring static core C compiler

[ERROR]    checking for C compiler default output file name... configure: error: C compiler cannot create executablesconf.tab.o

[ERROR]    Build failed in step 'Installing static core C compiler'

[ERROR]    Error happened in '/opt/crosstool-ng/lib/ct-ng-1.9.1/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)x.o

[ERROR]          called from '/opt/crosstool-ng/lib/ct-ng-1.9.1/scripts/build/cc/gcc.sh' at line # 203 in function 'do_cc_core'il.o

[ERROR]          called from '/opt/crosstool-ng/lib/ct-ng-1.9.1/scripts/build/cc/gcc.sh' at line # 52 in function 'do_cc_core_pass_1'

[ERROR]          called from '/opt/crosstool-ng/lib/ct-ng-1.9.1/scripts/crosstool-NG.sh' at line # 597 in function 'main'

[ERROR]    Look at '/home/Administrator/crosstool-ng/x-tools/arm-apollo-linux-gnueabi/build.log' for  more info on this error.

解决办法:

安装gcc4-g++,在编译的时候时需要C++的

参考:

http://hi.baidu.com/robin_l/blog/item/3087ffa1875a2d83471064bf.html

 

2.2 Build failed in step 'Installing D.U.M.A.'

Cygwin窗口的错误信息:

[INFO ]  Installing D.U.M.A.

[EXTRA]    Copying sources

[ERROR]    Build failed in step 'Installing D.U.M.A.'

[ERROR]Error happened in '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug/200-duma.sh' in function 'do_debug_duma_build' (line unknown, sorry)

[ERROR]    called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug.sh' at line # 35 in function 'do_debug'

[ERROR]    called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 597 in function 'main'

[ERROR]    Look at '/home/Administrator/ct-ng-1.9.3/crosstool-ng/x-tools/arm-apollo-linux-gnueabi/build.log' for more info on this error.

[ERROR]  (elapsed: 479:03.42)

[479:07] / make: *** [build] Error 1

Build.log中的提示如下:

[INFO ]  Installing D.U.M.A.

[EXTRA]    Copying sources

[ERROR]    Build failed in step 'Installing D.U.M.A.'

[ERROR] Error happened in '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug/

200-duma.sh' in function 'do_debug_duma_build' (line unknown, sorry)

[ERROR]   called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug.sh' at 

line # 35 in function 'do_debug'

[ERROR]   called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 597 in function 'main'

[ERROR] Look at '/home/Administrator/ct-ng-1.9.3/crosstool-ng/x-tools/

arm-apollo-linux-gnueabi/build.log' for more info on this error.

[ERROR]  (elapsed: 479:03.42)

解决方法:

修改DUMA的Makefile文件:

$ tar -zxvf duma_2_5_15.tar.gz #解压源码包

$ cd duma_2_5_15

打开“GNUmakefile”,添加对cygwin的支持,也就是添加下面红色的一句

# some defaults:

CC=gcc

CXX=g++

AR=ar

RANLIB=ranlib

INSTALL=install

RM=rm

RMFORCE=rm -f

ECHO=echo

ECHOLF=echo

OS=cygwin

接下来重新把duma_2_5_15打包

$ cd ..

$ tar -zcvf duma_2_5_15.tar.gz  duma_2_5_15 #重新压缩源码

 

这个错误让我郁闷了几天,因为在build.log文件里的信息也没说出问题可能出在什么地方。

最后才在INSTALL文件里发现如果是在cygwin下编译需要修改Makefile文件

INSTALL文件的部分内容:

his documents describes if and how the library is installed on your system.

I. Linux/Unix environments (including Cygwin and MinGW):

  Configure the options by editing the Makefile.

    Read carefully the description of options at top of the Makefile.

    Take care for the special OS/OSTYPE depending sections.

    Especially if you are going to use the LD_PRELOAD mechanism.

  Call GNU make often called 'gmake' for building the library.

  GNU make is called 'mingw32-make' for MinGW.

  Add option 'OSTYPE=msys' when calling make for MinGW.

  Add option 'OSTYPE=cygwin' when calling make for Cygwin.

  Add option 'OS=osx' when calling make for MacOS X or Darwin.

  Add option 'OS=freebsd' when calling make for FreeBSD.

  Add option 'OS=netbsd' when calling make for NetBSD.

  Add option 'OS=solaris' when calling make for Solaris.

 

2.3 Build failed in step 'Installing ltrace'

Cygwin窗口的错误信息:

[INFO ]  Installing ltrace

[EXTRA]    Copying sources to build dir

[EXTRA]    Configuring ltrace

[EXTRA]    Building ltrace

[ERROR]    make[1]: *** [sysdeps/sysdep.o] Error 2

[ERROR]    Build failed in step 'Installing ltrace'

[ERROR]    Error happened in '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)

[ERROR]   called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug/400-ltrace.sh' at line # 52 in  function do_debug_ltrace_build'

[ERROR]          called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug.sh' at line # 35 in function 'do_debug'

[ERROR]          called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 597 in function 'main'

[ERROR]    Look at '/home/Administrator/ct-ng-1.9.3/crosstool-ng/x-tools/arm-apollo-linux-gnueabi/build.log'  for more info on this error.

[ERROR]  (elapsed: 591:35.21)

[591:39] / make: *** [build] Error 2

 

Build.log中的提示如下:

[ALL  ]    make[1]: Entering directory `/home/Administrator/ct-ng-1.9.3/crosstool-ng/

crosstool-ng-1.9.3_build/ targets/arm-apollo-linux-gnueabi/build/build-ltrace'

[ALL  ]    arm-apollo-linux-gnueabi-gcc -Wall -g -O2 -iquote /home/Administrator/

ct-ng-1.9.3/crosstool-ng/crosstool-ng-1.9.3_build/targets/arm-apollo-linux-gnueabi/build/

build-ltrace  -iquote /home/Administrator/ct-ng-1.9.3/crosstool-ng/crosstool-ng-1.9.3_build/

targets/arm-apollo-linux-gnueabi/build/build-ltrace/sysdeps/CYGWIN_NT-5.1 -DSYSCONFDIR="/usr/etc"   -c -o main.o main.c

[ALL  ]    /usr/bin/make -C sysdeps/CYGWIN_NT-5.1

[ALL  ]    make: Entering an unknown directory

[ALL  ]    make: *** sysdeps/CYGWIN_NT-5.1: No such file or directory.  Stop.

[ALL  ]    make: Leaving an unknown directory

[ERROR]    make[1]: *** [sysdeps/sysdep.o] Error 2

[ALL  ]    make[1]: Leaving directory `/home/Administrator/ct-ng-1.9.3/crosstool-ng/

crosstool-ng-1.9.3_build/targets/arm-apollo-linux-gnueabi/build/build-ltrace'

[ERROR]    Build failed in step 'Installing ltrace'

[ERROR]    Error happened in '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)

[ERROR]          called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug/

400-ltrace.sh'  at line # 52 in function 'do_debug_ltrace_build'

[ERROR]          called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/build/debug.sh' at line # 35 in function 'do_debug'

[ERROR]          called from '/opt/crosstool-ng-1.9.3/lib/ct-ng-1.9.3/scripts/crosstool-NG.sh' at line # 597 in function 'main'

[ERROR]    Look at '/home/Administrator/ct-ng-1.9.3/crosstool-ng/x-tools/

arm-apollo-linux-gnueabi/build.log' for more info on this error.

[ERROR]  (elapsed: 591:39)

 

解决方法:

在配置文件中把ltrace这一项去掉,原因很简单,ltrace不支持windows,只支持linux,在README文件中有说明,之所以能知道这个是受解决上一个错误的启发,查看了ltrace的README文件,原文如下:

4. Where does it work

---------------------

 

It works with ELF based Linux systems running on i386, m68k, S/390,

ARM, PowerPC, PowerPC64, IA64, AMD64, SPARC and Alpha processors.

 

It is part of at least Debian GNU/Linux, RedHat, SuSE, Mandrake...

2.4 Build failed in step 'Installing libelf for the target'

Cygwin窗口的错误信息:

[INFO ]  Installing libelf for the target

[EXTRA]    Configuring libelf

[EXTRA]    Building libelf

[ERROR]    make[2]: *** [de.cat] Segmentation fault (core dumped)

[ERROR]    make[1]: *** [all-recursive] Error 1

[ERROR]    Build failed in step 'Installing libelf for the target'

[ERROR]    Error happened in '/opt/crosstool-ng//lib/ct-ng-1.9.1/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)

[ERROR] called from '/opt/crosstool-ng//lib/ct-ng-1.9.1/scripts/build/companion_libs/libelf.sh' 

at line # 87 in function 'do_libelf_target'

[ERROR]   called from '/opt/crosstool-ng//lib/ct-ng-1.9.1/scripts/crosstool-NG.sh' at line #597 in function 'main'

[ERROR]  Look at '/home/Administrator/crosstool-ng/x-tools/arm-apollo-linux-gnueabi/

build.log' for more info on this error.

[ERROR]  (elapsed: 469:21.42)

[469:27] / make: *** [build] Error 2

 

Build.log的提示如下:

[ALL  ]    ranlib libelf.a

[ALL] make[2]: Leaving directory `/home/Administrator/crosstool-ng/crosstool-ng-1.9.1_build/

targets/arm-apollo-linux-gnueabi/build/build-libelf-for-target/lib'

[ALL  ]    making all in po

[ALL ] make[2]: Entering directory `/home/Administrator/crosstool-ng/crosstool-ng-1.9.1_build/

targets/arm-apollo-linux-gnueabi/build/build-libelf-for-target/po'

[ALL  ]    /usr/bin/gencat de.cat /home/Administrator/crosstool-ng/crosstool-ng-1.9.1_build/

targets/src/libelf-0.8.13/po/de.msg

[ERROR]    make[2]: *** [de.cat] Segmentation fault (core dumped)

[ALL  ]    make[2]: Leaving directory `/home/Administrator/crosstool-ng/

crosstool-ng-1.9.1_build/targets/arm-apollo-linux-gnueabi/build/build-libelf-for-target/po'

[ERROR]    make[1]: *** [all-recursive] Error 1

[ALL  ]    make[1]: Leaving directory `/home/Administrator/crosstool-ng/

crosstool-ng-1.9.1_build/targets/arm-apollo-linux-gnueabi/build/build-libelf-for-target'

[ERROR]    Build failed in step 'Installing libelf for the target'

[ERROR]    Error happened in '/opt/crosstool-ng//lib/ct-ng-1.9.1/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)

[ERROR]          called from '/opt/crosstool-ng//lib/ct-ng-1.9.1/scripts/build/companion_libs/

libelf.sh' at line # 87 in function 'do_libelf_target'

[ERROR]          called from '/opt/crosstool-ng//lib/ct-ng-1.9.1/scripts/crosstool-NG.sh' at line # 597 in function 'main'

[ERROR]    Look at '/home/Administrator/crosstool-ng/x-tools/arm-apollo-linux-gnueabi/

build.log' for more info on this error.

[ERROR]  (elapsed: 469:21.42)

这个问题是在用crosstool-ng-1.9.1时出现的,补丁也打了libelf可能用到的工具(libelf0-devel

libelf0,ELFIO,catgets)也都安装了,但都不能解决,年后crosstool-ng出了新版本1.9.3,我就用最新的crosstooo.-ng-1.9.3重新编译,这个错误没有再出现,这也算是解决了吧。

抱歉!评论已关闭.