Results 1 to 8 of 8

Thread: Deploying a Qt application

  1. #1
    Join Date
    Oct 2012
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Deploying a Qt application

    Hi everyone,

    Total newbie to Qt here ;) Also, actually, to software development in general. I am a young mathematician who has just completed writing his first "scientific" program using Qt. I hope you'll forgive me if my questions sound silly (and I am aware that this has been asked several times, and that there's documentation on this).

    I've designed this program using Qt Creator 2.5.0 (based on Qt 4.8.1 64 bits) on my PC under Linux (Ubuntu 12.04 64 bits). It works very well, but trying to figure out how to deploy the app for the past couple days has been a rude awakening. I didn't expect I'd be so lost and nowhere at this point.

    So, my project is not very sophisticated, it consists of approximantely 40 headers and 40 sources, a qrc containing a few png and html files, and I'm using a bunch of Qt classes which I guess are the most classical ones. Now I'd like to make this available in the simplest possible way for Linux, Mac and Windows users (mostly fellow mathematicians I guess, but those can ignore the first thing about computers). I'm tempted to give it up and ask people to install qt and compile my files, but I hope i change my mind.

    So, this is where I'm at now, please correct me if needed:
    -For Linux users, I should probably compile my program using static linking (?)
    Problem1: see afer.
    Q1: I guess I want to compile two versions, 32 and 64 bits? How well are they going to work on different distributions?
    Q2: Sould I make a deb file or something?

    -For Windows users,
    Problem2: I've tried to cross-compile the app for windows from my PC using wine and mingw32, following every tuto I could find on the web, but I never got it to work; there always seemed to be an error with the qmake.conf file or something. I've come to the conclusion that even though I don't have a PC with Windows on it, I should just find one (I guess I would need one anyway to test the app) and compile my source there.
    Q3: Suppose I manage to do that. Will my exe file work on all Windows computers?
    Q4: Should I try to create an installer (is it going to drive me crazy as well)?

    -For Mac users,
    Q5: I guess it's gonna be pretty much the same as for Linux case? (the advantage is, I do have a Mac at home).


    Okay, now here's my specific problem when I tried to build my project statically. First here's what I did:
    1. I downloaded the Qt4.8.3 sources and built them statically (strangely, the compiler(s) don't seem to care that I told them -prefix <some folder> (in the ./configure code line), it just compiled everything in the sources folder apparently (I can tell you what I did in more details if necessary).
    2. I changed the options in Qt creator to compile using the static version of Qt. I get a warning telling me "qmlviewer not installed" (don't know if that matters).
    3. Because I pretty much mixed different tutos read here and there, I tried to add "CONFIG+=STATIC" in the pro file, or adding some LIBS there, or... but that didn't seem to affect the result at all.
    What I get is a file that seemed to work at first: It was 15Mb instead of 1Mb previously, it no longer required the two Qt dependencies that it used to (checked that with ldd command line), and the program worked... apparently. First i notices in Qt Creator's Application output that I kept getting Qt errors: "Gtk-CRITICAL **: IA__gtk_widget_style_get: assertion `GTK_IS_WIDGET (widget)' failed". Mmm... doesn't sound too good. Even worse, everything seems to work except my help menu that doesn't manage to show itself and makes the program pretty much freeze. And the output shows:
    X Error: BadDrawable (invalid Pixmap or Window parameter) 9
    Major opcode: 62 (X_CopyArea)
    Resource id: 0x0
    and sometimes QNativeImage: Unable to attach to shared memory segment. If you need to know, the help menu is a simple widget containing a QTextBrowser (and a couple buttons) that shows an html file with some png images.

    I'd really appreciate some help here, feeling a bit alone in the dark! Thanks in advance,

    Seub

    PS: I wouldn't mind giving you my sources if you want to try something, but the zip file is 750kb and the max here seems to be 244kb
    Last edited by seub; 11th October 2012 at 05:33. Reason: add attachment

  2. The following user says thank you to seub for this useful post:


  3. #2
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Deploying a Qt application

    Try following these::

    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.

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,690
    Thanks
    13
    Thanked 1,599 Times in 1,527 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Deploying a Qt application

    Quote Originally Posted by seub View Post
    So, this is where I'm at now, please correct me if needed:
    -For Linux users, I should probably compile my program using static linking (?)
    Problem1: see afer.
    Q1: I guess I want to compile two versions, 32 and 64 bits? How well are they going to work on different distributions?
    Q2: Sould I make a deb file or something?
    No, I'd use shared Qt and either ship the libraries with your binary or rely on the end-user to install Qt libraries. The deployment page explains how to launch your application form a shell script so that the libraries are found. You can wrap it in one of the common Linux deployment package or just ship a gzipped tar file that just needs to be extracted.

    Most 64-bit Linux installs are capable of running a 32-bit app, so I would try that first.

    -For Windows users,
    Problem2: I've tried to cross-compile the app for windows from my PC using wine and mingw32, following every tuto I could find on the web, but I never got it to work; there always seemed to be an error with the qmake.conf file or something. I've come to the conclusion that even though I don't have a PC with Windows on it, I should just find one (I guess I would need one anyway to test the app) and compile my source there.
    Q3: Suppose I manage to do that. Will my exe file work on all Windows computers?
    Yes, XP up. If you build a 32-bit app it will run on either 32- or 64-bit systems. You can develop in a virtual machine if that is easier.
    Q4: Should I try to create an installer (is it going to drive me crazy as well)?
    Yes, this would normally be expected by Windows users, but you can do a zip bundle that just needs to be unzipped. The layout of a Windows deployment is covered many, many times in this forum.

    -For Mac users,
    Q5: I guess it's gonna be pretty much the same as for Linux case? (the advantage is, I do have a Mac at home).
    You would normally build an App bundle. I cannot really help here, having never done it in anger.

  5. #4
    Join Date
    Sep 2013
    Posts
    17
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Deploying a Qt application

    Following above discussions....I tried shared library approach.
    I am working on windows XP, using Qt 4.8.5, wince SDK 5.0, Visual Studio 2008.
    I followed this link:
    http://doc.qt.digia.com/4.7/deployment-windows.html and
    configured my Qt with this command :
    configure -shared -platform win32-msvc2008 -xplatform wincewm50pocket-msvc2008
    Then ran command showed on prompt of Visual Studio 2008.
    Everything went without error.

    Then as described in above link, i tried to build 'plugandpaint' example. I built without errors but no file named 'pnp_basictools.dll' was created.
    Then I used dependency walker for 'plugpaint.exe'. It shows QTGUI4.DLL, QTCORE4.DLL and COREDLL.DLL are not found. I found QTGUI4.DLL and QTCORE.DLL but not the COREDLL.DLL on my computer. I googled for this file and came to know that it is one of the wince core files similar to user32.dll.
    I have wince5 sdk installed on my computer but no 'COREDLL.DLL'....how is this?
    How to solve this problem?
    What I am doing wrong?

  6. #5
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Deploying a Qt application

    I downloaded an older version.
    worked fine.

  7. #6
    Join Date
    Sep 2013
    Posts
    17
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Deploying a Qt application

    Hey thanks for reply...
    U mean older version of visual studio???

  8. #7
    Join Date
    Sep 2013
    Posts
    44
    Thanks
    9
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Deploying a Qt application

    I meant older version of Qt.
    I use 4.8
    why do you need that ?
    I used this.
    mingw32-make
    (this was after configuring)
    you need your environment variables set from the control panel.
    then use (this is what I have used)
    configure -platform win32-g++ -release -static -no-exceptions
    ||||||
    (it should show lots of 'doing stuff')
    then use
    mingw32-make

  9. #8
    Join Date
    Sep 2013
    Posts
    17
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Deploying a Qt application

    Well thanks for your advice.
    As I said I followed this link to install Qt for wince.

    http://qt-project.org/doc/qt-4.8/install-wince.html

    I found these links yesterday :
    http://www.formortals.com/build-qt-s...-gcc-compiler/
    http://www.formortals.com/how-to-statically-link-qt-4/

    So I guess I have to build Qt statically. Well I am confused now. Please tell me if I am doing something wrong?
    I would appreciate any advice that will point me in right direction.

Similar Threads

  1. Deploying an application on a different PC
    By adyb in forum Installation and Deployment
    Replies: 2
    Last Post: 25th July 2011, 15:53
  2. Deploying qt application under mac osx
    By lechoo in forum Installation and Deployment
    Replies: 0
    Last Post: 24th September 2010, 16:56
  3. Deploying Qt application on Mac OS X
    By mourad in forum Installation and Deployment
    Replies: 1
    Last Post: 30th March 2008, 17:19
  4. Deploying Qt 4.2 Application on Mac 10.3.5?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 0
    Last Post: 11th May 2007, 12:33
  5. Deploying Qt Application on Mac?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 2
    Last Post: 30th March 2007, 10:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.