crosstool-ng 编译交叉工具链的常见错误及解决办法
1、配置crosstool-ng產(chǎn)生的錯(cuò)誤
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時(shí),出現(xiàn)的類(lèi)似“XXX:none found”的錯(cuò)誤,都可以是該工具沒(méi)有安裝,把該工具安裝上,重新配置即可。
1.5 ct-ng help命令檢查時(shí)出錯(cuò)
crosstool-ng 安裝成功后,用ct-ng help命令檢查時(shí),不認(rèn)識(shí)該命令這多半是添加環(huán)境變量失敗造成的,這時(shí)可以打開(kāi)
/home/Administrator
目錄下的.bashrc查看是否把windows里的其他環(huán)境變量添加到了.bashrc文件中,如果把多余的去掉,只保留cgywin自己的環(huán)境變量,如下所示:
PATH=/usr/local/bin:/usr/bin:/bin:/opt/crosstool-ng-1.9.3/bin
1.6 配置時(shí)的其他錯(cuò)誤
在配置crosstool-NG時(shí),也即執(zhí)行
?./configure --prefix=/opt/crosstool-ng
出現(xiàn)的類(lèi)似“XXX:none found”的錯(cuò)誤,都是相應(yīng)工具沒(méi)有安裝造成的,重新運(yùn)行setup.exe把該工具安裝上,再執(zhí)行該命令,即可。
?
2、編譯交叉工具鏈產(chǎn)生的錯(cuò)誤
2.1 targets' is *not* case-sensitive
Cygwin窗口的錯(cuò)誤信息:
$ 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都是區(qū)分大小寫(xiě)的,cygwin既然是模擬unix環(huán)境,當(dāng)然也是區(qū)分大小定的。?
這個(gè)問(wèn)題好解決,修改一下注冊(cè)表就行了。
打開(kāi)注冊(cè)表,找到如下位置:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Kernel
把“obcaseinsensitive”的值改為0,再重新啟動(dòng)電腦,cygwin下就區(qū)分大小寫(xiě)了。
如果覺(jué)得麻煩,可以把如下代碼復(fù)制到記事本里(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窗口的錯(cuò)誤信息:
[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++,在編譯的時(shí)候時(shí)需要C++的
參考:
http://hi.baidu.com/robin_l/blog/item/3087ffa1875a2d83471064bf.html
?
2.2 Build failed in step 'Installing D.U.M.A.'
Cygwin窗口的錯(cuò)誤信息:
[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
打開(kāi)“GNUmakefile”,添加對(duì)cygwin的支持,也就是添加下面紅色的一句
# some defaults:
CC=gcc
CXX=g++
AR=ar
RANLIB=ranlib
INSTALL=install
RM=rm
RMFORCE=rm -f
ECHO=echo
ECHOLF=echo
OS=cygwin
接下來(lái)重新把duma_2_5_15打包
$ cd ..
$ tar -zcvf duma_2_5_15.tar.gz ?duma_2_5_15?#重新壓縮源碼
?
這個(gè)錯(cuò)誤讓我郁悶了幾天,因?yàn)樵赽uild.log文件里的信息也沒(méi)說(shuō)出問(wèn)題可能出在什么地方。
最后才在INSTALL文件里發(fā)現(xiàn)如果是在cygwin下編譯需要修改Makefile文件
INSTALL文件的部分內(nèi)容:
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窗口的錯(cuò)誤信息:
[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這一項(xiàng)去掉,原因很簡(jiǎn)單,ltrace不支持windows,只支持linux,在README文件中有說(shuō)明,之所以能知道這個(gè)是受解決上一個(gè)錯(cuò)誤的啟發(fā),查看了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窗口的錯(cuò)誤信息:
[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)
這個(gè)問(wèn)題是在用crosstool-ng-1.9.1時(shí)出現(xiàn)的,補(bǔ)丁也打了libelf可能用到的工具(libelf0-devel
libelf0,ELFIO,catgets)也都安裝了,但都不能解決,年后crosstool-ng出了新版本1.9.3,我就用最新的crosstooo.-ng-1.9.3重新編譯,這個(gè)錯(cuò)誤沒(méi)有再出現(xiàn),這也算是解決了吧。
總結(jié)
以上是生活随笔為你收集整理的crosstool-ng 编译交叉工具链的常见错误及解决办法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 建立ARM交叉编译环境 (arm-non
- 下一篇: ubuntu 启动时 设置多个ip 修