您的位置:首页 > 编程语言 > Qt开发

Qt 5.3.2在周立功M3352开发板的移植记录

2015-08-19 22:25 357 查看
1.一般板子上都带有配套的交叉编译,没有的话,可以从网上下一个。交叉编译器的放在/opt/tools/arm-2011.03/bin

看一下应该是这样的


2.到www.qt-project.org下载QT5.3.2的源代码qt-everywhere-opensource-src-5.3.2.tar.gz。

3.解压到当前文件夹。tar xzvf qt-everywhere-opensource-src-5.3.2.tar.gz. 我的源码放在/opt/qt下。

4.在arm板上移植,需要知道芯片的架构。我的是ARM
Cortex-A8,其架构是armv7-a。我们进入/opt/qt/qt-everywhere-opensource-src-5.3.1/qtbase/mkspecs/linux-arm-gnueabi-g++目录下,需要修改qmake.conf文件。如下

#

# qmake configuration for building with arm-linux-gnueabi-g++

#

MAKEFILE_GENERATOR = UNIX

CONFIG += incremental

QMAKE_INCREMENTAL_STYLE = sublib

QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a

QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a

include(../common/linux.conf)

include(../common/gcc-base-unix.conf)

include(../common/g++-unix.conf)

# modifications to g++.conf

QMAKE_CC = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-gcc #交叉编译器的绝对路径

QMAKE_CXX = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-g++

QMAKE_LINK = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-g++

QMAKE_LINK_SHLIB = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-g++

# modifications to linux.conf

QMAKE_AR = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-ar cqs

QMAKE_OBJCOPY = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-objcopy

QMAKE_NM = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-nm -P

QMAKE_STRIP = /opt/tools/arm-2011.03/bin/arm-none-linux-gnueabi-strip

load(qt_config)

5.进入/opt/qt/qt-everywhere-opensource-src-5.3.1/,编译脚本

sudo mkdir arm_config

sudo chmod 777 arm_config

sudo vi arm_config

./configure -v \

-prefix /usr/local/qt-everywhere-opensource-src-5.3.2 \ 交叉编译之后的目录

-confirm-license \

-opensource \

-release \

-make libs \

-xplatform linux-arm-gnueabi-g++ \

-optimized-qmake \

-pch \

-qt-sql-sqlite \

-qt-libjpeg \

-qt-zlib \

-no-opengl \

-no-sse2 \

-no-openssl \

-no-nis \

-no-cups \

-no-glib \

-no-xcursor -no-xfixes -no-xrandr -no-xrender \

-no-separate-debug-info \

sudo make

sudo make install

等待几个小时之后完成。

6.进入/usr/local,把qt-everywhere-opensource-src-5.3.2拷到板子上/opt下

7.设置环境变量,打开/etc/profile

export TSLIB_ROOT=/usr

export QT_ROOT=/opt/qt-everywhere-opensource-src-5.3.2

export QWS_MOUSE_PROTO=tslib:/dev/touchscreen

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$QT_ROOT/lib:$LD_LIBARAY_PATH

export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins

export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0

export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts

重启 source /etc/profile.

8.运行demo的时候,中文汉字显示不了 进入/opt/qt-everywhere-opensource-src-5.3.2/lib/fonts下,删除所以字体,然后从网上下一个文泉驿字体库,我用的是wqy_mh.ttf,重新运行demo,字体就能正常显示了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: