Create a cross-compilation environment for the 3568 or 3288 arm board (use the ubuntu system configuration of amd64 to cross-compile the arm64 development environment) (nanny level includes installing QT) super detailed record version

1. Install the QT program

The development environment uses the amd64 linux system, so .run can run, we can download it from the QT official website, and choose the version yourself, and it is best to correspond to the qt to be compiled later

1. Download the .run of the qt5.9.6 version here

Download the installation package from the official website

2. We put it under Downloads

insert image description here

3. At this point we use ./Run to find the prompt on the command line:

insert image description here

4. Lack of executable permissions, we enter on the command line:

sudo chmod u+x qt-opensource-linux-x64-5.9.6.run

5. After execution, the file can be opened directly with ./, and input on the command line:

./qt-opensource-linux-x64-5.9.6.run

6. The QT installer pops up at this time

Start to install QT
insert image description here

7.next

You need to register an account here, no trouble, just verify your email
insert image description here

8. The installation path must be in English, not much to say about this

insert image description here

9. Next select the component and agree to the agreement

The most conservative option is to select all
insert image description here
and agree to the agreement, next
insert image description here

10. Start the installation, click install

insert image description here

11. Wait for the installation to complete

insert image description here

12. The installation is complete

insert image description here

13. Install the cross compiler and configure the environment

Here I directly borrow from the previous brother's network disk:

Link: https://pan.baidu.com/s/1mnpFepFY-rOlwWd3QbYZiw Extraction code: 5566

(1) Put the two cross compiler files under Downloads insert image description here
(2) Enter on the command line:

sudo tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar -C /opt/
sudo tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar -C /opt/

(3) Decompression is complete
insert image description here
(4) Configure the environment variables of the system, here are several methods:
modify directly with vim:

sudo runs ~/.bashrc

insert image description here

Directly open and modify: open under home to show hidden files:
gedit modify:

sudo runs ~/.bashrc

insert image description here
(5) Add a cross compiler environment, the path is: /opt/

PATH=$PATH:/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin

PATH=$PATH:/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin

insert image description here
(6) After the configuration, the global variables will take effect, and the command line input:

source ~/.bashrc

(7) Verify that the compiler has been installed, command line input:

aarch64-linux-gnu-gcc -v
arm-linux-gnueabihf-gcc -v

insert image description here
insert image description here
Both display the version number, indicating that there is no problem
(8) Create a simple c program, compile it with the arm64 compiler and run it on the board

#include <stdio.h>
int main(int argc, char **argv)
{
    printf("Hello, you do it succeed!!!\n");
    return 0;
}

(9) This hello.c is recommended to be placed in the folder under /home/your username/
insert image description here
insert image description here
(10) Here you can create a folder by right-clicking directly in the file manager. As for the creation of hello.c, you only need to Enter in the root directory of ctest:

touch hello.c

Open it directly and put the code into it to save
insert image description here
(11) Compile hello.c with aarch64, as shown in the figure below in two steps (PS: just fill in the generated executable name after -o)
insert image description here
(12) Generate an executable file The type is aarch64, that is, the executable program of the arm64 version, which can be directly put on the board and run
insert image description here
(13) as shown in the figure below, the running on the board is successful, indicating that the arm64 cross compiler has been installed successfully
insert image description here

14. Compile the QT source code and configure the cross-compilation environment

insert image description here
(1) (1) Decompress the QT source code package, enter:

sudo tar xvf qt-everywhere-src-5.12.10.tar.xz
cd qt-everywhere-src-5.12.10

(2) Go to insert image description here
the directory, and then enter:

sudo cp -a linux-aarch64-gnu-g++/ aarch64-linux-gnu-g++/

(3) Go to the aarch64-linux-gnu-g++ folder and
insert image description here
enter:

gedit qmake.conf

(4) Add the following content into it

# modifications to g++.conf
QMAKE_CC                = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc 
QMAKE_CXX               = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ 
QMAKE_LINK              = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ 
QMAKE_LINK_SHLIB        = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ 

# modifications to linux.conf
QMAKE_AR                = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY           = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-objcopy
QMAKE_NM                = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc-nm  -P
QMAKE_STRIP             = /opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-strip
load(qt_config)

(5) As shown in the figure, save the file
insert image description here
(6) After saving, you need to enter the root directory of the qt file that you just decompressed:
insert image description here
Create a build folder:
insert image description here
(7) Enter the build folder and create build.sh
insert image description here
(8) Edit the build.sh file and add the following:

…/configure
-verbose
-opensource
-release
-shared
-confirm-license
-make libs
-nomake tests
-nomake examples
-skip qtmacextras
-skip qtandroidextras
-no-opengl
-xplatform aarch64-linux-gnu-g++
-prefix /opt/qt-5.12.10-linux-aarch64-gcc

insert image description here
(9) After build.sh is saved, you need to give build.sh execution permission:

sudo chmod +x build.sh

insert image description here
(10) Install the libraries that the compilation depends on, install everything that can be installed, and the basic ones must be installed

基础的编译环境:
sudo apt-get build-dep qt5-default
sudo apt-get install libxcb-xinerama0-dev
sudo apt-get install build-essential perl python git
Libxcb:
sudo apt-get install ‘^libxcb.*-dev’ libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
OpenGL:
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install libegl1-mesa-dev
sudo apt-get install freeglut3-dev
Qt WebKit:
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
Qt WebEngine:
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdbus-1-dev libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev gperf bison
Qt Multimedia:
sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
QDoc Documentation Generator Tool:
sudo apt install libclang-6.0-dev llvm-6.0

(11) After installing the required environment, you can execute build.sh to create a Makefile for compilation:
insert image description here
(12) Execute:

make

insert image description here
(13) Execute:

sudo make install

Executing make install after the compilation is complete will install the qt library to the directory specified by -prefix.
insert image description here

15. Configure the QT cross-compilation environment

(1) Open the installed QT and project
insert image description here
(2) Configure its aarch64-bit compiler, click Add in Compilers to add the cross-compilation chain GCC we installed and configured before, and the configuration path and name should be distinguished (3) In
insert image description here
Qt Configure the compiled qmake in Versions, the location is under opt
insert image description here
(4) Add Kit, the configuration is shown in the figure below, the Name can be customized
insert image description here
(5) After clicking ok, click the newly configured Kits in Projects, and then select our environment , select the Release mode, and click build
insert image description here
(6) After Build, it will display green and the build has been successful
insert image description here
(7) See the project that has been built
insert image description here
(8) After clicking in, you can see that there is an executable file, copy it to the board It can be used. According to different programs, special global variable settings, related library lib placement, etc. need to be added in the .bashrc file under home, and the source can be used to take effect
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44277869/article/details/127338258