2020年2月3日 星期一

安裝Qt

Written with StackEdit.

Environment:

ubuntu 18.04


everywhere

下載:   https://download.qt.io/archive/qt/5.12/5.12.5/single/
安裝
sudo apt-get install libgl1-mesa-dev \
libglu1-mesa-dev \
libwayland-dev \
libclang-dev \
libsnappy-dev \
libavformat-dev \
libavutil-dev \
libfontconfig1-dev \ #for fontconfig
libgtk-3-dev \  #for xcb
libre2-dev \  #for re2
libpoppler-cpp-dev \  #for webengine-poppler
libgles2-mesa-dev \ #for opengl ES2
libgles2-mesa \ #for opengl ES2
libwebp-dev \  #for webp
libwebpdemux1 \ #for webp
libjsoncpp-dev \ #for jsoncpp
re2c \
gperf \
bison \
flex \

Compile

  • ./configure -prefix /opt/Qt/5.12.5 -qt-xcb -webengine-pepper-plugins -webengine-proprietary-codecs -opengl -webengine-ffmpeg -webengine-opus -webengine-webp (很久)
  • ./make (很久很久…超過3小時)
  • ./make install
      more options: ./configure --help
      more log for compile: ./config.lgo & ./config.summary


troubleshoot

1. libqwebengineview.so & libqtwebengineplugin.so for "QT += webenginewidgets"
cd qt-5.12.5/qtwebengine/src/webenginewidgets
/opt/Qt/5.12.5/bin/qmake webenginewidgets.pro
make
make install
  • /usr/local/lib/libxml2.so 沒有"xmlCatalogSetDefaults"
  • /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4有"xmlCatalogSetDefaults"
   所以需要手動拷貝
2.config.qtwebengine_core.tests.webengine-libvpx FAILED
<vpx/vpx_encoder.h>
pkt.data.frame.width[0] = 0u;
pkt.data.frame.height[0] = 0u;
libvpx 比較麻煩,原本用apt-get安裝的並沒有width和height需要另外下載開源碼
編譯libvpx
./configure --prefix=/usr --enable-shared --disable-static
make
make install
但 /opt/Qt/5.12.5/bin/qmake qt-5.12.5/qtwebengine/config.tests/libvpx/libvpx.pro後的makefile
(g++ -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -o libvpx .obj/libvpx.o -L/usr/local/lib -lvpx -lm)
它是去讀 /usr/local/include的
所以要將vpx(head files)拷貝到 /usr/local/include 和 /usr/include
3. QQmlApplicationEngine, 是在libQt5Qml.so.5,有重新編過
(qtdeclarative/src/qml/ $make clean; rm -rf Makefile; qmake qml.pro)



Creator

Download:https://www.qt.io/download-open-source# (最下方)
  1. sudo chmod 755 qt-unified-linux-x64-3.2.1-online.run
  2. ./qt-unified-linux-x64-3.2.1-online.run
  3. register
  4. (need a lot of storage space)

Cross Compile

Select your target in qtbase/mkspecs/ or qtbase/mkspecs/devices
ex:
  1. linux-aarch64-gnu-g++
  2. linux-arm-gnueabi-g++ (There is no linux-arm-gnueabihf-g++)
  3. linux-rasp-pi2-g++

Start:

  1. My target board is not RPI2, but RPI2 is 32bit, ARMv7, the SoC specs is the same as my target board
  2. GCC version of the target board is 32-bit, 4.9.x , so select the gcc-linaro-4.9.4-guneabihf_i686
  3. Copy the /usr & /lib form target board to /opt/gcc/opt/Qt/Qt5.12.5_guneabihf for sysroot
