Qt - stereoboy/Study GitHub Wiki

Reference

qt installer framework

Download 3.2.2 for Qt5.9.5

Items

Install

sudo apt-get install -y build-essential libgl1-mesa-dev
sudo apt-get install qtcreator qt5-default
sudo apt-get install qt5-doc qtbase5-examples qtbase5-doc-html

sudo apt-get update
sudo apt-get install -y qt5-default qtcreator
sudo apt-get install -y qt5-doc qtbase5-examples qtbase5-doc-html
sudo apt-get install -y qt3d5-dev qt3d5-examples qt3d5-doc-html
sudo apt-get install -y qt3d-defaultgeometryloader-plugin

Build Qt5 from source code

Tools

  • qmake
    • installed after installing package qt5-default
$ qmake -v
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
$qmake -query
QT_SYSROOT:
QT_INSTALL_PREFIX:/usr
QT_INSTALL_ARCHDATA:/usr/lib/x86_64-linux-gnu/qt5
QT_INSTALL_DATA:/usr/share/qt5
QT_INSTALL_DOCS:/usr/share/qt5/doc
QT_INSTALL_HEADERS:/usr/include/x86_64-linux-gnu/qt5
QT_INSTALL_LIBS:/usr/lib/x86_64-linux-gnu
QT_INSTALL_LIBEXECS:/usr/lib/x86_64-linux-gnu/qt5/libexec
QT_INSTALL_BINS:/usr/lib/qt5/bin
QT_INSTALL_TESTS:/usr/tests
QT_INSTALL_PLUGINS:/usr/lib/x86_64-linux-gnu/qt5/plugins
QT_INSTALL_IMPORTS:/usr/lib/x86_64-linux-gnu/qt5/imports
QT_INSTALL_QML:/usr/lib/x86_64-linux-gnu/qt5/qml
QT_INSTALL_TRANSLATIONS:/usr/share/qt5/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/usr/lib/x86_64-linux-gnu/qt5/examples
QT_INSTALL_DEMOS:/usr/lib/x86_64-linux-gnu/qt5/examples
QT_HOST_PREFIX:/usr
QT_HOST_DATA:/usr/lib/x86_64-linux-gnu/qt5
QT_HOST_BINS:/usr/lib/qt5/bin
QT_HOST_LIBS:/usr/lib/x86_64-linux-gnu
QMAKE_SPEC:linux-g++
QMAKE_XSPEC:linux-g++
QMAKE_VERSION:3.1
QT_VERSION:5.9.5

Qt Installer Framework

drawing

Preprocess: linuxdeployqt

# Get and run linuxdeployqt
wget -c https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
  • create Icon.{png|svg}
  • create windowApp.desktop
