Difference between revisions of "RK ALL toolchain Qt 5.11.3"

From ESS-WIKI
Jump to: navigation, search
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
 
= Prerequisites =
 
= Prerequisites =
  
Line 24: Line 25:
 
$ for f in $(ls aarch64-linux-gnu*-8);do ln -sf $f $(echo $f|sed "s/-8//");done
 
$ for f in $(ls aarch64-linux-gnu*-8);do ln -sf $f $(echo $f|sed "s/-8//");done
 
$ exit
 
$ exit
 +
 
</pre>
 
</pre>
  
 
+
&nbsp;
  
 
== Installing cross toolchain ==
 
== Installing cross toolchain ==
  
Please download [https://pan.baidu.com/s/1JnXJ_X_HRDWoB14VBIq9fA RK3288](Password: gm9i) 、&nbsp;[https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag RK3399](Password: 0kkn)(Password: ) cross compiler toolchain first. Then execute the following command to unzip the cross compiler tool to the /opt directory
+
Please download [https://pan.baidu.com/s/1JnXJ_X_HRDWoB14VBIq9fA RK3288](Password: gm9i) 、&nbsp;[https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag RK3399](Password: 0kkn) and [https://pan.baidu.com/s/17hCuIcORYDPOSAqVoyPPrg RK3568](Password: a887)cross compiler toolchain first. Then execute the following command to unzip the cross compiler tool to the /opt directory
  
 
For RK3288
 
For RK3288
Line 45: Line 47:
  
 
For RK3568
 
For RK3568
<pre>$ sudo rm -rf /opt/toolchain_Qt_V5.11.3/rk3568/  
+
<pre>$ sudo rm -rf /opt/toolchain_Qt_V5.11.3/rk3568/
$ sudo mkdir -p /opt/toolchain_Qt_V5.11.3/rk3568/  
+
$ sudo mkdir -p /opt/toolchain_Qt_V5.11.3/rk3568/
$ sudo tar -zxvf rk3568_toolchain_Qt_V5.11.3_*.tar.gz -C /opt/toolchain_Qt_V5.11.3/rk3568/</pre>
+
$ sudo tar -zxf rk3568_toolchain_Qt_V5.11.3_*.tar.gz -C /opt/toolchain_Qt_V5.11.3/rk3568/</pre>
  
 
= Working within QtCreator =
 
= Working within QtCreator =
  
The method of using this toolchain with qtcreator is the same as 5.9.4 toolchain. Therefore, you can refer to [http://ess-wiki.advantech.com.tw/view/RK3288_qt5Creator rk3288_qt5Creator.]
+
Use qtcreator to configure a complete build kit.
  
However, the following differences need to be noted:
+
<span style="color:#FF0000;">'''RK3568 & RK3399&nbsp;&&nbsp;RK3288'''</span>
  
 
== Config QtCreator ---- Qt Versions ==
 
== Config QtCreator ---- Qt Versions ==
  
#Bring up the options dialog using "Tools" -> "Options..."
+
1. Select Tools --> options -->&nbsp;
#Select the "Build & Run" page on the left, switch to "Qt Versions" tab, and click "Add..."
+
 
#Select qmake file
+
[[File:QtDNK5.png|RTENOTITLE]]
#;Select "/opt/toolchain_Qt_V5.11.3/rk3288/sysroot/qmake-debian-buster-armhf".<br/>
+
 
#;or&nbsp;
+
2. Select Qt versions --> Manual -->Add -->
#;RK3399 Select&nbsp;"/opt/toolchain_Qt_V5.11.3/rk3399/sysroot/qmake".<br/>
+
 
#;or&nbsp;RK3399 Select&nbsp;"/opt/toolchain_Qt_V5.11.3/rk3399/sysroot/qmake-debian-buster-armhf "
+
&nbsp; &nbsp; Path:/opt/toolchain_Qt_V5.11.3/<span style="color:#FF0000;">'''RK3568 or&nbsp;RK3399 or RK3288/'''</span><span style="color:#000000;">sysroot/qmake</span>
#Input Version name "Qt 5.11.3 (RK3288 )" or "Qt 5.11.3 (RK3399&nbsp;)".
+
 
 +
[[File:QtICMN.png|RTENOTITLE]]
 +
 
 +
[[File:QtLZHW4.png]]
 +
 
 +
== Config QtCreator ---- Qt Complers ==
 +
 
 +
1. Select compilers -->
 +
 
 +
2. Because Gcc and G++ has been installed earlier, the compiler will generally detect it automatically.
 +
 
 +
&nbsp; &nbsp; If no Auto-detected, just Add it.
 +
 
 +
<span style="color:#000000;">'''Path for'''</span><span style="color:#ff0000;">'''RK3568 (64)'''</span><span style="color:#000000;">:/usr/bin/arrch64-linux-gnu-gcc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span>
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/bin/aarch64-linux-gnu-g++
 +
 
 +
&nbsp;
 +
 
 +
<span style="color:#000000;">'''Path for'''</span><span style="color:#FF0000;">'''RK3399 (64)'''</span><span style="color:#000000;">:/usr/bin/aarch64-linux-gnu-gcc</span>
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/bin/aarch64-linux-gnu-g++
 +
 
 +
&nbsp;
 +
 
 +
<span style="color:#000000;">'''Path for'''</span><span style="color:#FF0000;">'''RK3288(32)'''</span><span style="color:#000000;">:/usr/bin/arm-linux-gnueabihf-gcc</span>
 +
 
 +
<span style="color:#FF0000;">'''&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;'''</span><span style="color:#000000;">/usr/bin/arm-linux-gnueabihf-g++</span>
 +
 
 +
The following figure uses rk3568&nbsp; as an example :
 +
 
 +
[[File:QtIXDKY6.png|RTENOTITLE]]
 +
 
 +
== Config QtCreator ---- Qt Debuggers ==
 +
 
 +
1. Select Debuggers -->
 +
 
 +
2. The Debuggers selection system buildin,If no Auto-detected , just Add it:
 +
 
 +
&nbsp; &nbsp; Path: /usr/bin/gdb
 +
 
 +
[[File:QtGZ6D5.png|RTENOTITLE]]
 +
 
 +
== Config QtCreator ---- Qt Cmakes ==
 +
 
 +
1. Select Cmake -->
 +
 
 +
2. Similarly,Cmake also uses the system Cmake , if no Auto-detected , just Add it&nbsp;:
 +
 
 +
&nbsp; &nbsp; Path: /usr/bin/Cmake
  
[[File:RK3288 Add Qt Verions.png|RTENOTITLE]]
+
[[File:Qt8D.png|RTENOTITLE]]
  
== Config QtCreator ---- Kits ==
+
== Config QtCreator ---- Qt kits ==
  
#Bring up the options dialog using "Tools" -> "Options..."
+
1. Select Kits&nbsp;
#Select the "Build & Run" page on the left, switch to "Kits" tab, and click "Add..."
 
#Click "Add".
 
  
;<span style="color:#FF0000;">'''RK3288'''</span>
+
2. Configure "Qt version""Compilers""Debuggers"&nbsp;and "Cmake"&nbsp;configurations in Kits.
;Name
 
:input "RK3288 toolchain"
 
;Device Tpye
 
:Select "Generic Linux Device"
 
;Device
 
:Select "RK3288"
 
;Compiler
 
:Select "GCC (C,arm <span style="color:#FF0000;">32</span>bit in /usr/bin)" and "GCC (C++,arm <span style="color:#FF0000;">32</span>bit in /usr/bin)"
 
;Qt version
 
:Select "Qt 5.11.3 (RK3288)"<br/>
 
:<br/>
 
:
 
  
<span style="color:#FF0000;">'''RK3399'''</span>
+
&nbsp; &nbsp; &nbsp;The picture below uses rk3568&nbsp;as an example:
  
;Name
+
[[File:T4KDS.png|RTENOTITLE]]
:input "RK3399 toolchain"
 
;Device Tpye
 
:Select "Generic Linux Device"
 
;Device
 
:Select "RK3399"
 
;Compiler
 
:Select "GCC (C,arm <span style="color:#FF0000;">64</span>bit in /usr/bin)" and "GCC (C++,arm <span style="color:#FF0000;">64</span>bit in /usr/bin)"
 
;Qt version
 
:Select "Qt 5.11.3 (RK3399)"
 
:<br/>
 
:<br/>
 
  
[[File:RK3288 Add Kits.png|RTENOTITLE]]
+
[[File:QtZ52.png|RTENOTITLE]]
  
 
== Creating the Project ==
 
== Creating the Project ==
  
#Bring up "New" dailog using "File" -> "New File or Project..."
+
#Bring up "New" dailog using "File" -> "New File or Project..."  
#Select "Applications" -> 'Qt Widgets Application"
+
#Select "Applications" -> 'Qt Widgets Application"  
#Click "Choose..."
+
#Click "Choose..."  
#;[[File:RK3399 Project 001.png|RTENOTITLE]]
+
#;[[File:RK3399 Project 001.png|RTENOTITLE]]  
#Use "Hello" as name
+
#Use "Hello" as name  
#Create in "/mnt/sda1/work/qt/qt_PJ"
+
#Create in "/mnt/sda1/work/qt/qt_PJ"  
#Click "Next"
+
#Click "Next"  
#;[[File:RK3399 Qt Project local.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt Project local.png|RTENOTITLE]]  
#Check "RK toolchain"
+
#Check "RK toolchain"  
#Click "Next".
+
#Click "Next".  
#;[[File:RK3399 Qt Project toolchain.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt Project toolchain.png|RTENOTITLE]]  
#Use default settings for "Class Information"
+
#Use default settings for "Class Information"  
#Click "Next"
+
#Click "Next"  
#;[[File:RK3399 QT Project last.png|RTENOTITLE]]
+
#;[[File:RK3399 QT Project last.png|RTENOTITLE]]  
#Use default settings for "Project Management"
+
#Use default settings for "Project Management"  
#Click "Finish"
+
#Click "Finish"  
#;[[File:RK3399 Qt Project last2.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt Project last2.png|RTENOTITLE]]  
#Double click "Hello.pro" to switch to editor window
+
#Double click "Hello.pro" to switch to editor window  
#In new project it is necessary to add following two lines into qt project file.
+
#In new project it is necessary to add following two lines into qt project file.  
#:<code>target.path = .<br/>INSTALLS += target</code>
+
#:<code>target.path = .<br/> INSTALLS += target</code>  
#;[[File:RK3399 Qt Project code002.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt Project code002.png|RTENOTITLE]]  
#Press "Ctrl+S" to save file.
+
#Press "Ctrl+S" to save file.  
#Double click "mainwindow.ui" to switch to Design mode
+
#Double click "mainwindow.ui" to switch to Design mode  
#Drag & drop one Label widget on main form, use property editor on the right side to change text and font size
+
#Drag & drop one Label widget on main form, use property editor on the right side to change text and font size  
#;[[File:2015-01-30 174418.png|RTENOTITLE]]
+
#;[[File:2015-01-30 174418.png|RTENOTITLE]]  
#;[[File:RK3399 Qt Project code003.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt Project code003.png|RTENOTITLE]]  
#Save all project files using "File" -> "Save All"
+
#Save all project files using "File" -> "Save All"  
  
 
== Building the Project ==
 
== Building the Project ==
  
#Switch to "Projects" mode
+
#Switch to "Projects" mode  
#Check if "build configuration" is set to "Debug".
+
#Check if "build configuration" is set to "Debug".  
#;[[File:RK3399 Qt debug setting.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt debug setting.png|RTENOTITLE]]  
#Check if "Files to deploy" is correct
+
#Check if "Files to deploy" is correct  
#;[[File:RK3399 Qt run setting.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt run setting.png|RTENOTITLE]]  
#Set environment variable DISPLAY in QtCreator -> Projects -> Run -> Run Environment. The value of DISPLAY is obtained from the rk3399. For example, execute instruction '''''echo $DISPLAY''''' on RK3399.
+
#Set environment variable DISPLAY in QtCreator -> Projects -> Run -> Run Environment. The value of DISPLAY is obtained from the rk3399. For example, execute instruction '''''echo $DISPLAY''''' on RK3399.  
#;[[File:RK3399 Qt ENV Display.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt ENV Display.png|RTENOTITLE]]  
#Switch to "Edit" mode
+
#Switch to "Edit" mode  
#Click "Build" using context menu of project "Hello"
+
#Click "Build" using context menu of project "Hello"  
#;[[File:RK3399 Qt build start.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt build start.png|RTENOTITLE]]  
#The green "Build" bar means no error occured.
+
#The green "Build" bar means no error occured.  
#;[[File:RK3399 Qt build status.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt build status.png|RTENOTITLE]]  
#Press "Alt+4" to show "Compile Output".&nbsp;[[File:RK3399 Qt build output.png|RTENOTITLE]]
+
#Press "Alt+4" to show "Compile Output".&nbsp;[[File:RK3399 Qt build output.png|RTENOTITLE]]  
  
 
== Deploying the Application ==
 
== Deploying the Application ==
  
#Click "Deploy" using context menu of project Hello[[File:RK3399 Qt deploy start.PNG|RTENOTITLE]]
+
#Click "Deploy" using context menu of project Hello[[File:RK3399 Qt deploy start.PNG|RTENOTITLE]]  
#The green "Deploy" bar indicates no error occured.[[File:RK3399 Qt deploy output.png|RTENOTITLE]]
+
#The green "Deploy" bar indicates no error occured.[[File:RK3399 Qt deploy output.png|RTENOTITLE]]  
  
 
== Debugging the Application ==
 
== Debugging the Application ==
  
#Click debug icon to start debugging.
+
#Click debug icon to start debugging.  
#;[[File:RK3399 Qt debug start.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt debug start.png|RTENOTITLE]]  
#Press "Alt+3" to show "Application Output"[[File:RK3399 Qt debug output.png|RTENOTITLE]]
+
#Press "Alt+3" to show "Application Output"[[File:RK3399 Qt debug output.png|RTENOTITLE]]  
#The "Hello" shows up on primary display.
+
#The "Hello" shows up on primary display.  
#;[[File:RK3399 Qt result show.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt result show.png|RTENOTITLE]]  
#Click "stop" to stop debugging.
+
#Click "stop" to stop debugging.  
#;[[File:RK3399 Qt debug stop.png|RTENOTITLE]]
+
#;[[File:RK3399 Qt debug stop.png|RTENOTITLE]]  
#The deafult desktop returns back.[[File:RK3399 Qt default Desktop.png|RTENOTITLE]]
+
#The default desktop returns back.[[File:RK3399 Qt default Desktop.png|RTENOTITLE]]

Latest revision as of 12:15, 14 August 2023

Prerequisites

Debian10(buster) is highly recommended OS to develop.

Installing required packages

Please login and perform the following commands:

$ sudo apt-get install -y build-essential 
$ sudo apt-get install -y qtcreator 
$ sudo apt-get install -y qt5-default 
$ sudo apt-get install -y qt5-doc 
$ sudo apt-get install -y qt5-doc-html qtbase5-doc-html 
$ sudo apt-get install -y qtbase5-examples 
$ sudo apt-get install -y qt5-qmake 
$ sudo apt-get install -y rsync
$ sudo apt-get install -y gcc-8-arm-linux-gnueabihf g++-8-arm-linux-gnueabihf
$ sudo apt-get install -y gcc-8-aarch64-linux-gnu g++-8-aarch64-linux-gnu

Link arm-linux-gnu*-8 to arm-linux-gnu* and aarch64-linux-gnu*-8 to aarch64-linux-gnu*:

$ sudo su
$ cd /usr/bin
$ for f in $(ls arm-linux-gnu*-8);do ln -sf $f $(echo $f|sed "s/-8//");done 
$ for f in $(ls aarch64-linux-gnu*-8);do ln -sf $f $(echo $f|sed "s/-8//");done
$ exit

 

Installing cross toolchain

Please download RK3288(Password: gm9i) 、 RK3399(Password: 0kkn) and RK3568(Password: a887)cross compiler toolchain first. Then execute the following command to unzip the cross compiler tool to the /opt directory

For RK3288

$ sudo rm -rf /opt/toolchain_Qt_V5.11.3/rk3288/
$ sudo mkdir -p /opt/toolchain_Qt_V5.11.3/rk3288/
$ sudo tar -zxf rk3288_toolchain_Qt_V5.11.3_*.tar.gz -C /opt/toolchain_Qt_V5.11.3/rk3288/

For RK3399

$ sudo rm -rf /opt/toolchain_Qt_V5.11.3/rk3399/ 
$ sudo mkdir -p /opt/toolchain_Qt_V5.11.3/rk3399/ 
$ sudo tar -zxvf rk3399_toolchain_Qt_V5.11.3_*.tar.gz -C /opt/toolchain_Qt_V5.11.3/rk3399/

For RK3568

$ sudo rm -rf /opt/toolchain_Qt_V5.11.3/rk3568/
$ sudo mkdir -p /opt/toolchain_Qt_V5.11.3/rk3568/
$ sudo tar -zxf rk3568_toolchain_Qt_V5.11.3_*.tar.gz -C /opt/toolchain_Qt_V5.11.3/rk3568/

Working within QtCreator

Use qtcreator to configure a complete build kit.

RK3568 & RK3399 & RK3288

Config QtCreator ---- Qt Versions

1. Select Tools --> options --> 

RTENOTITLE

2. Select Qt versions --> Manual -->Add -->

    Path:/opt/toolchain_Qt_V5.11.3/RK3568 or RK3399 or RK3288/sysroot/qmake

RTENOTITLE

QtLZHW4.png

Config QtCreator ---- Qt Complers

1. Select compilers -->

2. Because Gcc and G++ has been installed earlier, the compiler will generally detect it automatically.

    If no Auto-detected, just Add it.

Path forRK3568 (64):/usr/bin/arrch64-linux-gnu-gcc         

                                   /usr/bin/aarch64-linux-gnu-g++

 

Path forRK3399 (64):/usr/bin/aarch64-linux-gnu-gcc

                                   /usr/bin/aarch64-linux-gnu-g++

 

Path forRK3288(32):/usr/bin/arm-linux-gnueabihf-gcc

                                  /usr/bin/arm-linux-gnueabihf-g++

The following figure uses rk3568  as an example :

RTENOTITLE

Config QtCreator ---- Qt Debuggers

1. Select Debuggers -->

2. The Debuggers selection system buildin,If no Auto-detected , just Add it:

    Path: /usr/bin/gdb

RTENOTITLE

Config QtCreator ---- Qt Cmakes

1. Select Cmake -->

2. Similarly,Cmake also uses the system Cmake , if no Auto-detected , just Add it :

    Path: /usr/bin/Cmake

RTENOTITLE

Config QtCreator ---- Qt kits

1. Select Kits 

2. Configure "Qt version"、"Compilers"、"Debuggers" and "Cmake" configurations in Kits.

     The picture below uses rk3568 as an example:

RTENOTITLE

RTENOTITLE

Creating the Project

  1. Bring up "New" dailog using "File" -> "New File or Project..."
  2. Select "Applications" -> 'Qt Widgets Application"
  3. Click "Choose..."
    RTENOTITLE
  4. Use "Hello" as name
  5. Create in "/mnt/sda1/work/qt/qt_PJ"
  6. Click "Next"
    RTENOTITLE
  7. Check "RK toolchain"
  8. Click "Next".
    RTENOTITLE
  9. Use default settings for "Class Information"
  10. Click "Next"
    RTENOTITLE
  11. Use default settings for "Project Management"
  12. Click "Finish"
    RTENOTITLE
  13. Double click "Hello.pro" to switch to editor window
  14. In new project it is necessary to add following two lines into qt project file.
    target.path = .
    INSTALLS += target
    RTENOTITLE
  15. Press "Ctrl+S" to save file.
  16. Double click "mainwindow.ui" to switch to Design mode
  17. Drag & drop one Label widget on main form, use property editor on the right side to change text and font size
    RTENOTITLE
    RTENOTITLE
  18. Save all project files using "File" -> "Save All"

Building the Project

  1. Switch to "Projects" mode
  2. Check if "build configuration" is set to "Debug".
    RTENOTITLE
  3. Check if "Files to deploy" is correct
    RTENOTITLE
  4. Set environment variable DISPLAY in QtCreator -> Projects -> Run -> Run Environment. The value of DISPLAY is obtained from the rk3399. For example, execute instruction echo $DISPLAY on RK3399.
    RTENOTITLE
  5. Switch to "Edit" mode
  6. Click "Build" using context menu of project "Hello"
    RTENOTITLE
  7. The green "Build" bar means no error occured.
    RTENOTITLE
  8. Press "Alt+4" to show "Compile Output". RTENOTITLE

Deploying the Application

  1. Click "Deploy" using context menu of project HelloRTENOTITLE
  2. The green "Deploy" bar indicates no error occured.RTENOTITLE

Debugging the Application

  1. Click debug icon to start debugging.
    RTENOTITLE
  2. Press "Alt+3" to show "Application Output"RTENOTITLE
  3. The "Hello" shows up on primary display.
    RTENOTITLE
  4. Click "stop" to stop debugging.
    RTENOTITLE
  5. The default desktop returns back.RTENOTITLE