ARM QT Cross-Compiling (Build Embedded platform QT development environment )

ARM QT Cross-Compiling

I. Installing the cross compiler

I now use here is the Huawei Hers series arm-hisiv500-linux aarch64-himix100-linux Hi3519AV100 chip.

  1. Unzip the cross compiler compression package
  2. Execute the installation script with the suffix install, such as aarch64-himix100-linux.install. Different series of cross compilers will be installed in the default directory /opt/hisi-linux/x86-arm, according to The name of the series is distinguished.
[root@test ]# ll /opt/hisi-linux/x86-arm/
total 8
drwxr-xr-x. 12 520 520 4096 Aug 22 13:55 aarch64-himix100-linux
drwxr-xr-x. 10 520 520 4096 Aug 22 13:44 arm-hisiv500-linux
  1. Configure the environment variables. The HiSilicon chip automatically configures the cross-compiler and configures the environment variables. You do not need to manually configure it yourself. If not configured, you need to change the /etc/profile file and add environment variables at the end, such as:
export PATH="/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin:$PATH"

Then, execute the following command to make it effective:

source /etc/profile

II. Download QT

  1. Go to the official website to download the QT source code of your required version:
    http://download.qt.io/archive/qt/
    The QT version I used is 4.8.7
    http://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
  2. Unzip
tar -zxvf qt-everywhere-opensource-src-4.8.7.tar.gz
  1. Enter the directory
cd qt-everywhere-opensource-src-4.8.7

III. Configuring QT

  1. Configure the qmake.conf configuration file, first copy a template configuration file for customization:
cp -r ./mkspecs/qws/linux-arm-g++ ./mkspecs/qws/linux-himix100-g++

Edit the configuration file:

gedit ./mkspecs/qws/linux-himix100-g++/qmake.conf

Replace arm-linux with the corresponding compiler, such as aarch64-himix100-linux. Finally, the entire file looks like this:

#
# qmake configuration for building with arm-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                = aarch64-himix100-linux-gcc
QMAKE_CXX               = aarch64-himix100-linux-g++
QMAKE_LINK              = aarch64-himix100-linux-g++
QMAKE_LINK_SHLIB        = aarch64-himix100-linux-g++

# modifications to linux.conf
QMAKE_AR                = aarch64-himix100-linux-ar cqs
QMAKE_OBJCOPY           = aarch64-himix100-linux-objcopy
QMAKE_STRIP             = aarch64-himix100-linux-strip

load(qt_config)
  1. configure
    1). 32-bit cross compiler configuration such as arm-hisiv500-linux and Hi3519AV100:
./configure -opensource -confirm-license -embedded arm -nomake examples -nomake demos -nomake docs -xplatform qws/linux-hisiv500-g++ -prefix /usr/local/Trolltech/QtEmbedded-4.8.7-arm_x32

Among them, qws/linux-hisiv500-g++ needs to be modified according to different compilers.
The installation directory /usr/local/Trolltech/QtEmbedded-4.8.7-arm_x32 can also be customized as needed. The default installation directory is /usr/local/Trolltech/, and the name is automatically named according to the Qt version and compiler architecture.

  1. configure
    2). aarch64-himix100-linux 64-bit cross compiler configuration:
./configure -opensource -confirm-license -qt-sql-sqlite -qt-gfx-linuxfb -plugin-sql-sqlit -no-qt3support -no-phonon -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -no-gif -qt-libtiff -qt-libpng -no-libmng -qt-libjpeg -no-rpath -no-pch -no-3dnow -no-avx -no-neon -no-openssl -no-nis -no-cups -no-dbus -embedded arm -platform linux-g++ -little-endian -qt-freetype -no-opengl -no-glib -nomake demos -nomake examples -nomake docs -xplatform qws/linux-himix100-g++ -prefix /usr/local/Trolltech/QtEmbedded-4.8.7-arm_x64

Similarly, qws/linux-himix100-g++ needs to be modified according to different compilers.
The installation directory /usr/local/Trolltech/QtEmbedded-4.8.7-arm_x64 can also be defined as needed. The default installation directory is /usr/local/Trolltech/, and the name is automatically named according to the Qt version and the compiler architecture.

IV. 64-bit compiler extra configuration:

  1. Edit the q_atomic_swp.h header file to resolve the assembly swap error at compile time.
gedit ./src/corelib/arch/qatomic_armv5.h

Modify the q_atomic_swp function to:

inline char q_atomic_swp(volatile char *ptr, char newval)
{
    register char ret;

    /*asm volatile("swpb %0,%2,[%3]"
    : "=&r"(ret), "=m" (*ptr)
    : "r"(newval), "r"(ptr)
    : "cc", "memory");*/

    ret=*ptr;

    *ptr=newval;

    return ret;
}
  1. Modify itemviews.cpp line 396 to resolve compilation errors: error: invalid conversion frome 'int' to
vi src/plugins/accessible/widgets/itemviews.cpp +396

After modification, it is:

view()->selectionModel()->select(index, QItemSelectionModel::SelectionFlags( QItemSelectionModel::Columns & QItemSelectionModel::Deselect ));

V. Compile and install

Compile

gmake -j8
  1. Installation
gmake install

VI. Configuring Qt Creator

Configured in the toolbar Tools->Options->Build & Run tab, there is no explanation here, as shown in the figure:

Reference:

https://doc.qt.io/archives/qt-4.8/qt-embedded-crosscompiling.html
https://blog.csdn.net/yfkyfk521/article/details/89446969

2 1 vote
Article Rating
赞(0) 打赏
未经允许不得转载:iemblog » ARM QT Cross-Compiling (Build Embedded platform QT development environment )
Subscribe
Notify of
guest
0 COMMENTS
Inline Feedbacks
View all comments
免责声明:本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,请在下载后24小时之内自觉删除,若作商业用途,请购买正版,由于未及时购买和付费发生的侵权行为,与本站无关。本站发布的内容若侵犯到您的权益,请联系站长删除,我们将及时处理! Disclaimer: Most of the download resources on this site are collected on the Internet, and are only used for learning and communication. The copyright belongs to the original author. Please consciously delete within 24 hours after downloading. If you use it for commercial purposes, please purchase the original version. If the content posted on this site violates your rights, please contact us to delete it, and we will deal with it in time!

联系我们 Contact us

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

0
Would love your thoughts, please comment.x
()
x