当前位置:   article > 正文

交叉编译工具和qt安装,终端使用qmake编译arm版本可执行文件的方法_qmake arm

qmake arm

 

一、交叉编译器安装

交叉编译器安装包:linux-devkit.tar.gz

目前所使用的am335x平台所用的交叉编译器为arm-arago-linux-gnueabi,根据所提供的包进行解压,设置环境变量即可。流程如下:

1、安装平台相关的交叉编译器

   目前所使用的am335x平台所用的交叉编译器为arm-arago-linux-gnueabi,根据所提供的包进行解压,设置环境变量即可。流程如下:

首先,将压缩包放置于所要安装的目录下/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit,使用tar zxvf linux-devkit.tar.gz解压缩到当前目录下。

其次配置系统环境变量,把交叉编译工具链的路径添加到环境变量PATH中去,这样就可以在任何目录下使用这些工具,exportPATH=$PATH:/mnt/am335xKit/linux-devkit/bin

最后,使用arm-arago-linux-gnueabi-gcc–v判断工具是否已正常安装并配置,成功信息可以在最后显示交叉编译的版本为4.5.3:


二、qt源码配置

1、编写脚本文件build-qt:内容如下(-prefix是配置后qt所在目录)

#!/bin/sh

 

 

(echo yes) | \

./configure \

       -prefix /opt/qt/                  \

       -xplatform qws/linux-arm-g++      \

       -embedded arm                     \

              -release                           \

              -opensource                        \

              -fast                              \

              -no-mmx                            \

              -no-3dnow                          \

              -no-sse                            \

              -no-sse2                           \

              -no-sse3                           \

              -no-ssse3                          \

              -no-sse4.1                         \

              -no-sse4.2                         \

              -no-avx                            \

              -no-neon                           \

              -no-opengl                         \

              -no-openvg                         \

              -no-xvideo                         \

              -no-glib                           \

              -audio-backend                     \

              -svg                               \

              -webkit                            \

              -javascript-jit                    \

              -script                            \

              -scripttools                       \

              -declarative                       \

              -no-largefile                      \

              -no-multimedia                     \

              -no-qt3support                     \

              -silent                            \

              -makelibs                         \

              -nomaketools                      \

              -nomakeexamples                   \

              -nomakedocs                       \

              -nomakedemo                       \

              -no-nis                            \

              -no-cups                           \

              -no-iconv                          \

              -no-dbus                           \

              -little-endian                     \

              -qt-freetype                       \

              -system-sqlite                     \

              -plugin-kbd-linuxinput             \

              -qt-kbd-tty                        \

              -plugin-mouse-tslib                \

              -qt-mouse-pc                       \

              -qt-mouse-qvfb                     \

              -qt-mouse-linuxinput               \

              -DQT_KEYPAD_NAVIGATION             \

              -plugin-gfx-transformed            \

              -plugin-gfx-qvfb                   \

              -plugin-gfx-vnc                    \

              -no-pch                            \

 

make -j2 #for 4-Cores CPU

sudo make install

 

2、编写环境配置文件set-env:

#!/bin/sh

 

export PATH=/opt/qt/bin/:$PATH

 

3、解压qt-everywhere-opensource-src-4.8.4源码,我这里就在目录下:


tar zxvf qt-everywhere-opensource-src-4.8.4.tar.gz

 

4、进入qt目录,将第一二步的两个文件拷进来:

 

5、修改qmake.conf文件:


内容如下:

#

# qmake configuration for building witharm-linux-g++

#

 

include(../../common/linux.conf)

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

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

include(../../common/qws.conf)

 

# modifications to g++.conf

QMAKE_CC                =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-gcc

QMAKE_CXX               =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-g++

QMAKE_LINK              =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-g++

QMAKE_LINK_SHLIB        =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-g++

 

# modifications to linux.conf

QMAKE_AR                =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-arcqs

QMAKE_OBJCOPY           =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-objcopy

QMAKE_STRIP             =/mnt/disk1/ti-sdk-am335x-evm-05.06.00.00/linux-devkit/bin/arm-arago-linux-gnueabi-strip

 

load(qt_config)

 

6、在qt-everywhere-opensource-src-4.8.4目录下执行./build-qt脚本文件,等待大约半小时,若出现权限不足,则sudo make install。(注意make不会出现权限不足的情况,中间若有错误,则删掉qt-everywhere-opensource-src-4.8.4文件夹,重新解压,重复上述步骤,有些库缺少的需要自己另外安装)。

 

7、可以执行 . set-env 环境配置文件(点+空格+set-env)。

 

8、查看qmake版本:/opt/qt/bin/qmake–v


 9、编译工程的方法:

1)/opt/qt/bin/qmake -v ,查看qmake的版本4.8.4.
2)必须使用 sudo /opt/qt/bin/qmake -project
3) sudo /opt/qt/bin/qmake
4) sudo make。
5)file +文件,查看一下文件格式,是否是arm架构。


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/292137
推荐阅读
相关标签
  

闽ICP备14008679号