二、buildroot-2015.02编译根文件系统支持Qt

环境搭建和buildroot简单的介绍请看:http://blog.csdn.net/lidroid/article/details/48022405

在buildroot中想要编译第三方的库,都在Taget Packages中,如待会编译的Qt(这里使用的是buildroot-2015-02的版本,配置和之前一样)

二、buildroot-2015.02编译根文件系统支持Qt_第1张图片

一、配置编译Qt

root@zxl:/work/tools/buildroot-2015.02# make menuconfig

Target packages  ---> 
	Graphic libraries and applications (graphic/text)  --->
		[*] Qt  --->
			Library type (Shared library)  ---> //选择编译成共享库
			[*]   Approve free license		    //导入自由许可证
			Pixel depths  --->
				[*] 16 bpp, rgb 5-6-5 
				[*] 24 bpp, rgb 8-8-8	
				[*] 32 bpp, argb 8-8-8-8 and rgb 8-8-8
			Fonts  ---> 						//个人全部选上,字库
			freetype2 support (System freetype2)  ---> 
			JPEG support (System libjpeg)  --->
			zlib support (System zlib)  ---> 	
			Graphics drivers  ---> 
				[*] Linux Framebuffer
			Mouse drivers  --->
				[*] linuxtp
				[*] linux input	 
				[*] tslib
			


二、编译buildroot(编译时间,老爷机编译了2个小时左右),查看根文件系统是否安装了Qt相关的库

root@zxl:/work/tools/buildroot-2015.02# ls output/target/usr/lib/libQ*
output/target/usr/lib/libQtCore.so.4      output/target/usr/lib/libQtGui.so.4.8.6      output/target/usr/lib/libQtScript.so.4.8
output/target/usr/lib/libQtCore.so.4.8    output/target/usr/lib/libQtNetwork.so.4      output/target/usr/lib/libQtScript.so.4.8.6
output/target/usr/lib/libQtCore.so.4.8.6  output/target/usr/lib/libQtNetwork.so.4.8    output/target/usr/lib/libQtXml.so.4
output/target/usr/lib/libQtGui.so.4       output/target/usr/lib/libQtNetwork.so.4.8.6  output/target/usr/lib/libQtXml.so.4.8
output/target/usr/lib/libQtGui.so.4.8     output/target/usr/lib/libQtScript.so.4       output/target/usr/lib/libQtXml.so.4.8.6
root@zxl:/work/tools/buildroot-2015.02# 
三、挂载根文件系统并且测试Qt

3.1、编译Qt的测试程序,进入qt源码

root@zxl:/work/tools/buildroot-2015.02/output/build/qt-4.8.6# ls4
bin              config.tests   doc       INSTALL             LICENSE.GPL3  plugins       src           util
changes-4.8.6    configure      examples  LGPL_EXCEPTION.txt  LICENSE.LGPL  projects.pro  templates
config.profiles  configure.exe  imports   lib                 Makefile      qmake         tools
config.status    demos          include   LICENSE.FDL         mkspecs       README        translations
root@zxl:/work/tools/buildroot-2015.02/output/build/qt-4.8.6#
上面的demos为Qt源码自带的例子,咱们就使用其来测试即可。测试前先要qmake -project在qmake在make即可生成Qt可执行文件。

第一个问题:qmake这个命令在哪里?答:在buildroot-2015.02/output/build/qt-4.8.6/bin/qmake

root@zxl:/work/tools/buildroot-2015.02/output/build/qt-4.8.6/demos/mainwindow# ../../bin/qmake 
root@zxl:/work/tools/buildroot-2015.02/output/build/qt-4.8.6/demos/mainwindow# make
moc colorswatch.cpp
compiling colorswatch.cpp
compiling mainwindow.cpp
compiling toolbar.cpp
compiling main.cpp
moc colorswatch.h
compiling .moc/release-shared-emb-arm/moc_colorswatch.cpp
moc mainwindow.h
compiling .moc/release-shared-emb-arm/moc_mainwindow.cpp
moc toolbar.h
compiling .moc/release-shared-emb-arm/moc_toolbar.cpp
rcc mainwindow.qrc
compiling .rcc/release-shared-emb-arm/qrc_mainwindow.cpp
linking mainwindow
root@zxl:/work/tools/buildroot-2015.02/output/build/qt-4.8.6/demos/mainwindow# ls
colorswatch.cpp  main.cpp    mainwindow.cpp  mainwindow.pro  Makefile  titlebarCenter.png  titlebarRight.png  toolbar.h
colorswatch.h    
mainwindow.h    mainwindow.qrc  qt.png    titlebarLeft.png    toolbar.cpp
root@zxl:/work/tools/buildroot-2015.02/output/build/qt-4.8.6/demos/mainwindow#
3.2、把生成的mainwindow拷贝到挂载的文件系统去运行:

./mainwindow  -qws

3.3、开发板挂载和qt在板子上运行的效果:

二、buildroot-2015.02编译根文件系统支持Qt_第2张图片


二、buildroot-2015.02编译根文件系统支持Qt_第3张图片





你可能感兴趣的:(buildroot)