天嵌 ARM开发社区

 找回密码
 注册
查看: 5580|回复: 16

有关tq2440 qt应用程序完全开发手册make问题,cannot find -lqpe

[复制链接]
dhajmd 发表于 2009-7-14 11:49:22 | 显示全部楼层 |阅读模式
有关tq2440 qt应用程序完全开发手册make问题,cannot find -lqpe 等等问题,收集
一下均为用户碰到的实际问题,总结经验!少走弯路!


我照說明做了三次,同樣都是出現這個錯誤......cross compiler :3.4.5 v61

g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86_qtopia/qt/include
-I/opt/EmbedSky/Qte/x86_qtopia/qtopia/include -o first.o first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86_qtopia/qt/include
-I/opt/EmbedSky/Qte/x86_qtopia/qtopia/include -o main.o main.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86_qtopia/qt/include
-I/opt/EmbedSky/Qte/x86_qtopia/qtopia/include -o moc_first.o moc_first.cpp
g++  -o /opt/EmbedSky/Qte/x86_qtopia/qtopia/bin/first first.o main.o first.o moc_first.o moc_first.o  -L/opt/EmbedSky/Qte/x86_qtopia/qtopia/lib -L/opt/EmbedSky/Qte/x86_qtopia/qt/lib -lqpe -lqtopia -lqte
first.o(.text+0x0): In function `first::first[not-in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `first::first[not-in-charge](QWidget*, char const*, unsigned)'
first.o(.text+0x0): first defined here
first.o(.text+0x398): In function `first::first[in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `first::first[in-charge](QWidget*, char const*, unsigned)'
first.o(.text+0x398): first defined here
first.o(.text+0x730): In function `first::~first [not-in-charge]()':
: multiple definition of `first::~first [not-in-charge]()'
first.o(.text+0x730): first defined here
first.o(.text+0x754): In function `first::~first [in-charge]()':
: multiple definition of `first::~first [in-charge]()'
first.o(.text+0x754): first defined here
first.o(.text+0x778): In function `first::~first [in-charge deleting]()':
: multiple definition of `first::~first [in-charge deleting]()'
first.o(.text+0x778): first defined here
first.o(.text+0x7a4): In function `first::event(QEvent*)':
: multiple definition of `first::event(QEvent*)'
first.o(.text+0x7a4): first defined here
first.o(.text+0x880): In function `first::user_button()':
: multiple definition of `first::user_button()'
first.o(.text+0x880): first defined here
moc_first.o(.text+0x0): In function `first::className() const':
: multiple definition of `first::className() const'
moc_first.o(.text+0x0): first defined here
moc_first.o(.data+0x0): multiple definition of `first::metaObj'
moc_first.o(.data+0x0): first defined here
moc_first.o(.text+0xc): In function `first::initMetaObject()':
: multiple definition of `first::initMetaObject()'
moc_first.o(.text+0xc): first defined here
moc_first.o(.text+0xcc): In function `first::staticMetaObject()':
: multiple definition of `first::staticMetaObject()'
moc_first.o(.text+0xcc): first defined here
moc_first.o(.text+0x74): In function `first::tr(char const*)':
: multiple definition of `first::tr(char const*)'
moc_first.o(.text+0x74): first defined here
moc_first.o(.text+0xa0): In function `first::tr(char const*, char const*)':
: multiple definition of `first::tr(char const*, char const*)'
moc_first.o(.text+0xa0): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86_qtopia/qtopia/bin/first] Error 1
 楼主| dhajmd 发表于 2009-7-14 16:51:25 | 显示全部楼层
我抓到問題所在了....在first.pro裡面必須將 INTERFACES = xxxx.ui 改掉....直接 INTETFACES =  (不加任何檔名),這樣在Makefile 裡不會重覆出現,造成這個錯誤,還有執行時有可能會出現 error while loading shared libraries: libqpe.so.1: cannot open shared object file: No such file or directory 因為ld.so.conf 有可能設錯或沒改,在之前的說明,原本執行./build 路徑是 /opt/EmbedSky/Qte/x86-qtopia/=>注意哦!x86後面是橫線,但在QT開發手冊中,./x86-build_qtopia指令後,路徑改為/opt/EmbedSky/Qte/x86_qtopia/=>注意哦!x86變底線;所以本人當初以為不用改動態函式庫(ld.so.conf),所以連結會不成功......
亚瑟王 发表于 2009-7-14 22:44:04 | 显示全部楼层
自己发现问题自己解决,很好啊,呵呵,我之前都没有想到怎么解决Makefile重复的问题,没办法,只好手动删除。
 楼主| dhajmd 发表于 2009-7-15 09:14:02 | 显示全部楼层
我也是GOOGLE搜尋看別人的經驗才知道的....
lyq140hf2006 发表于 2010-2-18 00:18:06 | 显示全部楼层
LZ说的非常有用,我编译就过了。还有pdf上版书的Makefile,first.cpp与我们实际生成的有很大区别,只需按照pdf上的说明,仅修改红色字体处。
aryer 发表于 2010-2-20 12:41:21 | 显示全部楼层

QT程序x86下编译不成功 “cannot find -lqpe”

本帖最后由 aryer 于 2010-2-20 12:44 编辑

问题说明:
1. 下载TQ2440_20100125.iso,参照光盘中的《Qt程序开发完全手册》20091216版所述,Qt环境建立后,做了first程序,但是make后失败,提示“cannot find -lqpe”。然后,我用光盘自带的几个例子,没有对它们做任何修改,make也不成功,也是提示“cannot find -lqpe”。

2. arm的可以编译成功,并且只要把执行文件、启动脚本、图片文件拷贝到相应的目录下面,就可以正常启动。


环境说明:
1. 操作系统:Fedora 10和RedHat 9,都是完全安装的,甚至里面的语言包、游戏等等都统统地装了。这两个系统我都试了,都是一样的问题。

2. Qt开发包:上述光盘中的《Qte_20091216.tar.bz2》


另外:
Qt的安装我觉得应该没有什么问题的,qvfb、qpe可以正常启动。
aryer 发表于 2010-2-20 12:52:32 | 显示全部楼层
另外,我还想请教一个问题:
arm下的程序为什么一定要放到相应的目录下面才可以,而且一定要用启动脚本?
tyblly 发表于 2010-2-21 11:14:30 | 显示全部楼层
缺少 libqpe.so.* 库文件
用命令 locate libqpe.so 查看是否存在这几个库文件,如果有,复制到 QTE 的源代码的lib文件夹中
如果没有,上网载

ARM下的程序放到相应目录是为了方便启动,使用脚本启动的原因是为了设置一些这个程序所依赖的环境变量
aryer 发表于 2010-2-23 10:24:33 | 显示全部楼层
还是不行,不知真么弄,我把操作贴出来吧:

[root@opoint first]# locate libqpe.so
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/lib/libqpe.so
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/lib/libqpe.so.1
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/lib/libqpe.so.1.5
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/lib/libqpe.so.1.5.3
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib/libqpe.so
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib/libqpe.so.1
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib/libqpe.so.1.5
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib/libqpe.so.1.5.3
[root@opoint first]# cp /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib/libqpe.so* /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib/
[root@opoint first]# make
arm-linux-g++  -o /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first main.o first.o moc_first.o  -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -lm -lqpe -lqtopia -lqte
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib/libqpe.so when searching for -lqpe
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib/libqpe.so when searching for -lqpe
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lqpe
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first] Error 1
aryer 发表于 2010-2-23 21:28:39 | 显示全部楼层
本帖最后由 aryer 于 2010-2-23 21:29 编辑

解决了!
我一天都在看贴,终于找到解决方法了,只要把*.pro文件修改一下:
TEMPLATE                 =app
CONFIG                    =qtopia warn_on release     
HEADERS                  =first.h
SOURCES                  =first.cpp \
                                    main.cpp
INTERFACES            =                           #如此修改该行

我将之前拷贝的libqpe.so*库文件全部删除,只修改pro文件,已经编译通过了。20100125版本光盘中自带的其它几个例子,我一一试过,都是只要修改该文件,就可以通过。

据说原因是出现重复定义的问题!(目前我还不是很了解这句话:P )
aryer 发表于 2010-2-24 10:29:51 | 显示全部楼层
出现新情况:
如上述修改后,在x86下编译没有问题了,但是转入arm就出现问题了:“cannot find -qtopia"

取消上述修改,再编译,还是不行!

再修改,再编译,行了!

嗟夫哉,怪也吁!

我在两台电脑上试过,都是fedora 10,环境都是按20100125光盘介绍建立的。
tyblly 发表于 2010-2-24 11:19:34 | 显示全部楼层
本人没有使用TQ自带的qtopia,是自己根据网友的指点进行移植
我是 fedora 11,在编译arm版本qtopia过程中都是缺少什么库就补什么库,最后移植成功
aryer 发表于 2010-2-24 17:57:41 | 显示全部楼层
我想抓紧时间搞出来,所以尽量用比较成熟,有一定用户量的东西,这样碰到问题,有很多高手可以请教。等我像你一样玩熟透了,再搞搞最新的东东。

另外,*.pro文件修改后,make会使MakeFile重新生成的!是不是这个原因导致上述怪异到情况?
embedsky Team 发表于 2010-2-24 18:12:56 | 显示全部楼层
我想抓紧时间搞出来,所以尽量用比较成熟,有一定用户量的东西,这样碰到问题,有很多高手可以请教。等我像你一样玩熟透了,再搞搞最新的东东。

另外,*.pro文件修改后,make会使MakeFile重新生成的!是不是这个原 ...
aryer 发表于 2010-2-24 17:57


在编译qt2程序的时候,只要重新生成了makefile 文件 都要注意makefile文件里面有重复的信息,要删除重复的信息才行,有可能是这个原因,期待您的好消息!
同时我们tq2440开发板配套光盘里面qt开发手册也有都有提到makefile的修改问题

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
aryer 发表于 2010-2-25 11:38:23 | 显示全部楼层
不是,修改前后我都看过MakeFile文件,它们是不一样的。pro文件修改后,我没有对Makefile文件作任何改动,make编译通过!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-9-28 03:22 , Processed in 1.018594 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

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