Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Moved] Qt4 application complete on linux! Now how to build it statically?
vezprog last edited by
I have completed one of my Qt4 projects and am looking to deployment options. I do not want to have to install Qt4SDK on every system that this application goes on. From my research I have found building the application statically would be the way to go.
I have read http://doc.qt.nokia.com/latest/deployment-x11.html#application-dependencies and got no where. I can see which dependencies that I require when I do the ldd command.
This is my output:
linux-gate.so.1 => (0x00bd6000)
libQtGui.so.4 => /home/user/QtSDK/Desktop/Qt/473/gcc/lib/libQtGui.so.4 (0x00d87000)
libQtCore.so.4 => /home/user/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4 (0x00753000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x00110000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0024a000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00c58000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00af9000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x003f4000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00129000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x0012f000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00138000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00aba000)
libz.so.1 => /lib/libz.so.1 (0x00202000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00340000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x0054e000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00217000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00220000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00239000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x003b6000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x0058d000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x0059d000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00243000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00a63000)
libuuid.so.1 => /lib/libuuid.so.1 (0x003e6000)
libexpat.so.1 => /lib/libexpat.so.1 (0x006ba000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x006e1000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x003eb000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00b66000)
Now I am not sure what to do to add them statically to my project...
I am using Qt4 and the QtDesigner on Linux...
lgeyer last edited by
- You do not need to install the Qt SDK on every target machine, just the Qt libraries. Most probably they are already installed.
- You will have to build a static set of the Qt libraries (tons of threads on how to in these forums and the web), then link these libraries statically against your application.
- Linking against a static version of the Qt libraries usually qualifies for a commercial license, unless the project is released under the terms of the LGPL or GPL as well.
goetz last edited by
The most comfortable way for Linux users is to provide a package for the major distributions, most notably a .deb or .rpm. Once you have set up the correct dependencies, the package managers should pull in the required libs. You might want to look at an existing package to cheat some details :-)
As an alternative for the distributions that you do not provide a package for, you can setup a directory, including your executable, the libs necessary to run it, and maybe some additional data. In order to start the app, I would provide a short shell script then that sets up some environment variables (like LD_LIBRARY_PATH).
vezprog last edited by
Thank you for the post. I have tried to create a .deb before it is was kind of over my head...
So when I build my Qt4 App, it creates a folder (if in debug version) or likewise adds an executable to my current project directory. I can go in that project and open the executable and my application opens.
Will this be the same when I bring it to another linux machine without the Qt4 SDK installed on it?
The .deb would make that automated, yet I couldn't figure it out so that is out of the question right now.
goetz last edited by
No. On another machine you need to have the Qt 4 libs available, either by providing it yourself or by using a preinstalled version of the system.
For a .deb or a .rpm, you usually will not pack the Qt libs into the installer but set a dependency, so that another package will be installed automatically ifs contents are missing.