Qt-embedded-free-3.3.8在qt2410上的移植步骤
准备好需要的安装包:
arm-linux-cross-2.95.3.tar.bz2
qt-embedded-free-3.3.8.tar.bz2
qt-x11-free-3.3.8.tar.bz2
qtopia-free-1.7.
在home下建个自己的目录我的是renyc,然后分别建立x86和arm平台开发目录,命令如下:
[root@localhost root]# cd /home/renyc
[root@localhost root]# mkdir qtarm
[root@localhost root]# mkdir qtx86
然后把上述3个安装包分别拷到qtarm和qtx86目录下。
[root@localhost root]#cp qt-embedded-free-3.3.8.tar.bz2 /qtx86
[root@localhost root]#cp qt-x11-free-3.3.8.tar.bz2 /qtx86
[root@localhost root]#cp qtopia-free-1.7. /qtx86
[root@localhost root]#cp qt-embedded-free-3.3.8.tar.bz2 /qtarm
[root@localhost root]#cp qt-x11-free-3.3.8.tar.bz2 /qtarm
[root@localhost root]#cp qtopia-free-1.7. /qtarm
1、PC机搭建开发环境
第一步:首先安装交叉编译器
把arm-linux-cross-2.95.3.tar.bz2拷到/home/renyc目录下,解压到usr/local/arm/下,这是arm-linux-gcc安装的默认路径,不按这个路径安装可能会有问题,然后执行如下命令:[root@localhost root]#tar xfvz arm-linux-cross-2.95.3.tar.bz2 –C /
注意:-C后面有个空格,并且C是大写的,他是”Change”的第一个字母。
这样交叉编译器就安装到好了,在/usr/local/arm/2.95.3目录下,然后设置系统环境变量,执行如下命令:
[root@localhost root]#vi ~/.bashrc
打开~/.bashrc文件,在最后加上export PATH=$PATH:/usr/local/arm/2.95.3/bin,保存退出。
第二步:安装qt-x11
执行下列一系列命令进行安装:
[root@localhost root]#tar jxvf qt-x11-free-3.3.8.tar.bz2
[root@localhost root]#mv qt-x11-free-3.3.8 qtx11
[root@localhost root]#cd qtx11
[root@localhost root]#export QTDIR=$PWD
[root@localhost root]#echo yes | ./configure –static –thread
[root@localhost root]#make
[root@localhost root]#make install
然后到tools/qvfb下编译qvfb
[root@localhost root]#cd tools/qvfb
[root@localhost root]#make
编译完成之后,把qvfb拷贝到bin下
[root@localhost root]#cp qvfb ../../bin/
执行玩这一步,qt-x11就安装完毕。
第二步:按装qt-embedded-3.3.8-host
[root@localhost root]#tar jxvf qt-embedded-free-3.3.8.tar.bz2
[root@localhost root]#mv qt-embedded-free-3.3.8 qt-embeded-3.3.8-host
然后把qt-x11下的bin目录下的moc、uic和qvfb拷到qt-embedded-3.3.8-host的bin 目录下。
[root@localhost root]#export QTDIR=/home/renyc/Trolltech/qtx86/qt-embedded-3.3.8-host [root@localhost root]#export QPEDIR=/home/renyc/Trolltech/qtx86/qtopia-1.7.0-host
[root@localhost root]#PATH=$QTDIR/bin:$QPEDIR/bin:$PATH
[root@localhost root]#echo yes | ./configure –platform linux-generic-g++ -thread qpe –lqconfig
[root@localhost root]#make
[root@localhost root]#make install
第一步.
tar jxvf qt-x11-free-3.3.8.tar.bz2
mv qt-x11-free-3.3.8 qtx11
cd qtx11
export QTDIR=$PWD
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
. /configure
make
make -C tools/qvfb
mv tools/qvfb/qvfb bin
第二步
tar jxvf qt-embedded-free-3.3.8.tar.bz2
mv qt-embedded-free-3.3.8 qtarm
注意:把第一步qtx11/bin下交叉编译生成的moc、uic和qvfb拷贝到qtarm/bin下。
第三步
环境变量的设置
export QTDIR=/home/renyc/Trolltech/qtarm
export QTEDIR=$QTDIR
#export QMAKEDIR=$QTEDIR/mkspec
#export QMAKESPEC=$QMAKEDIR/qws/linux-generic-g++
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export PATH=$PATH:/usr/local/2.95.3/bin
. /configure –xplatform $QMAKEDIR/qws/linux-arm-g++ -embedded arm -shared –qt-gif –qt-zlib -no-cups -thread –stl -qt-sql-sqlite -ipv6 -depths 16,24,32 -qt-mouse-usb –qt-kbd-qmykbd -qt-kbd-usb –qt-kbd-tty
配置顺利通过,然后
Make
Make install
编译过程中遇到的错误:
1,/home/renyc/Trolltech/qtarm/bin/moc:cannot execute binary file Make[2]:***[.moc/debug-shared-mt-emb-arm/allmoc.cpp] Error 126
这个东西不好搞,不是这出问就是那出问题,但解快问题之后的爽劲就别提了!
1        Semop lock failure Identifier removed  错误
Semop lock failure Identifier removed
Semop unlock failure Identifier removed  不停的出现
这个问题还没有解决,这个问题是在安装3.x.x和4.x.x的时候出现的,一个重要的线索是
./configure --help 的时候并没有发现-qvfb 这个选项,难到3.x.x和4.x.x就不支持这个功能了,不太可能
也没太多的深纠,还请高手看到不吝指教。
2    Can't open framebuffer device /dev/fb0      错误
我在运行quit程序时,打入qvfb&后,没有界面显示,然后输入下面指令,出现如下错误:
./quit -qws
Can't open framebuffer device /dev/fb0
Can't open framebuffer device /dev/fb0
driver cannot connect
其实问题出在f这个文件,里面的变量发生了变化.
有两中方法解决:
1.在qvfb之前加上一句export QWS_DISPLAY=QVFb:0;
2.如果上述方法不行,哪只能从你的备份中把/root/Settings的f替换
3          helloworld.o: could not read symbols: File in wrong format
#ls
xrwxrwx    1 root    root        1496 1鏈?13 13:59 helloworld.o
-rwxrwxrwx    1 root    root        4124 1鏈?13 13:59 helloworld.png
-rwxrwxrwx    1 root    root          117 1鏈?13 13:59 helloworld.pro
-rw-r--r--    1 root    root          103 7鏈? 5 17:10 helloworldxing.pro
-rwxrwxrwx    1 root    root        1518 7鏈? 5 17:10 Makefile
[root@localhost 1]# progen -n hello -o hello.pro
[root@localhost 1]# tmake    hello.pro -o Makefile
[root@localhost 1]# maek
bash: maek: command not found
[root@localhost 1]# make
g++ -o hello helloworld.o -L/s3c2410_linux/QT/qt-2.3.7/lib -lqte
/
usr/bin/ld: helloworld.o: Relocations in generic ELF (EM: 40)
helloworld.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [hello] Error 1
[ root@localhost 1]# cd ..
server error啥意思[root@localhost QT_EX]# ls
用make clean 就好了嘿嘿!!,真。
原因可能是在当前目录下有旧的helloworld* ,可能是用交叉编译生成的,本次编译的时候由于硬件平台不同(本次平台是X86)格式认不出来了。
4      error while loading shared libraries: libqte.so.2: cannot open shared object file:
No such  file ordirectory
# ./xing
./xing: error while loading shared libraries: libqte.so.2: cannot open shared object file: No such file ordirectory
我也遇到过类似的问题,是因为环境变量设置的问题,QTEDIR和LD_LIBRARY_PATH这两个变量一定要指定到编译好QTE库才可以。
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
这是我的~/.bashrc最后的环境变量的设置
export LD_LIBRARY_PATH=/usr/local/lib
export PATH=$PATH:/usr/include
export PATH=$PATH:.:/s3c2410_linux/host/armv4l/armv4l-unknown-linux/include
export QTDIR=/s3c2410_linux/QT/qt-2.3.7
export TMAKE=/s3c2410_linux/QT/tmake
export TMAKEPATH=$TMAKE/lib/qws/linux-x86-g++
export PATH=$PATH:$TMAKE/bin
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
5 QT 多线程的有关错误
[root@localhost 9]# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -fno-default-inline -DNO_DEBUG -I/s3c2410_linux/QT/qt-2.3.7/include -o main.o main.cpp
In file included from mainwindow.h:17,
from main.cpp:13:
sinthread.h:27: parse error before `{' token
sinthread.h:28: non-member function `const char* className()' cannot have `
const' method qualifier
sinthread.h:28: parse error before `protected'
sinthread.h:33: parse error before `protected'
sinthread.h:41: parse error before `}' token
In file included from mainwindow.h:18,
from main.cpp:13:
trithread.h:27: parse error before `{' token
trithread.h:28: non-member function `const char* className()' cannot have `
const' method qualifier
trithread.h:28: parse error before `protected'
trithread.h:33: parse error before `protected'
trithread.h:39: redefinition of `QTimer*timer'
sinthread.h:39: `QTimer*timer' previously declared here
trithread.h:40: redefinition of `QFrame*frame'
sinthread.h:40: `QFrame*frame' previously declared here
trithread.h:41: parse error before `}' token
trithread.h:28: warning: `QMetaObject* staticMetaObject()' declared `static'
but never defined
trithread.h:28: warning: `QString tr(const char*)' declared `static' but never
defined
trithread.h:28: warning: `QString tr(const char*, const char*)' declared
`static' but never defined
{standard input}: Assembler messages:
{standard input}:7514: Error: symbol `timer' is already defined
{standard input}:7520: Error: symbol `frame' is already defined
make: *** [main.o] Error 1
[root@localhost 9]#
类似提示: sinthread.h:27: parse error before `{' token        在引QThread做为基类的地方报错(如 class SinThread: public QWidget,public QThread)
原因是:不到支线程的库,和宏 QT_THREAD_SUPPORT没有定义
解决方法:在工程文件(*.pro)里添加一行CONFIG += thread (看到有人这样说,我实验在上面的情况下,不加此项也可以)
在linux上作QT编程时生成的Makefile不完整,多线程时应作如下改动:
修改Makefile文件:
CXXFLAGS=。。。。。。 -DQT_THREAD_SUPPORT
LIBS=。。。。。。 -lqte-mt
红字体为需要添加的部分。此时编译即可通过。
6  error while loading shared libraries: libqt.so.2:
cannot open shared object file: No such file or directory
[root@localhost server]# ./server
./server: error while loading shared libraries: libqt.so.2: cannot open shared object file: No such file or directory
出现这种情况是程序没有到共享库libqt.so.2:,应该和LD_LIBRARY_PATH变量有关,正确设置即可。
7    cannot find -lqte  error(为使QT程序在Xwindows上运行而出现的。)
[root@localhost server]# ls
Makefile server.cpp serverpng server.pro

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。