./configure -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=/opt/gcc/gcc-linaro-4.9.4-guneabihf_i686/bin/arm-linux-gnueabihf- -sysroot /opt/Qt/Qt5.12.5_guneabihf -confirm-license -prefix / -v
or
./configure -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=/opt/gcc/gcc-linaro-4.9.4-guneabihf_i686/bin/arm-linux-gnueabihf- -sysroot /opt/Qt/Qt5.12.5_guneabihf -I/opt/Qt/Qt5.12.5_guneabihf/usr/include -L/opt/Qt/Qt5.12.5_guneabihf/usr/lib/arm-linux-gnueabihf -ssl -openssl -confirm-license -prefix /
    Configure summary:
    Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Building for: devices/linux-rasp-pi2-g++ (arm, CPU features: neon)
    Target compiler: gcc 4.9.4
    Configuration: cross_compile compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus reduce_exports stl
    Build options:
      Mode ................................... release
      Optimize release build for size ........ no
      Building shared libraries .............. yes
      Using C standard ....................... C11
      Using C++ standard ..................... C++14
      Using ccache ........................... no
      Using gold linker ...................... no
      Using new DTAGS ........................ yes
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        NEON ................................. yes
      Build parts ............................ libs examples
    Qt modules and options:
      Qt Concurrent .......................... yes
      Qt D-Bus ............................... yes
      Qt D-Bus directly linked to libdbus .... no
      Qt Gui ................................. yes
      Qt Network ............................. yes
      Qt Sql ................................. yes
      Qt Testlib ............................. yes
      Qt Widgets ............................. yes
      Qt Xml ................................. yes
    Support enabled for:
      Using pkg-config ....................... yes
      udev ................................... no
      Using system zlib ...................... yes
    Qt Core:
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ no
      GLib ................................... no
      iconv .................................. yes
      ICU .................................... no
      Tracing backend ........................ <none>
      Logging backends:
        journald ............................. no
        syslog ............................... no
        slog2 ................................ no
      Using system PCRE2 ..................... no
    Qt Network:
      getifaddrs() ........................... yes
      IPv6 ifname ............................ yes
      libproxy ............................... no
      Linux AF_NETLINK ....................... yes
      OpenSSL ................................ yes
        Qt directly linked to OpenSSL ........ no
      OpenSSL 1.1 ............................ yes
      DTLS ................................... no
      SCTP ................................... no
      Use system proxies ..................... yes
    Qt Gui:
      Accessibility .......................... yes
      FreeType ............................... yes
        Using system FreeType ................ yes
      HarfBuzz ............................... yes
        Using system HarfBuzz ................ no
      Fontconfig ............................. yes
      Image formats:
        GIF .................................. yes
        ICO .................................. yes
        JPEG ................................. yes
          Using system libjpeg ............... no
        PNG .................................. yes
          Using system libpng ................ yes
      EGL .................................... yes
      OpenVG ................................. no
      OpenGL:
        Desktop OpenGL ....................... yes
        OpenGL ES 2.0 ........................ no
        OpenGL ES 3.0 ........................ no
        OpenGL ES 3.1 ........................ no
        OpenGL ES 3.2 ........................ no
      Vulkan ................................. no
      Session Management ..................... yes
    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... no
      INTEGRITY HID .......................... no
      mtdev .................................. no
      tslib .................................. no
      xkbcommon .............................. no
      X11 specific:
        XLib ................................. yes
        XCB Xlib ............................. yes
        EGL on X11 ........................... yes
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. yes
      EGLFS details:
        EGLFS OpenWFD ........................ no
        EGLFS i.Mx6 .......................... no
        EGLFS i.Mx6 Wayland .................. no
        EGLFS RCAR ........................... no
        EGLFS EGLDevice ...................... no
        EGLFS GBM ............................ no
        EGLFS VSP2 ........................... no
        EGLFS Mali ........................... no
        EGLFS Raspberry Pi ................... no
        EGLFS X11 ............................ yes
      LinuxFB ................................ yes
      VNC .................................... yes
      Mir client ............................. no
    Qt Sql:
      SQL item models ........................ yes
    Qt Widgets:
      GTK+ ................................... no
      Styles ................................. Fusion Windows
    Qt PrintSupport:
      CUPS ................................... no
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    Qt Testlib:
      Tester for item models ................. yes
    Qt SerialBus:
      Socket CAN ............................. yes
      Socket CAN FD .......................... yes
    Further Image Formats:
      JasPer ................................. no
      MNG .................................... no
      TIFF ................................... yes
        Using system libtiff ................. no
      WEBP ................................... yes
        Using system libwebp ................. no
    Qt QML:
      QML network support .................... yes
      QML debugging and profiling support .... yes
      QML sequence object .................... yes
      QML list model ......................... yes
      QML XML http request ................... yes
      QML Locale ............................. yes
      QML delegate model ..................... yes
    Qt Quick:
      Direct3D 12 ............................ no
      AnimatedImage item ..................... yes
      Canvas item ............................ yes
      Support for Qt Quick Designer .......... yes
      Flipable item .......................... yes
      GridView item .......................... yes
      ListView item .......................... yes
      TableView item ......................... yes
      Path support ........................... yes
      PathView item .......................... yes
      Positioner items ....................... yes
      Repeater item .......................... yes
      ShaderEffect item ...................... yes
      Sprite item ............................ yes
    Qt Scxml:
      ECMAScript data model for QtScxml ...... yes
    Qt Gamepad:
      SDL2 ................................... no
    Qt 3D:
      Assimp ................................. yes
      System Assimp .......................... no
      Output Qt3D Job traces ................. no
      Output Qt3D GL traces .................. no
      Use SSE2 instructions .................. no
      Use AVX2 instructions .................. no
      Aspects:
        Render aspect ........................ yes
        Input aspect ......................... yes
        Logic aspect ......................... yes
        Animation aspect ..................... yes
        Extras aspect ........................ yes
    Qt 3D Renderers:
      OpenGL Renderer ........................ yes
    Qt 3D GeometryLoaders:
      Autodesk FBX ........................... no
    Qt Wayland Client ........................ no
    Qt Wayland Compositor .................... no
    Qt Bluetooth:
      BlueZ .................................. no
      BlueZ Low Energy ....................... no
      Linux Crypto API ....................... no
      WinRT Bluetooth API (desktop & UWP) .... no
    Qt Sensors:
      sensorfw ............................... no
    Qt Quick Controls 2:
      Styles ................................. Default Fusion Imagine Material Universal
    Qt Quick Templates 2:
      Hover support .......................... yes
      Multi-touch support .................... yes
    Qt Positioning:
      Gypsy GPS Daemon ....................... no
      WinRT Geolocation API .................. no
    Qt Location:
      Qt.labs.location experimental QML plugin . yes
      Geoservice plugins:
        OpenStreetMap ........................ yes
        HERE ................................. yes
        Esri ................................. yes
        Mapbox ............................... yes
        MapboxGL ............................. yes
        Itemsoverlay ......................... yes
    QtXmlPatterns:
      XML schema support ..................... yes
    Qt Multimedia:
      ALSA ................................... yes
      GStreamer 1.0 .......................... no
      GStreamer 0.10 ......................... no
      Video for Linux ........................ yes
      OpenAL ................................. no
      PulseAudio ............................. no
      Resource Policy (libresourceqt5) ....... no
      Windows Audio Services ................. no
      DirectShow ............................. no
      Windows Media Foundation ............... no
    Qt Tools:
      QDoc ................................... no
    Qt WebEngine:
      Embedded build ......................... yes
      Full debug information ................. no
      Pepper Plugins ......................... no
      Printing and PDF ....................... no
      Proprietary Codecs ..................... no
      Spellchecker ........................... yes
      Native Spellchecker .................... no
      WebRTC ................................. no
      Use System Ninja ....................... no
      Geolocation ............................ yes
      WebChannel support ..................... yes
      Use v8 snapshot ........................ yes
      Kerberos Authentication ................ no
      Support qpa-xcb ........................ no
      Building v8 snapshot supported ......... no
      Use ALSA ............................... yes
      Use PulseAudio ......................... no
      Optional system libraries used:
        re2 .................................. no
        icu .................................. no
        libwebp, libwebpmux and libwebpdemux . no
        opus ................................. no
        ffmpeg ............................... no
        libvpx ............................... no
        snappy ............................... no
        glib ................................. yes
        zlib ................................. yes
        minizip .............................. no
        libevent ............................. no
        jsoncpp .............................. no
        protobuf ............................. no
        libxml2 and libxslt .................. no
        lcms2 ................................ no
        png .................................. no
        JPEG ................................. no
        harfbuzz ............................. no
        freetype ............................. yes
      Required system libraries:
        fontconfig ........................... yes
        dbus ................................. no
        nss .................................. no
        khr .................................. yes
        glibc ................................ yes
      Required system libraries for qpa-xcb:
        x11 .................................. yes
        libdrm ............................... yes
        xcomposite ........................... no
        xcursor .............................. no
        xi ................................... no
        xtst ................................. no

    Note: Also available for Linux: linux-clang linux-icc

    Note: PKG_CONFIG_LIBDIR automatically set to /opt/Qt/Qt5.12.5_guneabihf/usr/lib/pkgconfig:/opt/Qt/Qt5.12.5_guneabihf/usr/share/pkgconfig:/opt/Qt/Qt5.12.5_guneabihf/usr/lib/arm-linux-gnueabihf/pkgconfig

    Note: PKG_CONFIG_SYSROOT_DIR automatically set to /opt/Qt/Qt5.12.5_guneabihf

    WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.

    Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
    On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
    On macOS, you can use Homebrew's llvm package.
    On Windows, you must set LLVM_INSTALL_DIR to the installation path.

    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/opt/Qt/Qt5.12.5_guneabihf/'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
