构建ARM GNU Cross编译器 [英] Building ARM GNU Cross compiler

查看:145
本文介绍了构建ARM GNU Cross编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处.

我正在尝试使用Ubuntu上的最新发行版发布自己的工具链,并希望这里有足够的Linux社区,以便我能在出现某些问题时得到具体建议.

在所有人的帮助下,我希望最终将其变成有用的参考.

首先,几乎每个人都提到的"十字工具有点过时(2006), " Crosstool-NG "现在似乎正在携带火炬而失败在我的机器上.我宁愿调试过程本身而不是调试脚本(脚本似乎需要我理解该过程).

以下是到目前为止我工作的基本步骤;目前,我一直在尝试编译GCC的第一遍.

失败的地方...

失败是因为缺少包含"crti.o"的交叉编译库:

# ./gcc-4.4.1/configure --target=arm-linux --disable-thread --enable-langauges=c 
/bin/bash ../../../gcc-4.4.1/libgcc/../mkinstalldirs .
/usr/src/gnu-4.4.1-build/./gcc/xgcc -B ........
/usr/local/arm-linux/bin/ld: crti.o No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/src/gnu/gcc-4.4.1-build/arm-linux/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/src/gnu/gcc-4.4.1-build'
make: *** [all] Error 2

构建步骤

在全新"配置的Ubuntu 9.04安装中,这是我到目前为止已完成的步骤:

#New configuration of Ubuntu 9.04
sudo updatedb
sudo apt-get install build-essential subversion
# For kernel configuration
sudo apt-get install libncurses5-dev
# For building GCC
sudo apt-get install libgmp3-dev libmpfr-dev

#Get Linux Headers for GCC/GLIBC compilations
# I use a hacked Linux from Artilla, 
pushd ~ && svn co http://.../linux m501-linux && cd !$
make ARCH=arm m501_defconfig
make ARCH=arm menuconfig
sudo mkdir /usr/local/arm-linux/include
sudo cp -dR include/asm-arm /usr/local/arm-linux/include/asm
sudo cp -dR include/linux /usr/local/arm-linux/include/linux
cd /usr/local/arm-linux/
sudo ln -s include sys-include
popd

#Get sources:
cd /usr/src/
sudo su root
mkdir gnu
ftp ftp.gnu.org
# get gnu/binutils/binutils-2.19.1.tar.bz2
# get gnu/gcc/gcc-4.4.1/gcc-4.4.1.tar.bz2
# get gnu/glibc/glibc-2.10.1.tar.bz2
# get gnu/gdb/gdb-6.8.tar.bz2

#Build Binutils
bzcat binutils-2.19.1.tar.bz2 | tar -xv
mkdir binutils-2.19.1-build && cd !$
cp ../binutils-2.19.1/gas/config/tc-arm.c ./tc-arm.c 
sed -r 's/(as_bad[ \t]*\()(.+\[.+\]\))/\1\"%s\",\2/' < ./tc-arm.c > ../binutils-2.19.1/gas/config/tc-arm.c 
rm ./tc-arm.c    
../binutils-2.19.1/configure --target=arm-linux
make && make install && cd ..

#Build GCC
bzcat gcc-4.4.1.tar.bz2 | tar -xv
mkdir gcc-4.4.1-build && cd !$
../gcc-4.4.1/configure --target=arm-linux --disable-thread --enable-langauges=c -with-headers=/usr/local/arm-linux/include
make

解决方案

这有点像红鲱鱼.显然,使用可用的GLIBC对现有系统的工具链进行交叉编译不需要重新编译GLIBC.老实说,我不知道该如何忽略这个事实.

因此,即使我仍然不知道如何交叉编译GCC GLIBC,因为我只需要GCC,所以我将其标记为已关闭.

如果可以的话,我会回到这篇文章并标记我最终要做的事情.

结帐.

A similiar (less descriptive) post is here.

I'm trying to roll my own tool chain using recent releases on Ubuntu and was hoping there was enough of a Linux community here that I could get specific advice on certain problems as they come up.

With everyone's help I'd like to see this turn into a useful reference eventually.

First off "Crosstool" to which nearly everyone refers is a little (2006) out of date and "Crosstool-NG" which seems to now be carrying the torch fails on my machine. I'd rather debug the process itself than a script (which it would seem requires me to understand the process).

Below are basic steps of what I've got working so far; at present I'm stuck trying to compile the first pass GCC.

Where it's failing ...

It's failing because the cross compiled library containing "crti.o" is missing:

# ./gcc-4.4.1/configure --target=arm-linux --disable-thread --enable-langauges=c 
/bin/bash ../../../gcc-4.4.1/libgcc/../mkinstalldirs .
/usr/src/gnu-4.4.1-build/./gcc/xgcc -B ........
/usr/local/arm-linux/bin/ld: crti.o No such file: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/usr/src/gnu/gcc-4.4.1-build/arm-linux/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/usr/src/gnu/gcc-4.4.1-build'
make: *** [all] Error 2

Build steps

On a 'freshly' configured Ubuntu 9.04 installation, here are the steps I've done so far:

#New configuration of Ubuntu 9.04
sudo updatedb
sudo apt-get install build-essential subversion
# For kernel configuration
sudo apt-get install libncurses5-dev
# For building GCC
sudo apt-get install libgmp3-dev libmpfr-dev

#Get Linux Headers for GCC/GLIBC compilations
# I use a hacked Linux from Artilla, 
pushd ~ && svn co http://.../linux m501-linux && cd !$
make ARCH=arm m501_defconfig
make ARCH=arm menuconfig
sudo mkdir /usr/local/arm-linux/include
sudo cp -dR include/asm-arm /usr/local/arm-linux/include/asm
sudo cp -dR include/linux /usr/local/arm-linux/include/linux
cd /usr/local/arm-linux/
sudo ln -s include sys-include
popd

#Get sources:
cd /usr/src/
sudo su root
mkdir gnu
ftp ftp.gnu.org
# get gnu/binutils/binutils-2.19.1.tar.bz2
# get gnu/gcc/gcc-4.4.1/gcc-4.4.1.tar.bz2
# get gnu/glibc/glibc-2.10.1.tar.bz2
# get gnu/gdb/gdb-6.8.tar.bz2

#Build Binutils
bzcat binutils-2.19.1.tar.bz2 | tar -xv
mkdir binutils-2.19.1-build && cd !$
cp ../binutils-2.19.1/gas/config/tc-arm.c ./tc-arm.c 
sed -r 's/(as_bad[ \t]*\()(.+\[.+\]\))/\1\"%s\",\2/' < ./tc-arm.c > ../binutils-2.19.1/gas/config/tc-arm.c 
rm ./tc-arm.c    
../binutils-2.19.1/configure --target=arm-linux
make && make install && cd ..

#Build GCC
bzcat gcc-4.4.1.tar.bz2 | tar -xv
mkdir gcc-4.4.1-build && cd !$
../gcc-4.4.1/configure --target=arm-linux --disable-thread --enable-langauges=c -with-headers=/usr/local/arm-linux/include
make

解决方案

This was a bit of red-herring. Apparently cross-compling a tool chain for an existing system with a working GLIBC doesn't require GLIBC to be recompiled. I honestly don't know how I ignored this fact.

So even though I still don't know how to cross compile GCC and GLIBC, as I only need GCC I'm going to mark this as closed.

If I can, I'll come back to this post and mark what I eventually did.

EDIT:

Checkout this.

这篇关于构建ARM GNU Cross编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