最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】在Cygwin下编译gcc-3.4.5-glibc-2.3.6的arm-xscale-linux-gnu交叉编译器

CrossCompiler crifan 6396浏览 0评论

【背景】

之前自己没有找到合适的gcc-3.4.5-glibc-2.3.6的arm-xscale-linux-gnu交叉编译器:

【记录】尝试寻找或自己编译出针对gcc-3.4.5-glibc-2.3.6的交叉编译器arm-xscale-linux-gnu-gcc

所以,打算自己去编译一个。

【折腾过程】

1.搞懂了crosstool-ng的意思:

【整理】crosstool和crosstool-ng

后,去主页:

http://crosstool-ng.org/

下载crosstool。

 

2.一些供参考的资料:

fedora9 ARM交叉编译工具链建立 总结

3.编译之前,看到了之前就知道的那个编译结果:

Crosstool build results

可见,对于:

arm-xscale的话,两个:

gcc-3.4.5
cgcc-3.4.5
glibc-2.3.6
binutils-2.15
linux-2.6.8
hdrs-2.6.12.0

gcc-3.4.5
cgcc-3.4.5
glibc-2.3.6
binutils-2.15
linux-2.6.9
hdrs-2.6.12.0
tls

都是可以的。

 

4.一些别人的配置:

http://crosstool.googlecode.com/svn/trunk/src/buildlogs/arm-xscale-gcc-3.4.5-glibc-2.3.2-tls.dat.txt

http://hg.easyneuf.org/crosstool/annotate/32fbc2e2154a/buildlogs/arm-xscale-gcc-3.4.5-glibc-2.3.6.dat.txt

 

5.参考:

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

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

 

去:

http://crosstool-ng.org/download/crosstool-ng/

下载最新的:

crosstool-ng-1.9.3.tar.bz2

然后拷贝到cygwin下面,解压:

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ ls
crosstool-ng-1.9.3.tar

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ tar xvf crosstool-ng-1.9.3.tar
crosstool-ng-1.9.3/.version
crosstool-ng-1.9.3/COPYING
crosstool-ng-1.9.3/LICENSES
crosstool-ng-1.9.3/Makefile.in
crosstool-ng-1.9.3/README
crosstool-ng-1.9.3/TODO
crosstool-ng-1.9.3/config/arch/alpha.in
......
crosstool-ng-1.9.3/scripts/wrapper.in
crosstool-ng-1.9.3/scripts/xldd.in
crosstool-ng-1.9.3/steps.mk

CLi@PC-CLI-1 ~/develop/crosstool-ng
$

然后参考官网:

http://crosstool-ng.org/

去配置:

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ ls
crosstool-ng-1.9.3  crosstool-ng-1.9.3.tar

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ cd crosstool-ng-1.9.3/

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3
$ ls
config  configure  contrib  COPYING  ct-ng.comp  ct-ng.in  docs  kconfig  LICENSES  licenses.d  Makefile.in  patches  README  samples  scripts  steps.mk  TODO

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3
$ ./configure --prefix=/opt/crosstool-ng
Checking for 'grep'... /usr/bin/grep
Checking whether '/usr/bin/grep' supports -E... yes
Checking for 'sed'... /usr/bin/sed
Checking whether '/usr/bin/sed' supports -i and -e... yes
Checking for 'bash'... /usr/bin/bash
Checking for 'cut'... /usr/bin/cut
Checking for 'install'... /usr/bin/install
Checking for 'make'... /usr/bin/make
Checking for 'gcc'... /usr/bin/gcc
Checking for 'awk'... /usr/bin/awk
Checking for 'bison'... /usr/bin/bison
Checking for 'flex'... /usr/bin/flex
Checking for 'makeinfo'... /usr/bin/makeinfo
Checking for 'automake'... /usr/bin/automake
Checking for 'libtool'... /usr/bin/libtool
Checking for 'stat'... /usr/bin/stat
Checking for 'aria2c'... /usr/bin/aria2c
Checking for 'cvs'... /usr/bin/cvs
Checking for 'patch'... /usr/bin/patch
Checking for 'tar'... /usr/bin/tar
Checking for 'gzip'... /usr/bin/gzip
Checking for 'bzip2'... /usr/bin/bzip2
Checking for 'lzma'... /usr/bin/lzma
Checking for 'readlink'... /usr/bin/readlink
Checking for 'objcopy'... /usr/bin/objcopy
Checking for 'objdump'... /usr/bin/objdump
Checking for 'readelf'... /usr/bin/readelf
Checking for 'patch'... /usr/bin/patch
Checking for 'ncurses/ncurses.h'... yes
Checking for 'libncursesw.so'... no
Checking for 'libncursesw.a'... yes
Computing version string... 1.9.3
Building up Makefile... done

