LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 6894|回复: 15

在cygwin中安装uClinux-ARM交叉编译平台后运行arm-elf- gcc出错!!!

[复制链接]
发表于 2006-6-8 10:38:53 | 显示全部楼层 |阅读模式
可我在cygwin中安装完arm-elf-tools-20030314.sh(可从http: //www.uclinux.org/pub/uClinux/arm-elf-tools/下载)后,敲入arm-elf- gcc却只能得到如下信息:
$ ar-elf-gcc
/usr/local/bin/arm-elf-gcc: /usr/local/bin/arm-elf-gcc: cannot execute binary file

有哪位大虾知道这是为什么吗?
发表于 2006-6-8 12:35:16 | 显示全部楼层
cygwin 中和 linux 中使用的可执行程序的格式不同
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-9 11:54:44 | 显示全部楼层
那该怎么办呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-9 11:56:28 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2006-6-9 13:48:04 | 显示全部楼层
为什么非要在 cygwin 中不可呢. 装个 linux 也不麻烦

如果非要在 cygwin 中的话, 楼主只能考虑自己编译工具链, 简单地说, 目前这一步楼主就不能使用 arm-elf-tools-20030314.sh 进行安装, 而要手工编译 gcc for arm,
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-9 15:11:42 | 显示全部楼层

自己在cygwin中编译工具链遇到麻烦

DoDo兄,其实我也想干脆装个Linux算了,可我现在的本本硬盘太小,再说我一开始就把cygwin全安装了,所以暂时就懒得换了!:)
这两天我一直在尝试自己编译工具链,都快两天了,可还是没有成功,我是按照下面步骤来执行的,老兄你看我在那块出错了:
step1---
    修改cygwin.bat文件添加一行:set CYGWIN=title ntea
step2---
    cd cygwin/bin
    mv sh.exe sh-old.exe
    ln -s bash.exe sh.exe
step3---
   从 http://www.uclinux.org/pub/uClin ... 码,解压后:
   cd uClinux-dist
   make menuconfig

以上都未出错,但接着如果我:make dep则出错,如下信息
$ make dep
make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.4.x dep
make[1]: arm-elf-gcc: Command
make[1]: Entering directory `/uclinux/uClinux-dist/linux-2.4.x'
make[1]: Entering directory `/uclinux/uClinux-dist/linux-2.4.x'
.............

于是我又想是不是应该运行build-uclinux-tools.sh了,我下载的是http://www.uclinux.org/pub/uClinux/arm-elf-tools/tools-20030314
根据我机器上的文件存放位置我对build-uclinux-tools.sh进行了修改,如下:
#############################################################
#
# EDIT these to suit your system and source locations
#

MAKE=make
PATCH=patch
ELF2FLT="$BASEDIR/elf2flt"
UCLIBC="$BASEDIR/uClibc"
KERNEL="$BASEDIR/uClinux-dist/linux-2.4.x"
# KERNEL="$BASEDIR/uClinux-2.0.x"

# TARGET=m68k-elf
TARGET=arm-elf

# set your install directory here and add the correct PATH
PREFIX=/usr/local/
PATH="${PREFIX}/binPATH"; export PATH

# uncomment the following line to build for Cygwin
# you may also need to include your PATCH path specifically
CYGWIN=cygwin-
PATCH=/usr/bin/patch

#############################################################
#
修改完后运行./build-uclinux-tools.sh build 2>&1 | tee errs,当运行到stage3时又出现错误:
........
STAGE 2 - complete
--------------------------------------------------------
STAGE 3 - needs building
/bin/sh: arm-elf-gcc: command not found
/bin/sh: arm-elf-gcc: command not found
rm -rf include/bits
mkdir -p include/bits
./extra/config/conf: ./extra/config/conf: cannot execute binary file
make: *** [oldconfig] Error 126

到此我已经是没办法了,由上面出现的错误,我发觉在编译uClinux时好像要用到arm-elf-gcc,而在由./build-uclinux-tools.sh build 2>&1 | tee errs建立工具链时好像也要用到arm-elf-gcc,可arm-elf-gcc不是包含在工具链中吗?而此时工具链还没有建立起来啊?这究竟是怎么回事呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-9 15:16:35 | 显示全部楼层

