一、i.mx6ull交叉编译QT项目
1、步骤
2、安装交叉编译链
使能交叉编译链,使能刚安装的编译器,不然还是老版本的
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
3、命令行交叉编译QT项目
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ qmake -v
QMake version 2.01a
Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu //没有刷新环境变量,版本低
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ ls
main.cpp mainwindow.h test_button.pro
mainwindow.cpp mainwindow.ui test_button.pro.user //没有qmake之前的qt项目文件
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ qmake 55.pro
Cannot find file: 55.pro.
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ qmake test_button.pro
Info: creating stash file /home/book/qt/test_button/test_button/.qmake.stash
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ ls -a. main.cpp mainwindow.h Makefile test_button.pro
.. mainwindow.cpp mainwindow.ui .qmake.stash test_button.pro.user //qmake之后的,还多了makefile
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$
清楚配置和编译可执行文件
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ make distclean
rm -f moc_predefs.h
rm -f moc_mainwindow.cpp
rm -f ui_mainwindow.h
rm -f main.o mainwindow.o moc_mainwindow.o
rm -f *~ core *.core
rm -f test_button
rm -f .qmake.stash
rm -f Makefile
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ qmake test_button.pro
Info: creating stash file /home/book/qt/test_button/test_button/.qmake.stash
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ make -j 4
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$ ls
main.cpp mainwindow.o moc_mainwindow.o test_button.pro.user
main.o mainwindow.ui moc_predefs.h ui_mainwindow.h
mainwindow.cpp Makefile test_button
mainwindow.h moc_mainwindow.cpp test_button.pro
wandzhang@wandzhang-virtual-machine:/home/book/qt/test_button/test_button$
上述命令和编译好文档,生成可执行文件
3、可执行文件拷贝到开发板
1.使用USB,拷贝文件,插入开发板
2.在开发板中找到文件
3.关掉开发板当前文件,执行编译好的QT文件
root@ATK-IMX6U:~# ls
book driver shell
root@ATK-IMX6U:~# [ 66.503764] usb 1-1.1: new high-speed USB device number 3 using ci_hdrc
[ 66.629736] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[ 66.652923] scsi host0: usb-storage 1-1.1:1.0
[ 68.070897] scsi 0:0:0:0: Direct-Access Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 4
[ 68.090719] sd 0:0:0:0: [sda] 60549120 512-byte logical blocks: (31.0 GB/28.8 GiB)
[ 68.102106] sd 0:0:0:0: [sda] Write Protect is off
root@ATK-IMX6U:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 7342568 661744 6284792 10% /
devtmpfs 187632 120 187512 1% /dev
tmpfs 40 0 40 0% /mnt/.psplash
tmpfs 253432 196 253236 1% /run
tmpfs 253432 148 253284 1% /var/volatile
/dev/mmcblk1p1 32248 6902 25347 22% /run/media/mmcblk1p1
/dev/sda1 30259440 10782320 19477120 36% /run/media/sda1
root@ATK-IMX6U:~# cd /run/media/sda1
root@ATK-IMX6U:/run/media/sda1# ls
test_button
root@ATK-IMX6U:/run/media/sda1# ./test_button
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'