crosstool-NG configured as follows:
  PREFIX='/opt/crosstool-ng'
  BINDIR='/opt/crosstool-ng/bin'
  LIBDIR='/opt/crosstool-ng/lib/ct-ng-1.9.3'
  DOCDIR='/opt/crosstool-ng/share/doc/ct-ng-1.9.3'
  MANDIR='/opt/crosstool-ng/share/man'

Now run:
  make
  make install

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3
$

然后再去编译和安装:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3
$ make
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'paths.mk'
  SED    'docs/ct-ng.1'
  GZIP   'docs/ct-ng.1.gz'

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3
$ make install
  MKDIR   '/opt/crosstool-ng/bin/'
  INST    'ct-ng'
  RMDIR   '/opt/crosstool-ng/lib/ct-ng-1.9.3/'
  MKDIR   '/opt/crosstool-ng/lib/ct-ng-1.9.3/'
  INSTDIR 'config/'
  INSTDIR 'contrib/'
  INSTDIR 'kconfig/'
  INSTDIR 'patches/'
  INSTDIR 'scripts/'
  INST    'steps.mk'
  INST    'paths.mk'
  INSTDIR 'samples/'
  MKDIR   '/opt/crosstool-ng/share/doc/ct-ng-1.9.3/'
  INST    'docs/*.txt'
  MKDIR   '/opt/crosstool-ng/share/man/man1/'
  INST    'ct-ng.1.gz'

For auto-completion, do not forget to install 'ct-ng.comp' into
your bash completion directory (usually /etc/bash_completion.d)

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3
$

然后去试试是否安装成功,结果出错,详见:

【已解决】Cygwin中安装完crosstool-ng后,运行ct-ng help出错:bash: ct-ng: command not found

然后就可以在环境变量中找到crosstool-ng的路径,可以使用ct-ng了。

6.然后安装教程,新建一些文件夹。

另外,想要编译arm-xscale的,结果找了:

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ ls
crosstool-ng-1.9.3  crosstool-ng-1.9.3.tar  crosstool-ng-1.9.3_build

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ mkdir src

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ mkdir x-tools

CLi@PC-CLI-1 ~/develop/crosstool-ng
$ cd crosstool-ng-1.9.3_build/

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ../
crosstool-ng-1.9.3/       crosstool-ng-1.9.3.tar    crosstool-ng-1.9.3_build/ src/                      x-tools/

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ../crosstool-ng-1.9.3/
config/     configure   contrib/    ct-ng       docs/       kconfig/    licenses.d/ patches/    samples/    scripts/

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ../crosstool-ng-1.9.3/samples/
alphaev56-unknown-linux-gnu/          arm-unknown-linux-gnueabi/            mips64el-n32-linux-uclibc/            powerpc-unknown_nofpu-linux-gnu/
arm-bare_newlib_cortex_m3_nommu-eabi/ arm-unknown-linux-uclibcgnueabi/      mips64el-n64-linux-uclibc/            powerpc-unknown-linux-gnu/
arm-cortex_a8-linux-gnueabi/          avr32-unknown-none/                   mips-ar2315-linux-gnu/                powerpc-unknown-linux-uclibc/
arm-davinci-linux-gnueabi/            bfin-unknown-linux-uclibc/            mipsel-unknown-linux-gnu/             s390-ibm-linux-gnu/
armeb-test_nptl-linux-uclibcgnueabi/  i586-geode-linux-uclibc/              mips-unknown-elf/                     s390x-ibm-linux-gnu/
armeb-unknown-eabi/                   i686-nptl-linux-gnu/                  mips-unknown-linux-uclibc/            sh4-unknown-linux-gnu/
armeb-unknown-linux-gnueabi/          i686-pc-mingw32/                      powerpc-405-linux-gnu/                x86_64-unknown-linux-gnu/
armeb-unknown-linux-uclibcgnueabi/    ia64-unknown-linux-gnu/               powerpc64-unknown-linux-gnu/          x86_64-unknown-linux-uclibc/
arm-iphone-linux-gnueabi/             m68k-unknown-elf/                     powerpc-860-linux-gnu/
arm-unknown-eabi/                     mingw32,i686-none-linux-gnu/          powerpc-e500v2-linux-gnuspe/

和:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ct-ng list-samples
Sample name                           Status
alphaev56-unknown-linux-gnu           [G X]
arm-bare_newlib_cortex_m3_nommu-eabi  [G X]
arm-cortex_a8-linux-gnueabi           [G  ]
arm-davinci-linux-gnueabi             [G  ]
arm-iphone-linux-gnueabi              [G X]
arm-unknown-eabi                      [G  ]
arm-unknown-linux-gnueabi             [G  ]
arm-unknown-linux-uclibcgnueabi       [G X]
armeb-test_nptl-linux-uclibcgnueabi   [G X]
armeb-unknown-eabi                    [G  ]
armeb-unknown-linux-gnueabi           [G X]
armeb-unknown-linux-uclibcgnueabi     [G X]
avr32-unknown-none                    [G X]
bfin-unknown-linux-uclibc             [G  ]
i586-geode-linux-uclibc               [G  ]
mingw32,i686-none-linux-gnu           [G X]
i686-nptl-linux-gnu                   [G  ]
i686-pc-mingw32                       [G X]
ia64-unknown-linux-gnu                [G X]
m68k-unknown-elf                      [G X]
mips-ar2315-linux-gnu                 [G X]
mips-unknown-elf                      [G  ]
mips-unknown-linux-uclibc             [G  ]
mips64el-n32-linux-uclibc             [G X]
mips64el-n64-linux-uclibc             [G X]
mipsel-unknown-linux-gnu              [G  ]
powerpc-405-linux-gnu                 [G  ]
powerpc-860-linux-gnu                 [G  ]
powerpc-e500v2-linux-gnuspe           [G X]
powerpc-unknown-linux-gnu             [G  ]
powerpc-unknown-linux-uclibc          [G  ]
powerpc-unknown_nofpu-linux-gnu       [G  ]
powerpc64-unknown-linux-gnu           [G X]
s390-ibm-linux-gnu                    [G X]
s390x-ibm-linux-gnu                   [G X]
sh4-unknown-linux-gnu                 [G  ]
x86_64-unknown-linux-gnu              [G  ]
x86_64-unknown-linux-uclibc           [G  ]
      L (Local)       : sample was found in current directory
      G (Global)      : sample was installed with crosstool-NG
      X (EXPERIMENTAL): sample may use EXPERIMENTAL features
      B (BROKEN)      : sample is currently broken

都没找到合适的sample。

7.参考官网教程,去看看某个sample:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ct-ng show-arm-cortex_a8-linux-gnueabi
arm-cortex_a8-linux-gnueabi  [G  ]
    OS             : linux-2.6.36
    Companion libs : gmp-4.3.2 mpfr-2.4.2 ppl-0.10.2 cloog-ppl-0.15.9 libelf-0.8.13
    binutils       : binutils-2.20
    C compiler     : gcc-4.4.3 (C,C++)
    C library      : glibc-2.9
    Tools          : dmalloc-5.5.2 duma-2_5_15 gdb-6.8 ltrace-0.5.3 strace-4.5.19

8.然后实在找不到合适可供参考的sample,所以根据官网建议,先尽量选个最接近的sample。但是还是不知道arm xscale和那个例子最匹配。

然后参考了:

http://zh.wikipedia.org/wiki/XScale

大概了解到,其后来更新的是Cortex,所以,此处暂且借用cortex的折腾吧。

9.然后就去用:arm-cortex_a8-linux-gnueabi

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ct-ng arm-cortex_a8-linux-gnueabi
  MKDIR kconfig
  DEP   kconfig/conf.dep
  DEP   kconfig/zconf.tab.dep
  CC    kconfig/zconf.tab.o
  CC    kconfig/conf.o
  LD    kconfig/conf
  LN    config
  MKDIR config.gen
  IN    config.gen/arch.in
  IN    config.gen/kernel.in
  IN    config.gen/cc.in
  IN    config.gen/libc.in
  IN    config.gen/debug.in
  CONF  config/config.in

***********************************************************

Initially reported by: Yann E. MORIN
URL: http://ymorin.is-a-geek.org/

***********************************************************

Now configured for "arm-cortex_a8-linux-gnueabi"

