请教:搭建交叉编译工具链问题?
时间:2008-06-30
来源:互联网
用crosstool-0.43搭建交叉编译工具链,编译过程中提示说i686-host_pc-linux-ar命令未找到?不知道怎么解决,还请大虾们不吝赐教。我用的是Redhat Enterprise 5.
作者: zhl168 发布时间: 2008-06-30
我没有碰到这样的问题,也许很幸运。不过从表象上是你的配置不对,你可以仔细check一下你的配置。下面是我的过程
wget http://kegel.com/crosstool/crosstool-0.43.tar.gz
tar -xzvf crosstool-0.43.tar.gz
做些修改工作
------------------------------------------------------------------------
arm9tdmi.dat 改TARGET,如TARGET=arm-linux,最后得到的就是arm-linux-gcc
-----------------------------
KERNELCONFIG=`pwd`/arm.config
TARGET=arm-linux
GCC_EXTRA_CONFIG="--with-cpu=arm9tdmi --enable-cxx-flags=-mcpu=arm9tdmi"
TARGET_CFLAGS="-O"
-----------------------------------------------------------------------
-----------------------------------------------------------------------
gcc-4.1.0-glibc-2.3.2.dat :下面这些包就是自动要下载的,默认不改
-----------------------------
BINUTILS_DIR=binutils-2.16.1
GCC_CORE_DIR=gcc-3.3.6
GCC_DIR=gcc-4.1.0
GLIBC_DIR=glibc-2.3.2
LINUX_DIR=linux-2.6.15.4
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.2
GDB_DIR=gdb-6.5
------------------------------------------------------------------------
------------------------------------------------------------------------
demo-arm9tdmi.sh 我修改了安装目录的 RESULT_TOP=$HOME/crosstool
-----------------------------------------------------------
#!/bin/sh
# This script has one line for each known working toolchain
# for this architecture. Uncomment the one you want.
# Generated by generate-demo.pl from buildlogs/all.dats.txt
set -ex
TARBALLS_DIR=$HOME/downloads
RESULT_TOP=$HOME/crosstool
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++" // 如果碰到stdc++错误,可以先去掉支持C++的选项
export GCC_LANGUAGES
# Really, you should do the mkdir before running this,
# and chown /opt/crosstool to yourself so you don't need to run as root.
mkdir -p $RESULT_TOP
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2.dat` sh all.sh --notest
eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2-tls.dat` sh all.sh --notest
echo Done.
--------------------------------------------------------------------------
cd $home/crosstool-0.43
./demo-arm9tdmi.sh
慢慢等待,最后看到下面内容就成功了
+ echo testhello: C compiler can in fact build a trivial program.
testhello: C compiler can in fact build a trivial program.
+ test '' = 1
+ test '' = 1
+ test '' = 1
+ test 1 = ''
+ echo Done.
Done.
-----------------------------------------------------------------------------
测试一下交叉编译工具
写一个简单的c程序test.c:
----------------------------
#include <stdio.h>
int main()
{
printf("hello,world!\n");
return 0;
}
----------------------------
PATH=/home/wei/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/bin
arm-linux-gcc -o test test.c
PATH=/usr/bin
file test
显示下面内容说明成功
test: ELF 32-bit LSB executable, ARM, version 1, for GNU/Linux 2.4.18, dynamically linked (uses shared libs), not stripped
----------------------------------------------------------------------------------------------------------------------
改回gcc4.2.4版
sudo rm /usr/bin/gcc
sudo mv /usr/bin/gcc-4.2.4 /usr/bin/gcc
wget http://kegel.com/crosstool/crosstool-0.43.tar.gz
tar -xzvf crosstool-0.43.tar.gz
做些修改工作
------------------------------------------------------------------------
arm9tdmi.dat 改TARGET,如TARGET=arm-linux,最后得到的就是arm-linux-gcc
-----------------------------
KERNELCONFIG=`pwd`/arm.config
TARGET=arm-linux
GCC_EXTRA_CONFIG="--with-cpu=arm9tdmi --enable-cxx-flags=-mcpu=arm9tdmi"
TARGET_CFLAGS="-O"
-----------------------------------------------------------------------
-----------------------------------------------------------------------
gcc-4.1.0-glibc-2.3.2.dat :下面这些包就是自动要下载的,默认不改
-----------------------------
BINUTILS_DIR=binutils-2.16.1
GCC_CORE_DIR=gcc-3.3.6
GCC_DIR=gcc-4.1.0
GLIBC_DIR=glibc-2.3.2
LINUX_DIR=linux-2.6.15.4
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.2
GDB_DIR=gdb-6.5
------------------------------------------------------------------------
------------------------------------------------------------------------
demo-arm9tdmi.sh 我修改了安装目录的 RESULT_TOP=$HOME/crosstool
-----------------------------------------------------------
#!/bin/sh
# This script has one line for each known working toolchain
# for this architecture. Uncomment the one you want.
# Generated by generate-demo.pl from buildlogs/all.dats.txt
set -ex
TARBALLS_DIR=$HOME/downloads
RESULT_TOP=$HOME/crosstool
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++" // 如果碰到stdc++错误,可以先去掉支持C++的选项
export GCC_LANGUAGES
# Really, you should do the mkdir before running this,
# and chown /opt/crosstool to yourself so you don't need to run as root.
mkdir -p $RESULT_TOP
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2.dat` sh all.sh --notest
eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2-tls.dat` sh all.sh --notest
echo Done.
--------------------------------------------------------------------------
cd $home/crosstool-0.43
./demo-arm9tdmi.sh
慢慢等待,最后看到下面内容就成功了
+ echo testhello: C compiler can in fact build a trivial program.
testhello: C compiler can in fact build a trivial program.
+ test '' = 1
+ test '' = 1
+ test '' = 1
+ test 1 = ''
+ echo Done.
Done.
-----------------------------------------------------------------------------
测试一下交叉编译工具
写一个简单的c程序test.c:
----------------------------
#include <stdio.h>
int main()
{
printf("hello,world!\n");
return 0;
}
----------------------------
PATH=/home/wei/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/bin
arm-linux-gcc -o test test.c
PATH=/usr/bin
file test
显示下面内容说明成功
test: ELF 32-bit LSB executable, ARM, version 1, for GNU/Linux 2.4.18, dynamically linked (uses shared libs), not stripped
----------------------------------------------------------------------------------------------------------------------
改回gcc4.2.4版
sudo rm /usr/bin/gcc
sudo mv /usr/bin/gcc-4.2.4 /usr/bin/gcc
作者: topeqin 发布时间: 2008-11-19
你可以看看openembedded 的环境 http://www.openembedded.org
作者: 风雪狂客 发布时间: 2008-11-20
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28