a lot of trouble issue, copy lose library form lib to usr
ex: libdl.a (find ./ -name "libm.*" | xargs ls --color -alh)
      (copy libdl.so.x.x form /opt/Qt/Qt5.12.5_xx/lib to /opt/Qt/Qt5.12.5_xx/usr and make softlink)


After compiling, check the /opt/Qt/Qt5.12.5_guneabihf/bin/
canbusutil:            ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=ccfdf934172bc2e9249426cd47276f8458b7658b, stripped
fixqt4headers.pl:      a /usr/bin/env perl script, ASCII text executable
lconvert:              ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=dbe03cd53310f176cb4b0d153de37b665455f8af, stripped
lrelease:              ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=951acb375769f751935c252693440527ddafcbca, stripped
lupdate:               ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=65942326e5223fa9bf0b98becbb696e252e01777, stripped
moc:                   ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=3a213330171f7cf657a7af9ca9748e3263404ef6, stripped
qdbus:                 ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=2575dbd08bdb9d326aba82f6f8d598ada56d65a4, stripped
qdbuscpp2xml:          ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=d2a31317929e23c263ddd6a29a021f283a44af78, stripped
qdbusviewer:           ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=9f42384cb58e303fd8c0dc8c62622ab48840211f, stripped
qdbusxml2cpp:          ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=9d455355d898de0a4ea1016aca8c8bff87c0e7c3, stripped
qgltf:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=754677bc184ca86e1da9df74b776fc7bb36792fd, stripped
qlalr:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=3d865d28934ae23845d8530f42a6904e71ae279e, stripped
qmake:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=1f59dd50ab5e822f5ba5d4fb1d65d2fa0393e948, not stripped
qml:                   ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=ba48e0f023dafd1ffbc3aadfdefaf0ee2d64c71b, stripped
qmlcachegen:           ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=0d0a3d2fb47ab845c6e1f1f65f38b58ac79e0e3b, stripped
qmlimportscanner:      ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=4abd83d35a901b6b8cbaa585342a5133f6901dcd, stripped
qmllint:               ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=d8f3ecb8e35df2e87a9b9837be5c91efccfc7f32, stripped
qmlmin:                ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=dbd96a818df62b126a1b42f5b721d866c5ea7f11, stripped
qmlpreview:            ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=c4193b805436072f49041c4d12c2101ab2c5201c, stripped
qmlscene:              ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=90b8a43caba92987845e63a759ecda1895606942, stripped
qmltestrunner:         ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=5d72242414ae067c19cb4ac641a224b2b23d46ad, stripped
qscxmlc:               ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=1476cb52e827348eb997756c6ad667f71ec8a63c, stripped
qtattributionsscanner: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=12adb5624c828550b3086897b1bdf89220fe422a, stripped
qtdiag:                ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=b3e356b22f45bc11151fe9baa5adc8dbb7125671, stripped
qtpaths:               ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=4359187c31d920f3e0467ccc0223f93bf39f6879, stripped
qtplugininfo:          ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=2fe8ac3ff0f02aaa11b8d52e1d167b62a92340c6, stripped
qvkgen:                ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=55c65d3df95f32dd1b40e23233ac40e2a137c91c, stripped
rcc:                   ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=941d72e5c122f14f2163e6b6fe2d130725254356, stripped
repc:                  ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=1d26c059d68a0a1c91dfadfbe957eccc85ac22ca, stripped
syncqt.pl:             a /usr/bin/env perl script, ASCII text executable
uic:                   ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=74fa6993997a37bb333d19bcebae8d84e83a8db7, stripped
xmlpatterns:           ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=7ce52c834c1add0e22060a1c9805d4fe1d86828e, stripped
xmlpatternsvalidator:  ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=81a26a9fe33cb822eafeb142e3bb94dff0aabeeb, stripped

issues when running on target board

  1. This application failed to start because it could not find or load the Qt platform plugin “linuxfb” in “”
export QTDIR=/opt/Qt/Qt5.12.5_guneabihf
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
————————————————
版权声明:本文为CSDN博主「天已青色等烟雨来」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/x356982611/article/details/70799165
  1. module “QtQuick.Window” is not installed
export QML2_IMPORT_PATH=$QTDIR/qml


ref:
1. [HowTo] Cross compile Qt5
2. Cross-compile and deploy Qt 5.12 for Raspberry Pi
3. jiejieaiai
4. 天已青色等烟雨来

沒有留言:

張貼留言