$ cat ./windowApp.desktop 
[Desktop Entry]
Name=windowApp
Comment=None
Exec=windowApp
Icon=<icon_name_only> # no extension https://github.com/probonopd/linuxdeployqt/issues/383
Type=Application
Categories=Qt;Utility;Documentation;
Terminal=false
StartupNotify=true
./linuxdeployqt-continuous-x86_64.AppImage  ./build-windowApp-Desktop-Release/windowApp -appimage -verbose=1
linuxdeployqt  (commit d6ac06c), build 19 built on 2022-07-04 19:17:26 UTC
Not using FHS-like mode
app-binary: "/home/jylee/work2/qt5/build-windowApp-Desktop-Release/windowApp"
appDirPath: "/home/jylee/work2/qt5/build-windowApp-Desktop-Release"
relativeBinPath: "windowApp"
Keeping existing AppRun
WARNING: "/home/jylee/work2/qt5/build-windowApp-Desktop-Release/qt.conf" already exists, will not overwrite.
appimagetool, continuous build (commit e30750f), build <local dev build> built on 2022-04-03 14:40:54 UTC
fatal: not a git repository (or any parent up to mount point /home/jylee)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Failed to run 'git rev-parse --short HEAD: Child process exited with code 128 (code 128)
Desktop file: /home/jylee/work2/qt5/build-windowApp-Desktop-Release/windowApp.desktop
Name: windowApp
Icon: meld
Exec: windowApp
Comment: None
Type: Application
Categories: Qt;Utility;Documentation;
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libXau.so.6 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/liblzma.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-xinerama.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libXdmcp.so.6 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-xkb.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-shape.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libpcre.so.3 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-sync.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-glx.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-randr.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-icccm.so.4 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libgraphite2.so.3 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libicuuc.so.60 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-render.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/liblz4.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libQt5Svg.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libgcrypt.so.20 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libjpeg.so.8 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-keysyms.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-xfixes.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libQt5XcbQpa.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libicui18n.so.60 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libdouble-conversion.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libQt5Widgets.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libglib-2.0.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxkbcommon-x11.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libQt5Core.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libQt5Gui.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libpng16.so.16 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-util.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxkbcommon.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-image.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libQt5DBus.so.5 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libFcitxQt5DBusAddons.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libXi.so.6 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libsystemd.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libdbus-1.so.3 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libXext.so.6 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-render-util.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libicudata.so.60 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libX11-xcb.so.1 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libbsd.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/lib/libxcb-shm.so.0 used for determining architecture x86_64
/home/jylee/work2/qt5/build-windowApp-Desktop-Release/windowApp used for determining architecture x86_64
Using architecture x86_64
App name for filename: windowApp
/home/jylee/work2/qt5/build-windowApp-Desktop-Release should be packaged as windowApp-x86_64.AppImage
Deleting pre-existing .DirIcon
Creating .DirIcon symlink based on information from desktop file
Generating squashfs...
Size of the embedded runtime: 189632 bytes
mksquashfs commandline: /tmp/.mount_linuxd6KksST/usr/bin/../lib/appimagekit/mksquashfs /home/jylee/work2/qt5/build-windowApp-Desktop-Release windowApp-x86_64.AppImage -offset 189632 -comp gzip -root-owned -noappend -mkfs-time 0 
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on windowApp-x86_64.AppImage, block size 131072.
[==============================================================================================================================================================================================\] 610/610 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments,
	compressed xattrs, compressed ids
	duplicates are removed
Filesystem size 24028.96 Kbytes (23.47 Mbytes)
	36.18% of uncompressed filesystem size (66421.10 Kbytes)
Inode table size 3358 bytes (3.28 Kbytes)
	42.30% of uncompressed inode table size (7939 bytes)
Directory table size 1789 bytes (1.75 Kbytes)
	41.54% of uncompressed directory table size (4307 bytes)
Number of duplicate files found 14
Number of inodes 183
Number of files 130
Number of fragments 25
Number of symbolic links  2
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 51
Number of ids (unique uids + gids) 1
Number of uids 1
	root (0)
Number of gids 1
	root (0)
Embedding ELF...
Marking the AppImage as executable...
Embedding MD5 digest
Success

Please consider submitting your AppImage to AppImageHub, the crowd-sourced
central directory of available AppImages, by opening a pull request
at https://github.com/AppImage/appimage.github.io
  • ignore windowApp-x86_64.AppImage

Build static Qt5 from source code

sudo apt-get install python libfontconfig1-dev
git clone git://code.qt.io/qt/qt5.git
cd qt5
git checkout v5.9.5 -b 5_9_5
git submodule update --init --recursive qtbase/ ./qtdeclarative/ ./qttools/ ./qttranslations/
sudo apt-get build-dep qtbase5-dev // or sudo apt-get install qtbase5-dev

./configure -prefix $PWD/qtbase -release -static -accessibility -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre \
 -no-glib -no-cups -no-sql-sqlite -no-qml-debug -no-opengl -no-egl -no-xinput2 -no-sm -no-icu \
 -nomake examples -nomake tests -no-libudev

...
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 ................ no
  EGL .................................... no
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ no
    OpenGL ES 3.0 ........................ no
    OpenGL ES 3.1 ........................ no
  Session Management ..................... no
...

make module-qtbase module-qtdeclarative module-qttools module-qttranslations -j
rm ./config.cache
make module-qtbase-clean module-qtdeclarative-clean module-qttools-clean module-qttranslations-clean

Build from Source

installer-framework# ../qt5/qtbase/bin/qmake -r
installer-framework# ../qt5/qtbase/bin/qmake -r CONFIG+=release
  • check executables' status
