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

【已解决】Ubuntu下Eclipse中交叉编译Uboot出错:make[1]: arm-xscale-linux-gnueabi-gcc: Command not found

Eclipse crifan 3175浏览 0评论

【问题】

折腾:

【记录】Ubuntu下基于Eclipse去调用Makefile交叉编译Uboot

期间,编译出错:

22:21:49 **** Build of configuration Default for project HART-IP ****
make all 
make[1]: arm-xscale-linux-gnueabi-gcc: Command not found
make[1]: Entering directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/tools'
ln -s ../common/environment.c environment.c
ln -s ../lib_generic/crc32.c crc32.c
gcc -M -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x5c010000 -DUSE_HOSTCC environment.c img2srec.c mkimage.c crc32.c envcrc.c gen_eth_addr.c bmp_logo.c > .depend
make[1]: Leaving directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/tools'
make[1]: arm-xscale-linux-gnueabi-gcc: Command not found
make[1]: Entering directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/tools'
make[1]: `.depend' is up to date.
make[1]: Leaving directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/tools'
make[1]: arm-xscale-linux-gnueabi-gcc: Command not found
arm-xscale-linux-gnueabi-gcc -M -g  -Os   -fno-strict-aliasing  -fno-common -ffixed-r8  -D__KERNEL__ -DTEXT_BASE=0x5c010000 -I/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/include -fno-builtin -ffreestanding -nostdinc -isystem  -pipe  -DCONFIG_ARM -D__ARM__ -march=armv5 -mtune=xscale -Wall -Wstrict-prototypes cache_8xx.S cache.c codec.c cpu.c dsp.c ether.c i2c.c memory.c post.c rtc.c spr.c sysmon.c tests.c uart.c usb.c watchdog.c > .depend
make[1]: Entering directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/post'
/bin/sh: 1: arm-xscale-linux-gnueabi-gcc: not found
make[1]: *** No rule to make target `.depend'.  Stop.
make[1]: arm-xscale-linux-gnueabi-gcc: Command not found
make[1]: Entering directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/post/cpu'
/bin/sh: 1: arm-xscale-linux-gnueabi-gcc: not found
make[1]: *** No rule to make target `.depend'.  Stop.
make[1]: Leaving directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/post'
arm-xscale-linux-gnueabi-gcc -M -g  -Os   -fno-strict-aliasing  -fno-common -ffixed-r8  -D__KERNEL__ -DTEXT_BASE=0x5c010000 -I/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/include -fno-builtin -ffreestanding -nostdinc -isystem  -pipe  -DCONFIG_ARM -D__ARM__ -march=armv5 -mtune=xscale -Wall -Wstrict-prototypes asm.S cmp.c cmpi.c two.c twox.c three.c threex.c threei.c andi.c srawi.c rlwnm.c rlwinm.c rlwimi.c store.c load.c cr.c b.c multi.c string.c complex.c > .depend
make: *** [depend] Error 2
make[1]: Leaving directory `/home/crifan/develop/eclipse/workspace_root/HART-IP/BSP/Bootloader/u-boot-1.1.4-whgs/post/cpu'

22:21:50 Build Finished (took 878ms)

如图:

arm-xscale-linux-gnueabi-gcc Command not found

【解决过程】

1.此处,觉得有点奇怪的是,之前也是在Eclipse中,编译别的类似的项目:

【记录】Ubuntu下使用Eclipse编译一个基于makefile的C项目

为何却可以找到交叉编译器arm-xscale-linux-gnueabi呢?

2.然后后来才发现,原来之前的项目的makefile中,手动加入了交叉编译器的路径:

other project has contain cross compiler path in makefile

所以人家可以找到。而此处uboot中,没有包含对应路径,所以找不到。

3.所以,要把对应的,交叉编译器的路径:

/home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin

加到当前项目的路径中:

uboot project paths add gnu c xscale path

for gnu c   also add xscale path

然后再去编译试试,结果还是找不到。

4.然后去把整个项目去index->rebuild一下,再去试试,结果还是不行。

5.重启关闭Eclipse,重启一下,再试试,结果问题依旧。

6.后来想起来,貌似需要:

设置交叉编译器的时候,给定绝对路径

或者是:

要把上面的路径,加到Eclipse中的PATH中,才可以?

 

所以,先去试试后者:

uboot paths symbols gnu c add xscale to path for all languages

然后等待index重新build:

wait c c   indexer building

然后再去编译试试是否可以,结果问题依旧。

7.只好再去试试,把交叉编译器,改为带绝对路径的。

先去得到路径:

crifan@ubuntu:u-boot-1.1.4-whgs$ cd -
/home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin
crifan@ubuntu:bin$ /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-gcc --version
arm-xscale-linux-gnueabi-gcc (crosstool-NG 1.18.0) 4.6.0
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

crifan@ubuntu:bin$ which /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-gcc
/home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-gcc
crifan@ubuntu:bin$ 

即:

/home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-gcc

换到uboot的makefile中:

#CROSS_COMPILE = arm-xscale-linux-gnu-
#CROSS_COMPILE = arm-xscale-linux-gnueabi-
CROSS_COMPILE = /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-gcc

如图:

uboot set to full path no suffix gcc

然后再去编译试试,最后终于可以去编译了:

uboot normally build

8.后来,想起来了,其交叉编译器的路径,是另外在opt下面也有的,所以改为:

#CROSS_COMPILE = arm-xscale-linux-gnu-
#CROSS_COMPILE = arm-xscale-linux-gnueabi-
#CROSS_COMPILE = /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-
CROSS_COMPILE = /opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin/arm-xscale-linux-gnueabi-

 

【总结】

Ubuntu下的Eclipse中,交叉编译Uboot,在把交叉编译器,从:

CROSS_COMPILE = arm-xscale-linux-gnu-

改为当前自己的交叉编译器:

CROSS_COMPILE = arm-xscale-linux-gnueabi-

后,结果出错:

make[1]: arm-xscale-linux-gnueabi-gcc: Command not found

原因是:

Eclipse中,没加合适的路径,找不到交叉编译器。

注:

此处,是在.bashrc中修改了PATH的,确保已经加了此xscale的交叉编译器的:

#PATH=/opt/crosstool-ng/bin:$PATH
#PATH=/opt/crosstool-ng/bin:$HOME/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin:$PATH
#PATH=/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:$PATH
#PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin
#PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin
PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin:/usr/lib/jvm/java-1.7.0-openjdk-i386/

但是其针对于此处的Eclipse,是无效的。

而且,即使是在Eclipse去添加Symbol:

PATH=${PATH}:/home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin

(此处是另外一个路径:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin,也是同样的效果)

也还是找不到。

最后只能是:

在Makefile中,修改交叉编译器的时候,直接是改为带绝对路径的:

#CROSS_COMPILE = arm-xscale-linux-gnu-
#CROSS_COMPILE = arm-xscale-linux-gnueabi-
#CROSS_COMPILE = /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin/arm-xscale-linux-gnueabi-
CROSS_COMPILE = /opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin/arm-xscale-linux-gnueabi-

才可以正常的找到交叉编译器。

转载请注明:在路上 » 【已解决】Ubuntu下Eclipse中交叉编译Uboot出错:make[1]: arm-xscale-linux-gnueabi-gcc: Command not found

发表我的评论
取消评论

表情

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

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