Chinaunix首页 | 论坛 | 博客
  • 博客访问: 306581
  • 博文数量: 55
  • 博客积分: 4000
  • 博客等级: 上校
  • 技术积分: 615
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-07 13:47
文章分类
文章存档

2011年(1)

2010年(2)

2009年(14)

2008年(38)

我的朋友

分类: LINUX

2008-11-24 17:19:51


前两天碰到的一个问题终于得到初步的解决:做完qt移植到pxa255的移植之后,我用交叉编译器编译了一个小小的程序,不知道怎么回事,使劲百般功夫, 总是不能够通过,总是出错,显示/usr/local/hybus-arm-linux-R1.1/arm-linux/bin/ld: cannot find lqte的错误,如下:

[root@localhost hello]# make
arm-linux-g++  -o hello hello.o   -L/pxa255/qt-2.3.7/lib -lm -lqte
/usr/local/hybus-arm-linux-R1.1/arm-linux/bin/ld: cannot find -lqte
collect2: ld returned 1 exit status
make: *** [hello] Error 1

可以看出是找不到库文件libqte,可是我明明已经在前面移植到时候生成了libqte2.3.7.so这个库文件了啊,为什么还说找不到,
打开它的makefile文件,看到LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lm -lqte这么一句话,它要用到$QTDIR这个环境变量,echo了一下$QTDIR,发现不对劲,它的内容不是/pxa255/qt-2.3.7(我 qt-embedded解压后的库就是这个路径)路径,所以会出现找不到lqte的问题。修改它export QTDIR=/pxa255/qt-2.3.7,

重复上面的操作:
[root@localhost hello]# qmake -project
[root@localhost hello]# tmake -o makefile hello.pro
[root@localhost hello]# make
arm-linux-g++  -o hello hello.o   -L/pxa255/qt-2.3.7/lib -lm -lqte
/usr/local/hybus-arm-linux-R1.1/arm-linux/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
make: *** [hello] Error 1
又出现了如上所示的错误,这下又找不到lstdc++了,libstdc++没有这个库文件,找了一下ls /usr/local/hybus-arm-linux-R1.1/arm-linux/lib/,没有发现libstdc++这个库文件,
上网下了一个高版本的交叉编译器:arm-linux-gcc-3.3.2.tar.bz2,解压之后将lib/里的libstdc++*全复制到/usr/local/hybus-arm-linux-R1.1/arm-linux/lib/里去。

继续重复上面的操作。
[root@localhost hello]# qmake -project
[root@localhost hello]# tmake -o makefile hello.pro
[root@localhost hello]# make
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I. -I/pxa255/qt-2.3.7/include -o hello.o hello.cpp
arm-linux-g++  -o hello hello.o   -L/pxa255/qt-2.3.7/lib -lm -lqte
You have new mail in /var/spool/mail/root
[root@localhost hello]# file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped
错误解决,基本成功一半,但是暂时还没有将程序下载到板子上跑,还不知道能不能够在板子上跑起来,有时间了板子上再试一下吧。

总结:现在回头想一下,这个问题其实就不算是问题,关键原因在于自己经验不足。出现问题了不能没有头绪,要好好的分析一下出现错误的提示信息,然后再按照提示信息一步一步的解决,最终问题总能解决掉。

阅读(4160) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~