“MY-IMX Linux-4.1.15 QT5 程序编译手册”的版本间的差异

来自明远智睿的wiki
跳转至: 导航搜索
(以“MY-IMX6 Linux-4.1.15 编译参考手册”替换内容)
 
第1行: 第1行:
 
+
[[MY-IMX6 Linux-4.1.15 编译参考手册]]
[^_^]:
 
  MY-IMX Linux-4.1.15 QT5 程序编译手册
 
 
 
 
 
 
 
<br/>
 
### 编译主机环境
 
 
 
--------------------------------------------------------------------------------
 
* 编译主机CPU架构:64位 
 
* 编译主机系统:Linux 
 
* Linux发行版:Ubuntu 
 
* Ubuntu版本号:14.04.5 
 
* Ubuntu版本类型:桌面版 
 
* Ubuntu系统类型:x86-64 
 
 
 
<br/>
 
 
 
### 安装 SDK
 
 
 
--------------------------------------------------------------------------------
 
##### 下载 SDK
 
  在网盘“2.3_系统_Linux-4.1.15/03\_工具”目录中下载 SDK 包文件。 
 
* MY-IMX6-EK140、MY-IMX-EK40P:
 
  fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.1.0.sh 
 
* MY-IMX6-EK200、MY-IMX-EK314、MY-IMX-EK336:
 
  fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh 
 
 
 
##### 准备安装
 
* 把下载的包文件复制到编译主机中。 
 
 
 
* 修改预安装目录的权限 
 
<pre>
 
$ chmod 777 /opt -R
 
</pre>
 
 
 
##### SDK 安装(MY-IMX6-EK140、MY-IMX-EK40P)
 
 
 
* 安装 SDK 包文件
 
 
 
<pre>
 
$ ./fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.1.0.sh
 
 
 
Freescale i.MX Release Distro SDK installer version 4.1.15-2.1.0
 
================================================================
 
Enter target directory for SDK (default: /opt/fsl-imx-fb/4.1.15-2.1.0):
 
You are about to install the SDK to "/opt/fsl-imx-fb/4.1.15-2.1.0". Proceed[Y/n]? Y
 
Extracting SDK.......................................................................................................................................................done
 
Setting it up...done
 
SDK has been successfully set up and is ready to be used.
 
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 
$ . /opt/fsl-imx-fb/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
 
</pre>
 
 
 
* 创建 oe-device-extra.pri 文件防止 qmake 时报错
 
<pre>
 
$ touch /opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/oe-device-extra.pri
 
</pre>
 
 
 
##### SDK 安装(MY-IMX6-EK200、MY-IMX-EK314、MY-IMX-EK336)
 
 
 
* 安装 SDK 包文件
 
 
 
<pre>
 
$ ./fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh
 
Freescale i.MX Release Distro SDK installer version 4.1.15-2.1.0
 
================================================================
 
Enter target directory for SDK (default: /opt/fsl-imx-fb/4.1.15-2.1.0):
 
You are about to install the SDK to "/opt/fsl-imx-fb/4.1.15-2.1.0". Proceed[Y/n]? Y
 
Extracting SDK..............................................................................................................................................................done
 
Setting it up...done
 
SDK has been successfully set up and is ready to be used.
 
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 
$ . /opt/fsl-imx-fb/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
 
</pre>
 
 
 
* 创建 oe-device-extra.pri 文件防止 qmake 时报错
 
<pre>
 
touch /opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/oe-device-extra.pri
 
</pre>
 
 
 
<br>
 
 
 
### 编译 QT 应用程序
 
 
 
--------------------------------------------------------------------------------
 
 
 
##### 配置交叉编译工具环境变量
 
* MY-IMX6-EK140、MY-IMX-EK40P
 
<pre>
 
$ source /opt/fsl-imx-fb/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
 
</pre>
 
 
 
* MY-IMX6-EK200、MY-IMX-EK314、MY-IMX-EK336
 
<pre>
 
$ source /opt/fsl-imx-fb/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
 
</pre>
 
 
 
##### 准备编译工程
 
* 下载 QT Demo 源码包 
 
在网盘“2.3_系统_Linux-4.1.15/05_MY-Demo”中下载 myzr-qt5-demo.tar 并复制到编译主机中。
 
 
 
* 解压 QT Demo 源码包 
 
<pre>
 
$ tar xf myzr-qt5-demo.tar
 
</pre>
 
 
 
* 进入 QT Demo 工程目录 
 
<pre>
 
$ cd myzr-qt5-demo/AboutUs
 
</pre>
 
 
 
* 为工程生成 Makefile 
 
<pre>
 
$ qmake
 
</pre>
 
 
 
##### 编译工程
 
* MY-IMX6-EK140、MY-IMX-EK40P
 
<pre>
 
$ make
 
 
 
/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/uic widget.ui -o ui_widget.h
 
......
 
arm-poky-linux-gnueabi-g++  -march=armv7ve -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-O1 -o AboutUs main.o widget.o qrc_source.o moc_widget.o  -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lEGL -lpthread
 
</pre>
 
 
 
* MY-IMX6-EK200、MY-IMX-EK314、MY-IMX-EK336
 
<pre>
 
$ make
 
 
 
/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/uic widget.ui -o ui_widget.h
 
......
 
arm-poky-linux-gnueabi-g++  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-fb/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-O1 -o AboutUs main.o widget.o qrc_source.o moc_widget.o  -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lEGL -lpthread
 
</pre>
 
 
 
##### 目标可执行文件 
 
* 查看编译生成的目标文件 
 
<pre>
 
$ file AboutUs
 
 
 
AboutUs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=38367b0a95b8fe7402e2377c11626581c07f9c9d, not stripped
 
</pre>
 
 
 
<br>
 
 
 
### 运行目标程序
 
 
 
--------------------------------------------------------------------------------
 
 
 
1.把编译生成的 AboutUs 复制到评估板上。 
 
<br>
 
2.运行目标程序 
 
* MY-IMX6-EK200、MY-IMX-EK314、MY-IMX-EK336 
 
<pre>
 
$ ./AboutUs -platform eglfs -plugin evdevtouch:/dev/input/event0
 
 
 
QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
 
If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
 
Unable to query physical screen size, defaulting to 100 dpi.
 
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
 
</pre>
 
 
 
 
 
<br>
 
<br>
 
 
 
--------------------------------------------------------------------------------
 
<pre>
 
--------------------------------------------------------------------------------
 
* 珠海明远智睿科技有限公司 
 
* ZhuHai MYZR Technology CO.,LTD.
 
* Latest Update: 2018/08/21 
 
* Supporter: Tang Bin
 
--------------------------------------------------------------------------------
 
</pre>
 

2018年11月17日 (六) 13:38的最新版本

MY-IMX6 Linux-4.1.15 编译参考手册