海思3536:交叉编译Qt4.8.4

来源:互联网 发布:js 字符串寻找子串 编辑:程序博客网 时间:2024/06/07 18:27

一、交叉编译qt

1、下载Qt源码包qt-everywhere-opensource-src-4.8.4.tar.gz;

2、解压Qt源码包tar -xvfzqt-everywhere-opensource-src-4.8.4.tar.gz

3、创建qmake.conf

3.1在qt-everywhere-opensource-src-4.8.4/mkspecs/qws/下创建linux-hisiv400-g++;

3.2将qt-everywhere-opensource-src-4.8.4/mkspecs/qws/linux-arm-g++/下内容拷贝到3.1新建的文件夹中;

3.3 修改qmake.conf,如下

   # 设置交叉编译工具链:

   # 本项目使用的交叉编译工具是 arm-hisiv400-linux-g++

   #

   QMAKE_CC                   = arm-hisiv400-linux-gcc

   QMAKE_CXX                 = arm-hisiv400-linux-g++

   QMAKE_LINK                = arm-hisiv400-linux-g++

   QMAKE_LINK_SHLIB    = arm-hisiv400-linux-g++ 

   

   QMAKE_AR                   = arm-hisiv400-linux-ar cqs

   QMAKE_OBJCOPY        =arm-hisiv400-linux-objcopy

  QMAKE_STRIP                     =arm-hisiv400-linux-strip

 

4、配置Qt编译选项

4..1 编译源码方式:

查看嵌入式QTE命令:./configure –embedded –help

通过进行裁剪得到下边配置参数:

进入Qt解压目录,执行如下命令(红色字体:根据自己的平台配置):

./configure -prefix /usr/local/Qt-4.8.4-arm -platform qws/linux-x86-g++-embedded arm -xplatform /qws/linux-hisiv400-g++   -stl -qt-mouse-pc -release -no-fast-qt-gfx-transformed  -shared  -no-largefile   -no-system-proxies -no-exceptions-no-accessibility  -no-sql-QDB2-no-sql-QIBASE -no-sql-QMYSQL -no-sql-QOCI -no-sql-QODBC  -no-sql-QPSQL -no-sql-QSQLITE2-no-sql-QSQLITE -no-sql-QSYMSQL -no-sql-QTDS -no-armfpa -no-qt3support-no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon  -no-phonon-backend -no-svg  -no-webkit -no-javascript-jit   -no-script -no-scripttools -no-declarative -no-declarative-debug -no-mmx -no-3dnow-no-sse -no-sse2 -qt-zlib  -qt-libpng-no-libmng -no-libjpeg -no-opengl -no-openssl -no-nis -no-cups -iconv  -pch -no-separate-debug-info -no-dbus -depths16,18,24,32 -little-endian  -no-glib  -nomake part -reduce-relocations   -no-gtkstyle -qt-freetype  -opensource

4.2 配置完毕输出如下内容:

 

This is the Qt for Embedded Linux OpenSource Edition.

 

You are licensed to use this software underthe terms of

the Lesser GNU General Public License(LGPL) versions 2.1.

You are also licensed to use this softwareunder the terms of

the GNU General Public License (GPL)versions 3.

 

Type '3' to view the GNU General PublicLicense version 3.

Type 'L' to view the Lesser GNU GeneralPublic License version 2.1.

Type 'yes' to accept this license offer.

Type 'no' to decline this license offer.

Do you accept theterms of either license? Yes

 

5、make

6、sudo make intall      

/usr/local/Qt-4.8.4-arm中生成目标

 

二、配置目标板

1、将usr/local/Qt-4.8.4-arm中lib及plugins拷贝到目标板/usr/local/Qt-4.8.4-arm目录下

2、在目标版的/etc/profile里添加如下内容:

export QT_INSTALL_PATH=/usr/local/Qt-4.8.4-arm

exportLD_LIBRARY_PATH=/lib:/usr/lib:${QT_INSTALL_PATH}/lib:${LD_LIBRARY_PATH}

export QT_QWS_FONTDIR=${QT_INSTALL_PATH}/lib/fonts

exportQT_QWS_DISPLAY=linuxFB:/dev/fb0

注意:交叉编译时安装目录和目标板上的qt库存放目录一致时(1、中两个红色的目录一致),可不用设置上述环境变量。

3、source /etc/profile使环境变量立即生效。

4、配置/dev/fb0

4.1 将/dev/fb0设置为RGB8888模式(Qt需要在该模式下运行)

4.2 参考Hi3536_SDK_V2.0.4.0/mpp_single/sample/hifbsd/sample_hifb.c

4.3 使用分支4,compression模式:在执行ioctl函数后,挂起程序。提示:需要修改的位置有个注释//opencompress;

4.4 重新编译生成sample_hifb

 

三、测试运行

1、交叉编译一个Qt demo,拷贝到目标板上

2、加载hifb.ko(可以使用load3536 -a,加载全部模块)

3、运行sample_hifb &(屏幕会成绿色)

4、运行Qt demo(加-qws选项)

5、屏幕出现demo界面,成功!

0 0
原创粉丝点击