Git Product home page Git Product logo

qt5-openwrt-package's Introduction

Qt5 Library Package for OpenWRT

Cross compile the Qt5 Core library for OpenWRT MIPS platform.

Target OpenWRT Versions

  • 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.

Configure Qt Modules and Features

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-features

You can modify the Makefile to disable/enable this feature.

For more information, please refer to https://doc.qt.io/qt-5/configure-options.html.

Special Cases

Not enough space in /usr/lib/

  • 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.

How to Compile Shared Library

Cross Compile Qt5 for OpenWrt

OpenWRT compiler is required.

  1. 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

  2. Extract the SDK

  3. Clone this repo

  4. Put this repo into SDK/package

  5. Install dependencies by

    sudo apt install libncurses-dev zlib1g-dev gawk subversion python build-essential ccache
  6. Compile by

    make package/qt5-openwrt-package/compile V=s
  7. It will take a long time to build

  8. You can find compiled ipk files in SDK/bin/

Install the Compiled Shared Library to Target Device

  1. Copy compiled ipk files to the target device by scp

  2. Install ipk files by

    opkg install qt5-core_5.11-3_ramips_24kec.ipk
    opkg install qt5-network_5.11-3_ramips_24kec.ipk

Hello World Application

  1. At the root of SDK, execute following command

    make -C scripts/config/ clean  
    make
  2. 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
  3. On your Ubuntu, please install qtcreator and other tools by

    sudo apt install qtcreator qt5-default build-essential  
  4. 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
  5. 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++
  6. 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
  7. 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
  8. 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
  9. 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;
    }
  10. Build. Transfer to your target device and run.

Tested Hardware Platform

  • OpenWRT 14.07 based industrial 4G router

Acknowledgments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.