自己在cygwin中编译工具链遇到麻烦

DoDo兄,其实我也想干脆装个Linux算了,可我现在的本本硬盘太小,再说我一开始就把cygwin全安装了,所以暂时就懒得换了!:)
这两天我一直在尝试自己编译工具链,都快两天了,可还是没有成功,我是按照下面步骤来执行的,老兄你看我在那块出错了:
step1---
    修改cygwin.bat文件添加一行:set CYGWIN=title ntea
step2---
    cd cygwin/bin
    mv sh.exe sh-old.exe
    ln -s bash.exe sh.exe
step3---
   从 http://www.uclinux.org/pub/uClin ... 码,解压后:
   cd uClinux-dist
   make menuconfig

以上都未出错,但接着如果我:make dep则出错,如下信息
$ make dep
make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.4.x dep
make[1]: arm-elf-gcc: Command
make[1]: Entering directory `/uclinux/uClinux-dist/linux-2.4.x'
make[1]: Entering directory `/uclinux/uClinux-dist/linux-2.4.x'
.............

于是我又想是不是应该运行build-uclinux-tools.sh了,我下载的是http://www.uclinux.org/pub/uClinux/arm-elf-tools/tools-20030314
根据我机器上的文件存放位置我对build-uclinux-tools.sh进行了修改,如下:
#############################################################
#
# EDIT these to suit your system and source locations
#

MAKE=make
PATCH=patch
ELF2FLT="$BASEDIR/elf2flt"
UCLIBC="$BASEDIR/uClibc"
KERNEL="$BASEDIR/uClinux-dist/linux-2.4.x"
# KERNEL="$BASEDIR/uClinux-2.0.x"

# TARGET=m68k-elf
TARGET=arm-elf

# set your install directory here and add the correct PATH
PREFIX=/usr/local/
PATH="${PREFIX}/binPATH"; export PATH

# uncomment the following line to build for Cygwin
# you may also need to include your PATCH path specifically
CYGWIN=cygwin-
PATCH=/usr/bin/patch

#############################################################
#
修改完后运行./build-uclinux-tools.sh build 2>&1 | tee errs,当运行到stage3时又出现错误:
........
STAGE 2 - complete
--------------------------------------------------------
STAGE 3 - needs building
/bin/sh: arm-elf-gcc: command not found
/bin/sh: arm-elf-gcc: command not found
rm -rf include/bits
mkdir -p include/bits
./extra/config/conf: ./extra/config/conf: cannot execute binary file
make: *** [oldconfig] Error 126

到此我已经是没办法了,由上面出现的错误,我发觉在编译uClinux时好像要用到arm-elf-gcc,而在由./build-uclinux-tools.sh build 2>&1 | tee errs建立工具链时好像也要用到arm-elf-gcc,可arm-elf-gcc不是包含在工具链中吗?而此时工具链还没有建立起来啊?这究竟是怎么回事呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-9 15:20:12 | 显示全部楼层

自己在cygwin中编译工具链遇到麻烦

DoDo兄,其实我也想干脆装个Linux算了,可我现在的本本硬盘太小,再说我一开始就把cygwin全安装了,所以暂时就懒得换了!:)
这两天我一直在尝试自己编译工具链,都快两天了,可还是没有成功,我是按照下面步骤来执行的,老兄你看我在那块出错了:
step1---
    修改cygwin.bat文件添加一行:set CYGWIN=title ntea
step2---
    cd cygwin/bin
    mv sh.exe sh-old.exe
    ln -s bash.exe sh.exe
step3---
   从 http://www.uclinux.org/pub/uClin ... 码,解压后:
   cd uClinux-dist
   make menuconfig

以上都未出错,但接着如果我:make dep则出错,如下信息
$ make dep
make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.4.x dep
make[1]: arm-elf-gcc: Command
make[1]: Entering directory `/uclinux/uClinux-dist/linux-2.4.x'
make[1]: Entering directory `/uclinux/uClinux-dist/linux-2.4.x'
.............