此时可以看到当前文件夹下面,已有对应的.config配置文件了:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ls -la
total 25
drwxr-xr-x+ 1 CLi            Domänen-Benutzer     0 Jul 23 10:40 .
drwxr-xr-x+ 1 Administrators Domänen-Benutzer     0 Jul 22 17:56 ..
-rw-r--r--  1 CLi            Domänen-Benutzer 10496 Jul 23 10:40 .config
lrwxrwxrwx  1 CLi            Domänen-Benutzer    40 Jul 23 10:40 config -> /opt/crosstool-ng/lib/ct-ng-1.9.3/config
drwxr-xr-x+ 1 CLi            Domänen-Benutzer     0 Jul 23 10:40 config.gen
drwxr-xr-x+ 1 CLi            Domänen-Benutzer     0 Jul 23 10:40 kconfig

然后去看了看.config,的确是之前的那个arm-cortex_a8-linux-gnueabi的默认配置。

11.再去配置配置:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ct-ng menuconfig
  DEP   kconfig/lxdialog/checklist.dep
  DEP   kconfig/lxdialog/inputbox.dep
  DEP   kconfig/lxdialog/util.dep
  DEP   kconfig/lxdialog/textbox.dep
  DEP   kconfig/lxdialog/yesno.dep
  DEP   kconfig/lxdialog/menubox.dep
  DEP   kconfig/mconf.dep
  CC    kconfig/lxdialog/menubox.o
  CC    kconfig/lxdialog/yesno.o
  CC    kconfig/lxdialog/textbox.o
  CC    kconfig/lxdialog/util.o
  CC    kconfig/lxdialog/inputbox.o
  CC    kconfig/lxdialog/checklist.o
  CC    kconfig/mconf.o
  LD    kconfig/mconf
  IN    config.gen/arch.in
。。。

然后出来配置页面:

nt-ng menuconfig

接着就可以去根据需要去配置了:

【记录】为arm的xscale配置crosstool-ng

12.配置完毕后,Exit,回到命令行:

CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.9.3_build
$ ct-ng menuconfig
  CONF  config/config.in

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

13.去编译之前,先去看看,用到了哪些版本的源码,然后手动先下载下来。

(1)2.6.36的kernel

去:https://www.kernel.org/pub/linux/kernel/v2.6/找到:linux-2.6.36.tar.bz2

(2)2.20的binutils

http://ftp.gnu.org/gnu/binutils/ -> binutils-2.22.tar.bz2

(3)4.4.3的gcc

http://ftp.gnu.org/gnu/gcc/gcc-4.4.3/->gcc-4.4.3.tar.bz2

(4)2.9的glibc

http://ftp.gnu.org/gnu/glibc/ -> glibc-2.9.tar.bz2

(5)4.5.19的strace

http://nchc.dl.sourceforge.net/project/strace/strace/ -> strace-4.5.19.tar.bz2

strace-4.5.19.tar.bz2

 

(6)5.5.2的dmalloc

http://dmalloc.com/releases/ -> dmalloc-5.5.2.tgz

http://fossies.org/linux/misc/dmalloc-5.5.2.tgz/

->http://fossies.org/linux/misc/dmalloc-5.5.2.tar.bz2

 

(7)6.8的gdb

http://ftp.cs.pu.edu.tw/Linux/sourceware/gdb/releases/ -> gdb-6.8.tar.bz2

(8)4.3.2的gmp

http://ftp.gnu.org/gnu/gmp/ -> gmp-4.3.2.tar.bz2

(9)2.4.2的mpfr

http://ftp.gnu.org/gnu/mpfr/ -> mpfr-2.4.2.tar.bz2

 

分别都下载下来,放到此处的:

/home/CLi/develop/crosstool-ng/src

==

~/develop/crosstool-ng/src

下面:

download all tarball

14.然后开始真正的编译过程:

【记录】crosstool为xscale编译(ct-ng build)过程

 

15.后来才注意到,原来,crosstool的源码下载的地方:

http://crosstool-ng.org/download/crosstool-ng/

其实最底下的版本,我下载的那个:

crosstool-ng-1.9.3.tar.bz2

不是最新版,最新版是,页面向上拉,而看到的:

crosstool-ng-1.18.0.tar.bz2 2013-Jan-31 20:01:09 1.80MB  BZ2 File

真实无语了。。。

知道这个是排序导致的,但是还是很少遇到这种事情的。。。

 

 

【总结】

转载请注明:在路上 » 【记录】在Cygwin下编译gcc-3.4.5-glibc-2.3.6的arm-xscale-linux-gnu交叉编译器

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.157 seconds, using 22.16MB memory