Qt4 - Dlls notwendig?



  • Darf man mal Fragen, wie ich die Libs statisch dazu linken kann?

    Ich habe jetzt Qt mit -static configuriert, da ich nicht wusste was das -shared macht. Waere nett, wenn mich da auch jmd aufklaeren koennte.



  • Mal was anderes:

    Weiß überhaupt irgendjemand, dass man die QT Bibliotheken statisch linken kann? Also so, dass keine dlls mehr benötigt werden.

    Und dann: Weiß jemand auch wie es funktioniert?



  • hab in irgendeinem forum gelesen, dass qt 4.0 einen bug hat, der das statische linken unter windows verhindert (und mir ist es auch nie gelungen, qt mit -static zu bauen) - man kann nur hoffen, dass das problem in 4.1 behoben sein wird. vorgesehen ist es ja offenbar - wozu sonst wäre diese option da..



  • Qt lässt sich nicht statisch übersetzen.
    Und du musst erst Qt neu compilieren und danach dein Proggi.
    Funkt aber nicht.
    Soweit ich informiert bin, geht das in der gekauften Version, bin aber nicht sicher.



  • Buggykite schrieb:

    Qt lässt sich nicht statisch übersetzen.
    Und du musst erst Qt neu compilieren und danach dein Proggi.
    Funkt aber nicht.
    Soweit ich informiert bin, geht das in der gekauften Version, bin aber nicht sicher.

    Und soweit ich informiert bin, geht es auch da nicht.



  • Hat es jetzt schonmal jemand unter Windows mit der 4.1er Version versucht? camper meinte ja, das dieser "Bug" evtl behoben sein koennte. Unter Linux funktioniert es ja einwandfrei mit der OS Version (schon mit der 4.0.0).

    Aber denoch Fragen:

    1. Was muss ich tun, damit ich die exe auch auf anderen Win Kisten ohne Qt ausfuehren kann? Also gibt es da noch eine andere Moeglichkeit?

    2. Unter Linux ist ein kleine HelloWorld Anwendung statisch kompiliert rund 60MG gross. Dies kann ich mH von strip und upx auf 1,5MB druecken. Gibt es da aehnliche Tools fuer Win?

    Gruss und Danke



  • 1. Was ist so schlimm daran, ein paar DLLs mitzugeben?

    2. Nachdem die Debug-Info soundso in einer eigenen Datei liegt, braucht man das nicht.



  • Es geht einfach darum, dass eine einzelne exe handlicher ist. Und ausserdem sind die dlls recht groß.

    UPX gibt es auch für Windows.



  • Woohoo, ich glaube, ich habe was gefunden!

    http://lists.trolltech.com/qt-interest/2005-09/msg01080.html

    The installer package you mentioned still allows some configuration. Click
    on the "advanced" tab and you'll find a setting there to create a static
    library. However, note two things:

    1. Build the DLL version anyway... put designer.exe and it's required DLL's
    in a separate directory so that you can use designer as a stand alone app.
    The static build does not make designer (one of the few if only "bungles"
    that the Trolls have ever made IMO - please fix this guys if your reading
    this! Your plug-in architecture is nice and elegant and powerful... but
    believe it or not, some of us just want to make dialogs with it and that's
    all. There are also many advantages to static linking on Windows that some
    of us veterans still appreciate when we ship code).
    **
    2. Now build Qt statically. Even though Qt is built statically, it still
    links against the DLL version of the C Runtime (this is probably the missing
    DLL you are encountering on other systems). To turn this off, first you have
    to use the installer (or configure if you are using a snapshot - actually I
    prefer this way myself) to build a static Qt library... but don't let it
    finish building, it's just a waste of time. Once all the project files are
    built, stop the build process (if on command line, just don't run nmake). In
    the Qt installation directory you'll find a visual studio project
    "projects.sln". Load this into Visual Studio. Select all the projects
    simultaneously in the Solution Explorer and select "properties" from the
    context menu. Expand C/C++ folder. Select Code Generation. Change "Runtime
    library" form Multi-threaded DLL to Multi-threaded (be sure and do similar
    for debug build, "Multi-threaded debug"). Now do a batch build and have
    yourself a little lunch break. When you come back, Qt and all it's samples
    will be linked to a static version of Qt, AND a static version of the
    C-runtime.
    **
    There are some tools in the Windows SDK that will allow you to check an .exe
    to see what DLL's are required. My favorite is dumpbin.exe, it runs on the
    command line and you can get a list of all imports and exports as well. Be
    careful that you don't bring in some library that itself links to the DLL
    runtime... if you do, you must be extra careful (in addition to distributing
    the DLL's anyway!) that any memory allocated by that version of the run-time
    is freed by that version as well... this is too much trouble for beginners,
    both to explain and enforce 😉 Best to either commit to all static, or go
    DLL anyway.

    Good luck!

    Richard
    *



  • Bin gerad durch Zufall hier gelandet und schließ mich gleich mal an. Ich will ebenfalls eine Applikation erstellen die ich "aus der Hand" geben kann, ohne das jemand die qt-dll's benötigt. Hab dann heute versucht die qt-src von 4.2.3 inkl. Patch für Visual Studio mit -static zu konfigureiren, aber beim nmake bricht er irgendwann ab, für mich ohne erkennbare Fehlermeldung. Vieleicht kennt sich ja jemand genauer mit dem Kram aus und kann Hilfestellung leisten...



  • Ich hielt es eigentlich bisher für völlig selbstverständlich, dass man ein Programm entwickeln und dann ohne die dlls weitergeben kann - zumal die Falle von Qt ja über 200MB groß sind. Und die möchte man dann doch nicht weiterreichen, wenn das eigene Programm nur 54kb groß ist.

    Was kann man also tun, damit es läuft? Gar nichts? Ist Qt in diesem, meiner Meinung nach recht häufig auftretenden Fall, nutzlos?



  • Wenn man die Qt-Bibliothek nutzt muss dessen Code ja irgenwo bleiben, so dass die eigene Applikation diesen nutzen kann.
    Am einfachsten ist dynamisches Linken, d.h. man muss neben der eigenen EXE auch die Qt-DLLs weitergeben. Man muss aber nur die DLLs weitergeben, die man auch nutzt:
    qtcore4.dll auf jeden fall
    qtgui4.dll wenn man GUI nutzt (nicht bei Konsolenprogramm)
    Die anderen nur wenn man diese nutzt (siehe in Projektdatei xxx.pro)
    z.B.
    QT += sql \
    xml
    also muss hier noch die qtsql4.ddl und die qtxml4.dll hinzu.
    Aber nur die Release-Varianten und nicht die Debug (die enden mit d, also mit xxxd4.dll).
    Core und Gui sind zusammen 13 MB, mit 7zip gepackt 4,3 MB bei MinGW und mit Visual-Studio-Compiler werden sie noch kleiner.

    Ohne DLLs ist nur mit statischem Linken möglich, dabei wird der Qt-Code mit in die eigene EXE gepackt (diese wird dann größer).
    Wenn du dein Programm unter GPL-Lizenz stellst oder eine kommerzielle Qt-Lizenz hast ist das kein Problem. Mit der neuen LGPL-Lizenz ab Qt 4.5 ist nur dynamisches Linken ohne Veröffentlchung des eigenen Codes erlaubt.


Anmelden zum Antworten