于是我又想是不是应该运行build-uclinux-tools.sh了,我下载的是http://www.uclinux.org/pub/uClinux/arm-elf-tools/tools-20030314
根据我机器上的文件存放位置我对build-uclinux-tools.sh进行了修改,如下:
#############################################################
#
# EDIT these to suit your system and source locations
#

MAKE=make
PATCH=patch
ELF2FLT="$BASEDIR/elf2flt"
UCLIBC="$BASEDIR/uClibc"
KERNEL="$BASEDIR/uClinux-dist/linux-2.4.x"
# KERNEL="$BASEDIR/uClinux-2.0.x"

# TARGET=m68k-elf
TARGET=arm-elf

# set your install directory here and add the correct PATH
PREFIX=/usr/local/
PATH="${PREFIX}/binPATH"; export PATH

# uncomment the following line to build for Cygwin
# you may also need to include your PATCH path specifically
CYGWIN=cygwin-
PATCH=/usr/bin/patch

#############################################################
#
修改完后运行./build-uclinux-tools.sh build 2>&1 | tee errs,当运行到stage3时又出现错误:
........
STAGE 2 - complete
--------------------------------------------------------
STAGE 3 - needs building
/bin/sh: arm-elf-gcc: command not found
/bin/sh: arm-elf-gcc: command not found
rm -rf include/bits
mkdir -p include/bits
./extra/config/conf: ./extra/config/conf: cannot execute binary file
make: *** [oldconfig] Error 126

到此我已经是没办法了,由上面出现的错误,我发觉在编译uClinux时好像要用到arm-elf-gcc,而在由./build-uclinux-tools.sh build 2>&1 | tee errs建立工具链时好像也要用到arm-elf-gcc,可arm-elf-gcc不是包含在工具链中吗?而此时工具链还没有建立起来啊?这究竟是怎么回事呢?
回复 支持 反对

使用道具 举报

发表于 2006-6-10 01:50:25 | 显示全部楼层
kernel 的编译器需要两套, 一套是本地用的, 一套是目标用的. 所以你在 make dep 之前的步骤都不会出错, 因为那都是本地的编译. 但是这之后就要用到交叉编译器了, 所以交叉编译器的安装是不可以略过的

arm-elf-gcc-xxx.sh 是 linux 下用的安装包, 它提供的 arm-elf-gcc 等命令都是 linux 的可执行格式, 但是是在 cyg-win 中使用的可执行程序好像基本上就是 Windows 格式. 所以你是不可以用此安装程序来安装工具链的, 安装了也无法运行.

下载 gcc 的源码, 以及需要的 patch, 自己在 cyg-win 下编译一个目标格式为 arm 的 gcc. 具体可以用 google 查, 好多资料的. 这一步通过后, 编译内核应该就没有问题了, 然后用 skyeye 仿真或者下载运行应该都问题不大了

不过, 强烈建议使用真正的 linux, 因为以后的麻烦其实还多着呢. 我帮同学装一个最小化的 debian, 然后装了 gcc 之类的工具, 一共用了200M多一点硬盘空间. 这绝对比装一个完整的 cyg-win 小的
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-12 14:01:40 | 显示全部楼层
Dodo兄,我照着你说的去做了一下,倒是把arm-elf-gcc给编译好了,但在运行./build-uclinux-tools.sh build 2>&1 | tee errs,当运行到stage3时还是出现错误:
........
STAGE 2 - complete
--------------------------------------------------------
STAGE 3 - needs building
rm -rf include/bits
mkdir -p include/bits
./extra/config/conf: ./extra/config/conf: cannot execute binary file
make: *** [oldconfig] Error 126
与前比较arm-elf-gcc: command not found错误确实消除了,但还是不能继续,为什么呢?
今天我把build-uclinux-tools.sh这个脚本仔细的看了一下,其实正如该脚本所说,它要做的就是
# This script:
#
# DOES build all the gcc tools/libraries   建立起GCC工具/库
#
# DOES build target specific versions of libc  建立目标libc
而这几天我自行下载GCC源码,binutils等自行编译的步骤实际上全包含在该脚本中了,这下我真的不能明白了,兄弟你能指点一下迷津不?
凡用过uclinux和在cygwin中成功建立过交叉编译器的兄弟姐妹们也来指点一下啊,非常感谢!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表