交叉编译tslib和qt4.7.3 并在real6410上测试通过。

来源:互联网 发布:妙味课堂js课后作业 编辑:程序博客网 时间:2024/06/03 18:09

交叉编译4.7.3的应该有很多,qt交叉编译的资料也很多。我对自己编译过程中的心得体会和一些看法。

整个过程,应该是tslib --配置--qt---配置---测试。


(1)下载qt

qtsdk 是个bin为后缀的文件,可以直接在ubuntu10.04上复制文件,可见qt是个封闭而强大的系统。如果在面板上启动qtcreatoer,说没root权限不能访问,就吧/root chmod  777下就可以启动qtcreateor了。qt安装好的文件夹是可以直接删掉的。


交叉编译qt,需要源码。qt for x86 linux 和qt for embedded linux的src,是同一个文件。所谓的qt everywhere。

(2)解压缩到qtsrcpath

 tar xvf qt-4.7.3.tar.gz -C qtsrcpath

qt src 下直接configure是x11的configure 帮助。

需要./configure --embedded --help 得到嵌入式版本的选项。


(3)configure 脚本

qt的configure脚本很有特点,与众不同。

qt 默认的一些包是auto的,也就是自动检测,采用默认配置。

如果明确指明no,就是不用。

! no 的意思是 yes 或者auto


(4)ts库找不到的问题

参考http://www.linuxidc.com/Linux/2011-05/36047.htm和http://hi.baidu.com/%D3%F3%C4%E0%C4%EA%B8%E2/blog/item/bc2a70bf42aadd1319d81fd3.html

/lib/libQtGui.so: undefined reference to `ts_open' 如果遇到这个是因为ts 库没有找到。不是说加了L和I路径就够了,还需要 加上-lts 。

参考  http://hi.baidu.com/huicxu/blog/item/3b7086c348f01b080ff47783.html

和http://hi.baidu.com/rtfsco/blog/item/cb464b08f9e7e16e3812bb02.html

mkspecs/qws/linux-arm-g++    中加上,虽然我启用的是armv6,但是仍旧是执行linux-arm-g++这个文件中的CC命令,我到现在都挺费解的。


关于找到ts库的配置的问题,参看http://www.friendlyarm.net/forum/topic/906 ,这里有个清晰的评论。

https://bugreports.qt.nokia.com//browse/QTBUG-7855?page=com.atlassian.jira.plugin.system.issuetabpanels%253Aall-tabpanel


需要注意的是,qt-embedded是有4.5.x的版本的,这个时候的configure选项是和4.6 everywhere之后i的版本不同的。

(5)configure 中有个 pkgconfig的警告不知道怎么解决。pkgconfig的路径,我也没敢在环境变量中指定。


今天发现,在root@ubuntu:/usr/local/arm/4.3.1-eabi-armv6/usr/bin# 这个目录下有pkg-config可执行文件呢。

(6)phonon的问题

phonon的问题在于需要gstreamer作为后端,参考http://www.cnblogs.com/yc_sunniwell/archive/2010/07/01/1769163.html。

如果需要phonon,但是不要phonon-backend,configure可以过,但是make不过


报错如下:



/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtHelp.so: undefined reference to 


`QCLuceneStopAnalyzer::englishStopWords() const'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtWebKit.so: undefined reference to 
`Phonon::MediaObject::play()'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtHelp.so: undefined reference to `QCLuceneDocument::add
(QCLuceneField*)'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtWebKit.so: undefined reference to 
`Phonon::MediaObject::totalTime() const'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtHelp.so: undefined reference to `QCLuceneHits::length() 
const'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtWebKit.so: undefined reference to 
`Phonon::AudioOutput::setVolume(float)'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtHelp.so: undefined reference to 
`QCLuceneIndexReader::~QCLuceneIndexReader()'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtWebKit.so: undefined reference to `Phonon::Path::~Path()'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtHelp.so: undefined reference to 
`QCLuceneStandardAnalyzer::QCLuceneStandardAnalyzer()'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtWebKit.so: undefined reference to 
`Phonon::MediaSource::~MediaSource()'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtWebKit.so: undefined reference to 
`Phonon::MediaObject::MediaObject(QObject*)'
/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/lib/libQtHelp.so: undefined reference to `QCLuceneTerm::QCLuceneTerm
(QString const&, QString const&)'
collect2: ld returned 1 exit status
make[4]: *** [../../../../bin/assistant] Error 1
make[4]: Leaving directory `/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/tools/assistant/tools/assistant'
make[3]: *** [sub-assistant-make_default-ordered] Error 2
make[3]: Leaving directory `/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/tools/assistant/tools'
make[2]: *** [sub-tools-make_default-ordered] Error 2
make[2]: Leaving directory `/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/tools/assistant'
make[1]: *** [sub-assistant-make_default-ordered] Error 2
make[1]: Leaving directory `/home/zhangbin/qt/qt-everywhere-opensource-src-4.7.3/tools'
make: *** [sub-tools-make_default-ordered] Error 2


所以我没有明确指明需要phonon。make 就能过去了。

armfpa和sqlite都是默认会启用的,也不需要明确指明需要。

(7) -qt-mouse-pc  干嘛用的,我也没有明白。参考http://www.qtcn.org/bbs/simple/?t8170.html

(8)从ok6410复制来4.7.1的demo,在real6410上测试是可以通过的。

(9)tslib是从git上下载的。生成configure时,如果没有完成autogen的所有过程,就是没看到done出现。也没事。configure 有了,make make install,移植后,一样用,ts的测试程序都可以顺利执行。而且qt 的demo程序访问pointercal文件成功之后,就可以直接用了。



图片和其他资料在整理和补充中



我发现exmaple文件夹是生成了的,好像make install 没有把他们安装到目录中去,但源码中是有的,也确实被编译为arm deELF格式。可能需要自己copy过去吧。


原创粉丝点击