# readelf -d ./bin/binarycreator 

Dynamic section at offset 0x19a2600 contains 35 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000c (INIT)               0x118000
 0x000000000000000d (FINI)               0x12aa0d4
 0x0000000000000019 (INIT_ARRAY)         0x1937aa8
 0x000000000000001b (INIT_ARRAYSZ)       744 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x1937d90
 0x000000000000001c (FINI_ARRAYSZ)       16 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x3d8
 0x0000000000000005 (STRTAB)             0x32a8
 0x0000000000000006 (SYMTAB)             0x458
 0x000000000000000a (STRSZ)              7952 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x19a3870
 0x0000000000000002 (PLTRELSZ)           10752 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x1155e8
 0x0000000000000007 (RELA)               0x5818
 0x0000000000000008 (RELASZ)             1113552 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE
 0x000000006ffffffe (VERNEED)            0x5598
 0x000000006fffffff (VERNEEDNUM)         8
 0x000000006ffffff0 (VERSYM)             0x51b8
 0x000000006ffffff9 (RELACOUNT)          43918
 0x0000000000000000 (NULL)               0x0

Create configuration files

  • copy example/tutorial
  • modify config/config.xml, `packages/com.crazinglab.winApp/meta/package.xml
windowApp (master)$ git diff
diff --git a/config/config.xml b/config/config.xml
index db02746..770323b 100644
--- a/config/config.xml
+++ b/config/config.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Installer>
-    <Name>Your application</Name>
+    <Name>windowApp</Name>
     <Version>1.0.0</Version>
-    <Title>Your application Installer</Title>
-    <Publisher>Your vendor</Publisher>
+    <Title>windowApp</Title>
+    <Publisher>CrazingLab</Publisher>
     <StartMenuDir>Super App</StartMenuDir>
-    <TargetDir>@HomeDir@/InstallationDirectory</TargetDir>
+    <TargetDir>@HomeDir@/windowApp</TargetDir>
 </Installer>
diff --git a/packages/com.crazinglab.winApp/meta/package.xml b/packages/com.crazinglab.winApp/meta/package.xml
index 1038f91..dd996b0 100644
--- a/packages/com.crazinglab.winApp/meta/package.xml
+++ b/packages/com.crazinglab.winApp/meta/package.xml
@@ -1,15 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Package>
-    <DisplayName>The root component</DisplayName>
-    <Description>Install this example.</Description>
+    <DisplayName>windowApp</DisplayName>
+    <Description>Install windowApp.</Description>
     <Version>0.1.0-1</Version>
-    <ReleaseDate>2010-09-21</ReleaseDate>
+    <ReleaseDate>2022-07-27</ReleaseDate>
     <Licenses>
         <License name="Beer Public License Agreement" file="license.txt" />
     </Licenses>
-    <Default>script</Default>
-    <Script>installscript.qs</Script>
-    <UserInterfaces>
-        <UserInterface>page.ui</UserInterface>
-    </UserInterfaces>
+    <Default>true</Default>
 </Package>
windowApp (master)$ tree -d -L 3
.
├── config
│   └── config.xml
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── packages
│   └── com.crazinglab.winApp
│       ├── data
│       │   ├── AppRun -> windowApp
│       │   ├── config
│       │   ├── default.png
│       │   ├── doc
│       │   ├── installcontent.txt
│       │   ├── lib
│       │   ├── main.o
│       │   ├── mainwindow.o
│       │   ├── Makefile
│       │   ├── meld.svg
│       │   ├── moc_mainwindow.cpp
│       │   ├── moc_mainwindow.o
│       │   ├── moc_predefs.h
│       │   ├── plugins
│       │   ├── qt.conf
│       │   ├── translations
│       │   ├── ui_mainwindow.h
│       │   ├── windowApp
│       │   └── windowApp.desktop
│       └── meta
│           ├── license.txt
│           └── package.xml
├── windowApp.pro
├── windowApp.pro.user
└── windowApp.run
  • run
windowApp (master)$  ../installer-framework/bin/binarycreator -c config/config.xml -p packages windowApp.run
⚠️ **GitHub.com Fallback** ⚠️