Cross compile the Qt5 Core library for OpenWRT MIPS platform.
- If you are running OpenWRT 14.07, please use the master branch.
- If you are running OpenWRT 19.07, please use the 19.07 branch.
You can see all the modules available by browsering the folders of Qt5 source code.
For example, qtchart is a module under qt-everywhere-src-5.11.3. You can modify the Makefile to disable/enable this module.
You can see all the features available by following command.
./configure --list-featuresYou can modify the Makefile to disable/enable this feature.
For more information, please refer to https://doc.qt.io/qt-5/configure-options.html.
- If the target device has not enough space to install the library, you could choose to install the library to /tmp/. However, /tmp/ resides in ram and will be lost after reboot.
- If the target device has enough space to install the library, you need to modify the Makefile.
OpenWRT compiler is required.
- 
Download SDK, for example https://archive.openwrt.org/barrier_breaker/14.07/ramips/mt7620n/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 
- 
Extract the SDK 
- 
Clone this repo 
- 
Put this repo into SDK/package 
- 
Install dependencies by sudo apt install libncurses-dev zlib1g-dev gawk subversion python build-essential ccache 
- 
Compile by make package/qt5-openwrt-package/compile V=s 
- 
It will take a long time to build 
- 
You can find compiled ipk files in SDK/bin/ 
- 
Copy compiled ipk files to the target device by scp 
- 
Install ipk files by opkg install qt5-core_5.11-3_ramips_24kec.ipk opkg install qt5-network_5.11-3_ramips_24kec.ipk 
- 
At the root of SDK, execute following command make -C scripts/config/ clean make 
- 
then, go to the qt source code and make install by cd build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/qt-everywhere-src-5.11.3 make install
- 
On your Ubuntu, please install qtcreator and other tools by sudo apt install qtcreator qt5-default build-essential 
- 
Add a new QT Device: QT Creator --> Tools --> Options --> Devices --> Add --> Generic Linux Device - Name: OpenWrt Device
- Authentcation Type: Password
- Host address: Your device ip address
- SSH port: 22
- Username: your device username
- Password: your device password
 
- 
Set a new compiler: QT Creator --> Tools --> Options --> Build & Run --> Compilers --> Add --> GCC --> for both C/C++ - Name: OpenWrt GCC and OpenWrt G++
- ABI: mips-linux-generic-elf-32bit
- Compiler path (GCC): staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-uclibc-gcc
- Compiler path (G++): staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-uclibc-g++
 
- 
Set a new debugger: QT Creator --> Tools --> Options --> Build & Run --> Debuggers --> Add - Name: OpenWrt Debugger
- Path: staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-uclibc-gdb
 
- 
Set a Qt5 version: QT Creator --> Tools --> Options --> Build & Run --> Qt Versions --> Add - qmake location: staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/qmake
 
- 
Add a new Kit: QT Creator --> Tools --> Options --> Build & Run --> Kits --> Add - Name: OpenWrt Kit
- Device Type: Generic Linux Device
- Device: OpenWrt Device (default for Generic Linux)
- Compiler: C, OpenWrt GCC; C++, OpenWrt G++
- Debugger: OpenWrt Debugger
- Qt version: Qt 5.11.3
 
- 
Create a New Project --> Qt Console Application --> Choose... --> Name: helloWorld --> qmake --> OpenWrt Kit --> Finsh #include <QTextStream> int main() { QTextStream(stdout) << "Hello World!" << endl; return 0; } 
- 
Build. Transfer to your target device and run. 
- OpenWRT 14.07 based industrial 4G router
- Forked from https://github.com/pawelkn/qt5-openwrt-package
- Updated by https://github.com/vonger
- Inspired by http://vonger.cn/?p=14588
