项目作者: hasboeuf

项目描述 :
Cross compile Qt for ARM
高级语言: Shell
项目地址: git://github.com/hasboeuf/cutearm.git
创建时间: 2019-08-23T21:17:30Z
项目社区:https://github.com/hasboeuf/cutearm

开源协议:

下载


cutearm

To compile Qt for Raspberry, there are generally two ways:

  1. compile on device
  2. use cross-compilation

First solution might be slow: have you ever tried to compile Qt on Raspberry 1? It takes more than 24 hours and you’re not really satisfied when compilation breaks 1 hour after you started it while you’re in your bed dreaming to get those .so files.

Second solution works well but is not easy to setup and maintained.

Here is a third solution which takes advantage of docker ARM images in order to work directly on Raspbian like on your Raspberry but within a container.

Overall steps

  • Create a Raspbian docker image
  • Build a container based on this image with Qt compilation deps
  • SSH on this container and perform compilation steps of Qt

Steps

  • ./build-raspbian-docker-image: create a raspbian docker image
  • ./build-raspbian-docker-container: create the container able to compile Qt
  • ./start-raspbian-docker-container: start the container with volumes mounted

User is worker, password too.

  • docker inspect to get the container IP
  • ssh worker@ip
  • Then:
  1. wget http://download.qt.io/official_releases/qt/5.12/5.12.0/single/qt-everywhere-src-5.12.0.tar.xz
  2. wget http://download.qt.io/official_releases/qt/5.12/5.12.0/single/md5sums.txt
  3. md5sum --check --ignore-missing md5sums.txt
  4. tar xf qt-everywhere-src-5.12.0.tar.xz
  5. mkdir build
  6. cd build
  7. PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig \
  8. ../qt-everywhere-src-5.12.0/configure \
  9. -v \
  10. -opengl es2 -eglfs \
  11. -no-gtk \
  12. -opensource -confirm-license -release \
  13. -reduce-exports \
  14. -force-pkg-config \
  15. -nomake examples -no-compile-examples \
  16. -skip qtwayland \
  17. -skip qtwebengine \
  18. -skip qt3d \
  19. -skip qtscript \
  20. -no-feature-geoservices_mapboxgl \
  21. -qt-pcre \
  22. -no-pch \
  23. -ssl \
  24. -evdev \
  25. -system-freetype \
  26. -fontconfig \
  27. -glib \
  28. -prefix /usr/workspace/Qt5.12.0 \
  29. -qpa eglfs \
  30. -sctp \
  31. QMAKE_CFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
  32. QMAKE_CXXFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
  33. QMAKE_LIBS_EGL="-lEGL -lGLESv2" QMAKE_LIBS_OPENVG="-lEGL -lOpenVG -lGLESv2" \
  34. QMAKE_LIBDIR_OPENGL_ES2=/opt/vc/lib QMAKE_INCDIR_OPENGL_ES2="/opt/vc/include /opt/vc/include/interface/vcos/pthreads /opt/vc/include/interface/vmcs_host/linux" \
  35. QMAKE_LIBDIR_EGL=/opt/vc/lib QMAKE_INCDIR_EGL="/opt/vc/include /opt/vc/include/interface/vcos/pthreads /opt/vc/include/interface/vmcs_host/linux" \
  36. QMAKE_LIBDIR_OPENVG=/opt/vc/lib QMAKE_INCDIR_OPENVG="/opt/vc/include /opt/vc/include/interface/vcos/pthreads /opt/vc/include/interface/vmcs_host/linux" \
  37. -DEGLFS_DEVICE_INTEGRATION=eglfs_brcm
  38. make
  39. make install

This takes around 10h to compile Qt on an average machine.

Test

  1. mkdir qt-sample-app-build
  2. cd qt-sample-app-build
  3. ../Qt5.12.0/bin/qmake -recursive ../qt-sample-app/qt-sample-app.pro
  4. make
  5. ./qt-sample-app