Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Deploying a C++ Qt Application to another Computer
QtWS25 Last Chance

Deploying a C++ Qt Application to another Computer

Scheduled Pinned Locked Moved General and Desktop
15 Posts 7 Posters 14.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MarcoG88
    wrote on last edited by
    #1

    Hi there,

    I'm new to Qt and currently switched from C# to C++ & Qt Programming.
    For learning and testing Qt i just wrote an Password Generator.
    I wanted to put the executable to another machine and run the exe file.
    Alot of messageboxes did appear and wanted alot off DLL Files.
    It did copy these files into the application directory. Now the Program runs.
    The .exe file has only a size of 789 kb. But with all the DLL Files, the hole directory
    is about 1,3 GB!!!! Just for an Password Generator!

    Is there anywhere an tutorial, how to find out which dlls are really necessary and
    how to put the application onto another machine. I mean, i dont want to
    put all these dll in every application i'm publishing, is there an smarter way like
    putting these files into an special directory and every qt application will use these
    dll files from this directory?

    Best Regards

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      To check the dependencies of a EXE-file you can use "Dependency Walker":http://www.dependencywalker.com/

      But in your case (1.3GB overall) ther went something wrong :)
      You should only need QtCore and QtGui dlls .. so your application shouldn't be larger than 20MB.
      Either you linked against unecessary libraries or you just copied too much unnecessary files.

      How does your PRO-File look like (if you use qmake for building)?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MarcoG88
        wrote on last edited by
        #3

        Dependency Walker is a great tip, thanks alot!
        Ok, i just deleted all dll files in the directory and let dependency walker run. It says i just need following dll files:

        • LIBGCC_S_SJLJ-1.dll
        • LIBSTDC++-6.DLL
        • QT5CORED.DLL
        • QT5GUID.DLL
        • QT5WIDGETSD.DLL

        Just copied these files in the exe dir and the size is now 336 MB (Still big, but much better than 1,3 GB xD).

        The exe does not run with only these dll files. When i want to start the executable i',m getting alot of errors like: icuin49.dll is missing. THere are much more dlls when i copy this one in the directory. At least the size will be 1,3 GB again when i copy all these files into the exe directory :-/

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MarcoG88
          wrote on last edited by
          #4

          Pro File looks like this:
          @#-------------------------------------------------

          Project created by QtCreator 2013-04-12T15:55:21

          #-------------------------------------------------

          QT += core gui

          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

          TARGET = PasswordGen
          TEMPLATE = app

          SOURCES += main.cpp
          mainwindow.cpp

          HEADERS += mainwindow.h

          FORMS += mainwindow.ui@

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            to get rid of the LIBGCC_S_SJLJ-1.dll you can add the following line to your pro-File:
            QMAKE_LFLAGS += -static-libgcc

            What are the other missing DLLs? I think your other computer is just missing some runtime libraries thats why your have to copy to many files.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MarcoG88
              wrote on last edited by
              #6

              The next files dependency walker shows me are:

              • icuin49.dll
              • icuuc49.dll
              • libglesv2d.dll
              • libwinpthread-1.dll
              • gpsvc.dll
              • ieshims.dll

              Thanks for your help so far! :)

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DerManu
                wrote on last edited by
                #7

                Have you tried using Qt 4.8 instead? Qt5 is only useful for writing QML apps for mobile devices, because nokia/digia have sacrificed alot for the cash they expect from that market. And what you're experiencing is just that. For example, by default even a normal desktop application now requires the OpenGL ES and WebGL libraries (ES stands for embedded systems) and DirectX HLSL compiler libraries. The hoops you have to jump through to use Qt5 are described "here":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html.
                Try Qt4.8, include QtGui.dll and QtCore.dll, and you'll be much happier.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goblincoding
                  wrote on last edited by
                  #8

                  DerManu, I really hope you are wrong, but I have this nasty suspicion that you aren't...and I've just upgraded all my working machines to Qt5.0.2...

                  http://www.goblincoding.com

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goblincoding
                    wrote on last edited by
                    #9

                    OK, so after my previous post, I panicked and ran to my Windows Qt machine...and noticed that there is a massive difference between the sizes of the release .dll's and the debug .dll's. For example, Qt5Cored.dll is ~75MB whereas Qt5Core.dll is (only) ~4MB.

                    @MarcoG88 - Judging from your post:

                    [quote author="MarcoG88" date="1365946879"]

                    • QT5CORED.DLL
                    • QT5GUID.DLL
                    • QT5WIDGETSD.DLL
                      [/quote]

                    I take it you compiled in debug (hence the xxxD.dll dependencies). If you compile in release, the dependencies will be the same (in the sense that you'll need Qt5CoreX, etc etc), but the size of the .dll's will be significantly reduced.

                    So although there are still a lot of dependencies and your distributable's size may still be larger than hoped or desired, it isn't quite as bleak as it seemed at first glance :)

                    http://www.goblincoding.com

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MarcoG88
                      wrote on last edited by
                      #10

                      Hi,

                      yes thats correct, this was the debug Version. Release Version is much smaller.
                      I also added these 2 DLL Files:

                      • libEGL
                      • libEGLD

                      now the application runs again. Don't know why dependency walker did not recognised that these dlls where missing.

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        goblincoding
                        wrote on last edited by
                        #11

                        DerManu, seems my preliminary optimism was misplaced. I can't even resolve all the new dependencies...on the verge of reverting back to 4.8.x.

                        http://www.goblincoding.com

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          hsrt
                          wrote on last edited by
                          #12

                          Hi,

                          I want to run my qt project on another computer. I read your posts but I am not success.I put dll files in same folder of exe. Should I do anyting?

                          1 Reply Last reply
                          0
                          • Q Offline
                            Q Offline
                            qxoz
                            wrote on last edited by
                            #13

                            Hi hsrt.
                            Welcome to DevNet.
                            Usually i'd recommend start new topic and not post questions into old threads. But your question is so popular that you can find answer, just by searching in forum :) .
                            Take a look to those great manuals:
                            "Deploying Qt Applications":http://qt-project.org/doc/qt-5/deployment.html
                            "Deploy_an_Application_on_Windows":http://qt-project.org/wiki/Deploy_an_Application_on_Windows

                            1 Reply Last reply
                            0
                            • H Offline
                              H Offline
                              hsrt
                              wrote on last edited by
                              #14

                              Hi qxoz,
                              I am newbie qt. This link says static build. Have to I do static link? I finished my project, I didn't create with static library my project.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                Hi,

                                No need to build statically (there's also licensing issues that you must first take a look at before releasing an application using a static Qt)

                                The second link of qxoz shows how to prepare the necessary dlls besides your application executable.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved