QT-embedded-arm-4.7.3

QT 专栏收录该内容
1 篇文章 0 订阅

本博客禁止转载!

断断续续安装QT大概有一个多月了(一点都不夸张),今天终于安装成功了。记录一下!

之所以安装了这么久归根到底是因为没有找到正确的安装步骤。

QT安装分好多的版本,有针对嵌入式的,有专用于桌面的。具体安装成功之后会在下面显示是什么版本的,如下图显示的就是嵌入式的。


下面就介绍如何正确安装嵌入式版的QT。

首先安装QT需要安装两个文件(QT-creator、qt-everything-opensource-src-4.7.3)

QT-creator非常的好安装,不存在任何的问题(我是利用虚拟机上的商品商店)直接安装的。

关键是安装qt-everything-opensource-src-4.7.3.(这个文件适合任何平台(arm,x86等)的安装只是在安装是选择配置不一样。以前的老版本会分是什么平台,现在基本上不再区分了).在这里我附上我自己的千辛万苦找到的安装方法,算是比较正式的官方安装流程。

http://www.wiki.xilinx.com/Zynq+Qt+and+Qwt+Base+Libraries-Build+Instructions

为防止网址失效特将网页内容全部复制于此。

//………………………….网页内容………………………………….

Zynq Qt and Qwt Base Libraries-Build Instructions

1Introduction
This wiki page summarizes the build steps for Qt 4.7.3 and Qwt 6.0.1 librariesas used in the Zynq Base TRD 2015.2 orolder.
The Zynq Base TRD version2015.4 uses Qt 5.4.2 and Qwt6.1.2. Please refer to this wiki page for buildinstructions.


2Prerequisites(我没有用)


This tutorial requires the ARM GNU tools, which are part of the Xilinx SoftwareDevelopment Kit (SDK), to be installed on your host system. Specify the ARMcross-compiler by setting the CROSS_COMPILE environment variableand adding the cross-compiler to your PATH. Refer to the Zynq Tools wiki page for more information on howto set up the tool chain and known issues.

Note: These instructions currently require a Linux host forbuilding.


bash> export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
bash> export PATH=/path/to/cross/compiler/bin:$PATH


For simplicity we define two environment variables in this tutorial:

·        ZYNQ_QT_BUILD refers to the Qtbuild area

·        ZYNQ_QT_INSTALL refers to the Qtinstall area



bash> export ZYNQ_QT_BUILD=/path/to/qt/build
bash> export ZYNQ_QT_INSTALL=/path/to/qt/install
bash> export PATH=$ZYNQ_QT_INSTALL/bin:$PATH



3 Cross-Compile Qt4 for Embedded Linux


Qt for Embedded Linux is a C++ framework for GUI and application developmentfor embedded devices. It runs on a variety of processors, usually with EmbeddedLinux. Qt for Embedded Linux provides the standard Qt API for embedded deviceswith a lightweight window system. Qt for Embedded Linux applications writedirectly to the framebuffer, eliminating the need for the X Window System andsaving memory.


3.1 Download the QtSource Archive


Download the Qt sources andextract the archive to your Qt build area.


bash> cd $ZYNQ_QT_BUILD
bash> tar xzfv qt-everywhere-opensource-src-4.7.3.tar.gz
bash> cd qt-everywhere-opensource-src-4.7.3



3.2 Prepare a mkspec


Before we can do the configuration for the target system, we will need a set ofmkspecs that tells qmake which tool chain it should reference when it createsthe Makefiles. In this example we will provide an mkspec to go along with theARM GNU tools.

The mkspec consists of two files:

·        qmake.conf – This is a list ofqmake variable assignments that tells qmake what flags to pass through to thecompiler, which compiler to use etc

·        qplatformdefs.h – This is a headerfile with various platform-specific #includes and #defines. Often this just refers to anexisting qplatformdefs.h file from another generic mkspec


Download the qmake configuration file from the link below to override theexisting linux-arm mkspec.

qmake_4.7.3.conf

·        Details

·        Download

·        1 KB




bash> cp /path/to/downloaded/qmake_4.7.3.conf mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf


The corresponding qplatformdefs.h file just refers to an existing generic one,so nothing needs to be done here.


3.3 Configure theTarget Build


We are now ready to configure Qt to use our mkspec and hence use ourcross-compiling toolchain.


bash> ./configure \
       -embedded arm \
       -xplatform qws/linux-arm-gnueabi-g++ \
       -little-endian \
       -opensource \
       -host-little-endian \
       -confirm-license \
       -nomake demos \
       -nomake examples \
       -prefix $ZYNQ_QT_INSTALL


Here is some information on some of the options that appear:

·        -xplatform <mkspec files to use> – Cross compile forthe target platform using the environment specified in the mkspec files

·        -embedded <target CPU architecture> – The CPUarchitecture of the target platform

·        -prefix <path> – The path to installthe cross-compiled Qt to

·        -confirm-license – Lazy option to saveagreeing to license agreement during configure process



3.4Build and Install


Run make to build the cross-compiled target version of Qt.


bash> make


Once the build has completed it is time to install Qt. You may need to su toroot to do this part depending upon what prefix you configured the build with.


bash> su -          #if you need root access to be able to install
bash> make install



4 Cross-Compile Qwt – Qt Widgets forTechnical Applications


The Qwt library contains GUI Components and utility classes which are primarilyuseful for programs with a technical background. Beside a 2D plot widget itprovides scales, sliders, dials, compasses, thermometers, wheels and knobs tocontrol or display values, arrays, or ranges of type double.


4.1 Download theQwt Source Archive


Download the Qwt sources andextract the archive to your Qt build area.


bash> cd $ZYNQ_QT_BUILD
bash> tar xjfv qwt-6.0.1.tar.bz2
bash> cd qwt-6.0.1


Note: Make sure you configure, compile andinstall the qwt libraries in the same shell as the Qt installation as some Qtenvironment variables are reused for this build.


4.2 Configure theBuild using qmake


Projects are described by the contents of project files (.pro). Files that endwith the suffix .pri are included by theproject files and contain definitions that are common for several projectfiles. The information within these is used by qmake to generate a Makefilecontaining all the commands that are needed to build each project.

Download the config file from below and replace the existing one.

qwtconfig_6.0.1.pri

·        Details

·        Download

·        4 KB




bash> cp /path/to/downloaded/qwtconfig_6.0.1.pri qwtconfig.pri
bash> qmake qwt.pro



4.3Build and Install


Run make to build the cross-compiled target version of Qwt.


bash> make


Once the build has completed it is time to install Qwt. You may need to su to rootto do this part depending upon what prefix you configured the build with.


bash> su -          #if you need root access to be able to install
bash> make install



5 Add the GNUStandard C++ Library


In order to build and run your Qt application, the GNU Standard C++ Library ofthe ARM GNU Tools needs to be copied to the Qt install area's lib directory.


bash> cp -P /path/to/cross/compiler/arm-xilinx-linux-gnueabi/libc/usr/lib/libstdc++.so* \
            $ZYNQ_QT_INSTALL/lib



6 Create a FileSystem Image with Pre-Compiled Qt/Qwt Libraries


NOTE: This step is optional and is neededfor Zynq Base TRD 14.x version for copying QT libraries on a formatted ext2filesystem.
The final step shows how to create an image file of the Qt install area thatcan be copied onto an SD card and then mounted on the target system. Theselibraries are required to run the Qt application on the target system. First wecreate an empty image file of size 80MB, then we format the image with the ext2file system.


bash> cd $ZYNQ_QT_BUILD
bash> dd if=/dev/zero of=qt_lib.img bs=1M count=80
bash> mkfs.ext2 -F qt_lib.img


Now we just need to mount the image on our host machine, copy over thelibraries from the Qt install area and we are done. You may need to su to rootto do this part.


bash> su -                            #if you need root access to be able to install
bash> chmod go+w qt_lib.img
bash> mount qt_lib.img -o loop /mnt
bash> cp -rf $ZYNQ_QT_INSTALL/* /mnt
bash> chmod go-w qt_lib.img
bash> umount /mnt



6 WebSources


Qt for Embedded LinuxReference Documentation
Qwt - Qt Widgets forTechnical Applications User's Guide


7Licensing


All files provided by Xilinx may be used under the terms of the GNU GeneralPublic License (GPL) version 3.0. Please refer to Qt LicenseOptions and Qwt License Version 1.0 for details.

//……………………………………………………………………………………………………………………………………………………

注意:(1)网页上的第二步,我没有用。

补充一点(1.1)在安装之前最好先安装三个库和g++编译器

Sudo apt-get install  libx11-dev libxext-dev  libxtst-dev

Sudo apt-get install  g++

(2)网页上的qmake.conf 文件我没有用,我用的是经过修改的qmake.conf 文件。附上我修改过的完整文件:

//…………………………………………………………………………………………………………………………

 

#

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

#

 

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

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

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

 

# modifications to g++.conf

QMAKE_CC                = arm-xilinx-linux-gnueabi-gcc

QMAKE_CXX               = arm-xilinx-linux-gnueabi-g++

QMAKE_LINK              = arm-xilinx-linux-gnueabi-g++

QMAKE_LINK_SHLIB        = arm-xilinx-linux-gnueabi-g++

 

# modifications to linux.conf

QMAKE_AR                = arm-xilinx-linux-gnueabi-arcqs

QMAKE_OBJCOPY           = arm-xilinx-linux-gnueabi-objcopy

QMAKE_STRIP             = arm-xilinx-linux-gnueabi-strip

 

load(qt_config)

 

//…………………………………………………………………………………………………………………………………..

注明该文件的位置是在

qt-everything-opensource-src-4.7.3/mkspecs/qws/linux-arm-gnueabi-g++文件夹下面放在qws文件夹下的其他文件夹不可(例如linux-arm-g++)自己以前就是放在这个文件夹。其中arm-xilinx-linux-gnueabi-  是我安装交叉编译器的名字,这一要统一,而且网站上的也要求是这个交叉编译器。

(3)这一点非常非常非常(说三遍)的重要就是

bash> ./configure \
       -embedded arm \
       -xplatform qws/linux-arm-gnueabi-g++ \
       -little-endian \
       -opensource \
       -host-little-endian \
       -confirm-license \
       -nomake demos \
       -nomake examples \
       -prefix $ZYNQ_QT_INSTALL

我没有用最后一行,这个是指定安装的位置,我没有加这一行就默认安装在了默认的位置。

这个每一个选项都是重要,但是最重要的是-embedded arm 这个属性表明你安装的是一个嵌入式版本。(我以前不知道就没有加任何附加项安装都是桌面版的,所以在嵌入式板子上一直不能用)。加了-embedded arm之后还必须加上-xplatformqws/linux-arm-gnueabi-g++,这个选项是你使用的交叉编译器的版本。

(4)网页上第4步没有做。

(5)实现的产生一个qt_lib.img的文件,以供在arm平台上使用,要实现这一步第5步必须要做。这里注意一点:在做qt_lib.img文件的流程中有cp -rf $ZYNQ_QT_INSTALL/* /mnt 执行之一步时如果提示空间不足时,应将dd if=/dev/zero of=qt_lib.img bs=1M count=80这一步中的80更成更大的数(我的就改为200了)。更改的依据是,可以看一下QtEmbedded-4.7.3-arm文件的大小,以此来更改数据。

(6)在arm上运行的话,需要将qt_lib.img挂载上去,相应的命令为:

Mount-o loop /mnt/qt_lib.img /usr/local/Trolltech/QtEmbedded-4.7.3-arm/(该地址为安装时的地址)


  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值