GithubHelp home page GithubHelp logo

qt5-opengl-raspberrypi's Introduction

Qt5.15.2 LTS with OpenGL for Raspberry

This package installs Qt5.15.2 LTS "long term support" with desktop OpenGL , compiled on a raspberry pi 4 running Raspberry Pi OS 2021-01-11-raspios-buster-armhf (32 bit). The package is suitable for compiling desktop-style, windowed Qt apps under X11. The OpenGL support is in software, using Mesa.

Install Instructions

Install Qt5.15.2 libraries and includes

To install, download the qt5-opengl-dev_5.15.2_armhf.deb and type:

sudo apt update
sudo apt --fix-broken install ./qt5-opengl-dev_5.15.2_armhf.deb

This installs Qt5 in /usr/lib/qt5.15.2/.

This also creates the qtchooser configuration file /usr/share/qtchooser/qt5.15.2-opengl.conf. If qtchooser has been installed on the system, you can select Qt5.15.2 LTS with

export QT_SELECT=qt5.15.2-opengl

To remove:

dpkg -r qt5.15.2-opengl-dev

Install Qt-creator 4.14.1

Install Qt5.15.2 first. Then, to install qt-creator in /usr/local/bin, type:

wget https://github.com/koendv/qt5-opengl-raspberrypi/releases/download/v5.15.2-1/qt5-opengl-qtcreator_4.14.1_armhf.deb
sudo apt --fix-broken install ./qt5-opengl-qtcreator_4.14.1_armhf.deb

To remove:

dpkg -r qt5-opengl-qtcreator

This completes the installation instructions.

If you like this, maybe you want to buy me a cup of tea:

ko-fi

Build Notes for Qt5.15.2

These are notes for a native build of Qt5 on a Raspberry Pi 4, 8GB ram.

Beginning with a clean Raspberry Pi OS 2021-01-11-raspios-buster-armhf.

Prerequisite Packages

Install the following packages:

apt update
apt-get install bison build-essential flex git gperf libasound2-dev libcups2-dev libdbus-1-dev libfontconfig1-dev libfreetype6-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev libharfbuzz-dev libicu-dev libinput-dev libjpeg-dev libnss3-dev libpng-dev libpulse-dev libraspberrypi-dev libsqlite3-dev libssl-dev libx11-dev libx11-xcb-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-ewmh-dev libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-imdkit-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-record0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-res0-dev libxcb-screensaver0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-util0-dev libxcb-xf86dri0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-xinput-dev libxcb-xkb-dev libxcb-xrm-dev libxcb-xtest0-dev libxcb-xv0-dev libxcb-xvmc0-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libxrandr-dev libxrender-dev libxtst-dev mesa-common-dev ninja-build

Build qt5

Download sources

mkdir src
cd src
wget https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz
tar xf qt-everywhere-src-5.15.2.tar.xz

Get qt5 mkspecs for raspberry

git clone https://github.com/oniongarlic/qt-raspberrypi-configuration.git
cd qt-raspberrypi-configuration
make install DESTDIR=../qt-everywhere-src-5.15.2
cd ..

Compile

In src directory, patch qt:

patch -p0 << EOD
--- ./qt-everywhere-src-5.15.2/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h.ORIG	2021-02-10 21:12:19.025766762 +0100
+++ ./qt-everywhere-src-5.15.2/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h	2021-02-10 21:13:56.784949313 +0100
@@ -367,7 +367,8 @@
 #    define WTF_CPU_ARM_TRADITIONAL 1
 #    define WTF_CPU_ARM_THUMB2 0
 #  else
-#    error "Not supported ARM architecture"
+#    define WTF_CPU_ARM_TRADITIONAL 1
+#    define WTF_CPU_ARM_THUMB2 0
 #  endif
 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
 #  error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
EOD

Configure qt for opengl "desktop".

