PDA

View Full Version : Deploying Qt application on Linux Ubantu OS



arunkumaraymuo1
10th December 2012, 04:44
Hi,
I am developing a Qt application for Linux Ubuntu OS using Qt creator. Now I need to deploy this on my client machine. My client system is not having any Qt framework installed. I need to include the necessary Qt libraries with my application. I used dynamic linking method for including Qt library.

How I can possible to make my application working without Installing the Qt framework from the Internet. I need to make this like windows Qt deployment(Including dependency dll files with the application).

(Simply I need to copy paste the necessary dependency files from development machine to client system)

Is it possible to make such a deployment in Linux(Ubuntu) OS and How I can do this ?


Many Thanks.....................

ChrisW67
10th December 2012, 06:08
Yes it is possible. You start by reading the Deploying an Application on X11 Platforms documentation.

Gokulnathvc
11th December 2012, 13:30
Try with static building:

1. Install QtSDK (2009.05)

2. Open your mkspecswin32-g++qmake.conf file (located in C:\Qt\2009.05\qt\mkspecs\win32-g++\qmake.conf) in an editor like notepad.

3. Find the line that starts with "QMAKE_LFLAGS = -enable-stdcall-fixup..." and ddd the phrase "-static" (without quotes) after the "=" sign and before the "-enable..." phrase, so it looks like:
QMAKE_LFLAGS = -static -enable-stdcall...

4. Save and close this file.

5. Set your environment variables. Right-click Computer >> Properties >> Advanced System Settings >> Click the "Environment Variables..." button.

6. Under "User variables," make sure QTDIR is set to your Qt path (C:\Qt\2009.05\qt). Make sure QMAKESPEC is set to win32-g++.

7. Under "System variables," edit the one called "Path." Add a semicolon ( ; ) to the end, and add the following:
C:\Qt\2009.05\mingw\lib;C:\Qt\2009.05\mingw\bin;C: \Qt\2009.05\qt\bin

8. When finished, relog or reboot.

9. Open a command prompt.

10. Change to your Qt directory by entering: cd C:\Qt\2009.05\qt

11. Enter the following: configure -static -no-phonon -no-phonon-backend -release -no-exceptions

12. When it asks which edition you want to use, enter "o" for open source.

13. When it asks you to accept the terms of the license, enter "y" for yes. This will take around maybe 10 minutes to complete.

14. When that finishes, enter the following: mingw32-make sub-src (or) nmake sub-src

15. Go out to dinner, this will take a while (took between 1-2 hours for me).

16. When this finishes, open your project in the Qt Creator.

17. Double-click the project (.pro) file to open it in edit mode.

18. Add the following line: CONFIG += static

19. qmake Hello.pro
nmake release (or) mingw32-make release

20. Navigate to your release directory and voila! Your standalone executable should be there.

ChrisW67
11th December 2012, 20:51
The OP was not asking for a static executable... they specifically said they had a dynamically linked Qt executable. The solution to that problem is a simple wrapper script (provided in the docs I linked), not to throw the whole thing away and start again.

There's a documented method for building a static Qt library, it doesn't involve hacking the files in mkspecs, and it still only partly addresses the desire for a single executable. This is not a slam-dunk solution to the OP's request, even if they had asked for it.

cqubed
12th December 2012, 02:24
Follow the attached instructions found at this URL.

http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/

You will end up with a debian package that will install under Ubuntu and install the required additional packages.

anda_skoa
12th December 2012, 19:00
The OP was not asking for a static executable... they specifically said they had a dynamically linked Qt executable. The solution to that problem is a simple wrapper script (provided in the docs I linked), not to throw the whole thing away and start again.

Indeed!

Not even mentioning all the hassle one has with statically linking Qt, like losing support for plugins, etc.

Cheers,
_

arunkumaraymuo1
13th December 2012, 04:33
But I dont have any license to use the static build of Qt

Gokulnathvc
13th December 2012, 11:16
Dont use commercial license. Just use the free license.

amleto
13th December 2012, 19:41
But I dont have any license to use the static build of Qt

1) You don't need a commercial license to distribute a statically linked Qt app.
2) For the hassle involved of meeting the actual license when distributing a statically linked Qt app, you will wish you persevered with shared library deployment.

anda_skoa
15th December 2012, 17:31
But I dont have any license to use the static build of Qt

Non-issue, since you don't want to statically link anyway.

Cheers,
_