Environment: Ubuntu 22.04
1. Configure Buildroot to Add QT and Compile
1. Download the provided SDK, select the corresponding board (I am using LCSC Taishan-RK3566-Linux Dev Board, so I selected option 3. For your board, refer to the information provided by the manufacturer and choose the corresponding Buildroot).
./build.sh lunch && export RK_ROOTFS_SYSTEM=buildroot
2. Normal Compilation (Do not wait for it to complete): (Note: Do not add sudo to the command, as it may result in strange permission issues)
./build.sh all
3. During the compilation process, pay attention to whether a configuration file is generated. Once the configuration file is generated, you can press CTRL+C to cancel the compilation.
4. Execute the following in the root directory of the SDK package:
source buildroot/build/envsetup.sh
For my RK3566, choose option 65.
Run result:
If you choose 65 and an error occurs indicating that no configuration files are available, it means the configuration file has not been generated yet. You need to recompile and wait until the configuration file is created.
5. Execute the following in the root directory of the SDK package:
make menuconfig
在Target packages
->Graphic libraries and applications (graphic/text)
->QT5
Add the required modules under QT5, typically the gui module, GIF support, JPEG support, PNG support are essential.
It is also recommended to select fontconfig support.
2
3
4
5
6
7
6. After selecting the options, execute:
make savedefconfig
7. Finally, execute:
./build.sh all
And it's done. If there are compilation issues, you can refer to my other article::【LCSC Taishan-RK3566-Linux Dev Board】Solving Permission Issues during Full Compilation
2. Test QT
1. Locate qmake
After compiling, you can find the qmake file underbuildroot/output/rockchip_rk3566/build/qt5base-5.15.2/bin If you need to compile QT programs, use the qmake here (note that you need to prepend the path to your SDK package, for example, my full path is: /home/cc/tspi/linux/buildroot/output/rockchip_rk3566/build/qt5base-5.15.2/bin ).
2. Compile Example Program
There are many example programs under the buildroot/output/rockchip_rk3566/build/qt5base-5.15.2/examples/widgets directory. I chose draganddrop.
Compilation steps:
- cd draganddrop
- buildroot/output/rockchip_rk3566/build/qt5base-5.15.2/bin/qmake ./draganddrop.pro
- make
Run result:
Additionally, if you encounter module not found errors when using QT, you can refer to my other article:
Solving the Unknown module(s) in QT: xxxx Error while using qmake on the Buildroot System