mkdir build-qt
cd build-qt
PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig \
../qt-everywhere-src-5.15.2/configure -platform linux-rpi3-g++ \
-v \
-opengl desktop -eglfs \
-no-gtk \
-xcb -xcb-xlib -bundled-xcb-xinput \
-opensource -confirm-license -release \
-reduce-exports \
-force-pkg-config \
-nomake examples -no-compile-examples \
-skip qtwayland \
-no-feature-geoservices_mapboxgl \
-qt-pcre \
-no-pch \
-ssl \
-evdev \
-system-freetype \
-fontconfig \
-glib \
-prefix /usr/lib/qt5.15.2  \
-qpa eglfs

Check the configuration summary says

OpenGL:
    Desktop OpenGL ....................... yes

To build, in build-qt type:

make -j4

Compilation takes less than 18 hours.

Create debian package

In the src/build-qt directory:

mkdir deb
INSTALL_ROOT=$PWD/deb make install

Create the configuration file for qtchooser:

mkdir -p deb/usr/share/qtchooser/
cat > deb/usr/share/qtchooser/qt5.15.2-opengl.conf <<EOD
/usr/lib/qt5.15.2/bin/
/usr/lib/qt5.15.2/lib/
EOD

Create the debian control file:

mkdir deb/DEBIAN
cat > deb/DEBIAN/control <<EOD
Package: qt5-opengl-dev
Version: 5.15.2
Maintainer: Koen <[email protected]>
Priority: optional
Section: libs
Bugs: https://github.com/koendv/qt5-opengl-raspberrypi/issues
Homepage: https://github.com/koendv/qt5-opengl-raspberrypi
Depends: bison, build-essential, flex, git, gperf, libasound2-dev, libcups2-dev, libdbus-1-dev, libfontconfig1-dev, libfreetype6-dev, libgl1-mesa-dev, libglib2.0-dev, libglu1-mesa-dev, libharfbuzz-dev, libicu-dev, libinput-dev, libjpeg-dev, libnss3-dev, libpng-dev, libpulse-dev, libraspberrypi-dev, libsqlite3-dev, libssl-dev, libx11-dev, libx11-xcb-dev, libxcb-composite0-dev, libxcb-cursor-dev, libxcb-damage0-dev, libxcb-dpms0-dev, libxcb-dri2-0-dev, libxcb-dri3-dev, libxcb-ewmh-dev, libxcb-glx0-dev, libxcb-icccm4-dev, libxcb-image0-dev, libxcb-imdkit-dev, libxcb-keysyms1-dev, libxcb-present-dev, libxcb-randr0-dev, libxcb-record0-dev, libxcb-render-util0-dev, libxcb-render0-dev, libxcb-res0-dev, libxcb-screensaver0-dev, libxcb-shape0-dev, libxcb-shm0-dev, libxcb-sync-dev, libxcb-util0-dev, libxcb-xf86dri0-dev, libxcb-xfixes0-dev, libxcb-xinerama0-dev, libxcb-xinput-dev, libxcb-xkb-dev, libxcb-xrm-dev, libxcb-xtest0-dev, libxcb-xv0-dev, libxcb-xvmc0-dev, libxcomposite-dev, libxcursor-dev, libxdamage-dev, libxext-dev, libxfixes-dev, libxi-dev, libxkbcommon-dev, libxkbcommon-x11-dev, libxrandr-dev, libxrender-dev, libxtst-dev, mesa-common-dev, ninja-build
Architecture: armhf
Description: Qt5.15.2 LTS with desktop OpenGL
 Qt5.15.2 LTS "long term support" with desktop OpenGL,
 compiled on raspberry pi 4 running Raspberry Pi OS [2021-01-11-raspios-buster-armhf.
 The package is suitable for compiling desktop-style, windowed Qt apps under X11. The OpenGL support is in software, using Mesa.
EOD

Create the debian package:

fakeroot dpkg-deb -b ./deb/ .

This produces the debian package file ./qt5-opengl-dev_5.15.2_armhf.deb

Build notes for qtcreator 4.14.1

These are notes for a native build of QtCreator 4.14.1 on a Raspberry Pi OS 2021-01-11-raspios-buster-armhf (32 bit).

Prerequisites

Beginning with a clean Raspberry Pi OS 2021-01-11-raspios-buster-armhf (32 bit).

Install qt5 with desktop OpenGL

wget https://github.com/koendv/qt5-opengl-raspberrypi/releases/download/v5.15.2-1/qt5-opengl-dev_5.15.2_armhf.deb
sudo apt-get update
sudo apt --fix-broken  install ./qt5-opengl-dev_5.15.2_armhf.deb
sudo apt-get install build-essential qtchooser cmake ninja-build elfutils libelf-dev libdw-dev libasm-dev libzstd-dev

Build qtcreator

wget https://download.qt.io/official_releases/qtcreator/4.14/4.14.1/qt-creator-opensource-src-4.14.1.tar.xz
tar xf qt-creator-opensource-src-4.14.1.tar.xz

patch -p0 <<EOD
--- qt-creator-opensource-src-4.14.1.ORIG/CMakeLists.txt	2021-02-23 09:29:55.000000000 +0000
+++ qt-creator-opensource-src-4.14.1/CMakeLists.txt	2021-03-19 13:04:39.696303218 +0000
@@ -1,5 +1,7 @@
 cmake_minimum_required(VERSION 3.10)
 
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
 ## Add paths to check for cmake modules:
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
EOD

mkdir  build-qt-creator
cd build-qt-creator/
export QT_SELECT=qt5.15.2-opengl
export Qt5_DIR=/usr/lib/qt5.15.2/
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ../qt-creator-opensource-src-4.14.1 | tee qtcreator-cmake.txt
make -j4

Check Configuration output

70 minutes compiling...

Create debian package

mkdir deb
DESTDIR=$PWD/deb make install
mkdir deb/DEBIAN
cat > deb/DEBIAN/control <<EOD
Package: qt5-opengl-qtcreator
Version: 4.14.1
Maintainer: Koen <[email protected]>
Priority: optional
Section: libs
Bugs: https://github.com/koendv/qt5-opengl-raspberrypi/issues
Homepage: https://github.com/koendv/qt5-opengl-raspberrypi
Depends: qt5-opengl-dev, build-essential, qtchooser, cmake, ninja-build, elfutils, libelf-dev, libdw-dev, libasm-dev, libzstd-dev
Architecture: armhf
Description: qtcreator IDE for Qt5.15.2 LTS with desktop OpenGL
 qtcreator IDE for Qt5.15.2 LTS, compiled on raspberry pi 4 running Raspberry Pi OS 2021-01-11-raspios-buster-armhf (32 bit).
 Install qt5-opengl-dev_5.15.2_armhf.deb first.
EOD
fakeroot dpkg-deb -b ./deb/ .

This produces the debian package file qt5-opengl-qtcreator_4.14.1_armhf.deb

This completes the build notes.

See Also

Setting up a chroot on raspbian.

Native Build of Qt5 on a Raspberry Pi

qt5-opengl-raspberrypi's People

Contributors

koendv avatar shivasiddharth avatar whoppermachine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

qt5-opengl-raspberrypi's Issues

No libqxcb.so

Hi, I use qt5.15.1, when make finished, there is no libqxcb.so created in plugins/platforms/ .

Compile Qt5 with proprietary codecs

I'm compiling this project with proprietary codecs right now, is it okay with you if I will add the instructions to this document as well?

Building Qt5 on the RPI3 B+

I have tried cross-compiling and it hasn't worked. Building it natively on the RPI 3 B+ with qtwebengine is not possible for me because the memory isn't enough and my SD card is too small for a proper swap.
I think your method of using a chroot on raspbian may work.
I don't understand what the difference would be between building for RPI4 / RPI 3 if the image is the same..

Issue * failed to add service - already in use?

Hey,

I've installed the two packages accordingly but get this following error:

pi@raspberrypi:~ $ qtcreator

  • failed to add service - already in use?

Any idea why i'm getting the failed to add service? Even when trying to run QT apps.

No themes found in installation error

After a make install and trying to run qtcreator, I got:

Warning: No themes found in installation:  "/usr/share/qtcreator/themes"
Segmentation fault

I fixed it with:
sudo cp -r share /usr

arm64 support

Hey, would be nice to have arm64 package available as well :)

I'm using qt as a dependency in this project and can't get a compatible build on my rpi4.

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.