为什么在ubuntu编译下uboot时总是出错?

内核编译和嵌入式产品的设计与开发
回复
greatsnows
帖子: 43
注册时间: 2005-11-24 1:26

为什么在ubuntu编译下uboot时总是出错?

#1

帖子 greatsnows » 2007-02-07 21:06

本人用的是6.06的ubuntu。
经多次试验确认,在ubuntu编译下uboot时总是出现以下错误:

img2srec.c:56:19: error: stdio.h: No such file or directory
img2srec.c:57:20: error: stdlib.h: No such file or directory
img2srec.c:58:19: error: ctype.h: No such file or directory
img2srec.c:59:20: error: string.h: No such file or directory
In file included from img2srec.c:60:
../include/elf.h:43:20: error: stdint.h: No such file or directory
In file included from img2srec.c:60:
../include/elf.h:58: error: syntax error before 'Elf32_Addr'
../include/elf.h:59: error: syntax error before 'Elf32_Off'
../include/elf.h:60: error: syntax error before 'Elf32_Sword'
。。。。。。。

我使用公司的redhat服务器编译相同的代码,可以顺利完成编译。编译链也是一样的,真搞不懂为什么了。
请指教,谢谢!
jarodwang
帖子: 22
注册时间: 2006-07-13 0:26
来自: Shenzhen

#2

帖子 jarodwang » 2007-02-07 21:50

这个img2srec.c是tools目录下面的吧,看看这个目录下面的Makefile就知道了:
这个目录下面的程序都是用HOSTCC编译的,也就是你的6.06上的GCC编译器,跟交叉编译环境没有关系。
你首先检查一下你的6.06上面有没有安装GCC,没有的话就用sudo apt-get install build-essential安装一下。
我用的是6.10,编译u-boot基本没什么问题。
Good luck!
Only the paranoid survive.
greatsnows
帖子: 43
注册时间: 2005-11-24 1:26

感谢你的回复!!!

#3

帖子 greatsnows » 2007-02-08 0:43

说得有理有据,感谢!!!
我按照你说的安装了GCC后,
发现还出现了一下错误:
/usr/local/arm/2.95.3/bin/arm-linux-ar crv libstubs.a stubs.o
a - stubs.o
make[1]: *** No rule to make target `hello_world.srec', needed by `all'. Stop.
make[1]: Leaving directory `/home/aaron/share/u-boot-20060523/examples'
make: *** [examples] Error 2


呵呵,很晚了我脑袋已经不转了。。。
头像
volans
帖子: 67
注册时间: 2006-11-15 14:28
来自: Beijing

#4

帖子 volans » 2007-02-08 9:05

hello_world是一个例子,我记得可以在某个makefile里面把编译examples这个干掉,他根本没什么用。
具体的未知我不太清除了,你找找看……
greatsnows
帖子: 43
注册时间: 2005-11-24 1:26

谢谢提醒!

#5

帖子 greatsnows » 2007-02-08 9:16

我试试看,我还有下面一个问题。

我现在用3.4.1的编译链编译u-boot时还是会出现以下错误;
lib_arm/libarm.a(_udivsi3.o)(.text+0x8c):/home/aaron/share/u-boot-1.1.6/lib_arm/_udivsi3.S:67: relocation truncated to fit: R_ARM_PLT32 __div0
lib_arm/libarm.a(_umodsi3.o)(.text+0xa8):/home/aaron/share/u-boot-1.1.6/lib_arm/_umodsi3.S:79: relocation truncated to fit: R_ARM_PLT32 __div0
make: *** [u-boot] Error 1

这是怎么回事呢?谢谢回复!!
greatsnows
帖子: 43
注册时间: 2005-11-24 1:26

感谢jarodwang和volans。

#6

帖子 greatsnows » 2007-02-08 9:23

感谢两位3楼的问题也解决了,在顶层Makefile中把example前加上“#”,如下:

SUBDIRS = tools \
#examples \
post \
post/cpu
.PHONY : $(SUBDIRS)

还请大家看看我5楼的问题。
jarodwang
帖子: 22
注册时间: 2006-07-13 0:26
来自: Shenzhen

#7

帖子 jarodwang » 2007-02-08 11:11

呵呵,不客气,其实3楼的问题我也遇到过,在Makefile把examples从对SUBDIRS的赋值中去掉就好了。

5楼的问题我没遇见过,不过说了半天楼主也没有说编译的是哪个版本的u-boot?

我个人是用cross-2.95.3编译的u-boot-1.1.4,cross-2.95.3的工具链是从arm.linux.org.uk的FTP下载的。
Only the paranoid survive.
greatsnows
帖子: 43
注册时间: 2005-11-24 1:26

感谢关注!

#8

帖子 greatsnows » 2007-02-08 12:17

我是个新手,所以很多问题都描述不清楚。不好意思。
我现在用3.3.2的编译链编译u-boot-1.2.0,基本没什么问题了。谢谢


5楼那个问题是软浮点的问题,解决办法见下:
http://blog.tianya.cn/blogger/post_show ... 9149&Key=0
当然也是和编译链的版本有关。

最后,推荐大家用3.3.2来编译u-boot-1.2.0,不会出现以上问题。
头像
volans
帖子: 67
注册时间: 2006-11-15 14:28
来自: Beijing

#9

帖子 volans » 2007-02-08 17:10

楼主客气了,每天来看看,就是为了和大家分享问题的。很高兴可以帮上忙。


这里人气比较弱,有问题一定要拿来分享啊……
zrainx
帖子: 10
注册时间: 2006-05-16 12:36

#10

帖子 zrainx » 2007-02-10 22:08

装 3.80 的 make ,就可以编译通过了。
我试过了。
bigfoot
帖子: 1
注册时间: 2007-05-17 10:29

#11

帖子 bigfoot » 2007-05-17 10:35

我也是装的6.1,其gcc 是 4.1.2, make 是 3.8.1,但make u-boot1.1.6时与3楼现象一样。有遇到这样问题的吗?谢谢
gflfof
帖子: 1
注册时间: 2007-05-15 19:03

#12

帖子 gflfof » 2007-07-31 22:41

我也在编译1.1.6时出错了,错误描述如下:
make[1]: Entering directory `/home/gflfof/Desktop/uboot/SourceCode/u-boot-1.1.6/post'
arm-linux-gcc -D__ASSEMBLY__ -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -malignment-traps -D__KERNEL__ -DTEXT_BASE=0xc0f80000 -I/home/gflfof/Desktop/uboot/SourceCode/u-boot-1.1.6/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/lib/gcc/arm-linux/3.4.4/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -mtune=arm7tdmi -mapcs-32 -c -o cache_8xx.o cache_8xx.S
Assembler messages:
Fatal error: Invalid -march= option: `armv4'
make[1]: *** [cache_8xx.o] 错误 2
make[1]: Leaving directory `/home/gflfof/Desktop/uboot/SourceCode/u-boot-1.1.6/post'
make: *** [post] 错误 2

谁给给我解释一下这个规则是从哪里来的?
回复