How to build with static link using qt 4.7.4 for desktop based exe



  • Hi All,
    I am using QtSDK 4.7.4 and want to compile the opensource Qt installer latest version for windows desktop.
    May I know how to build it with static link so that the o/p installer.exe will be a single exe.
    earlier static build was possible once you will build the qt using "configure.exe -static Other options"
    Is it possible any more? or do i need to do any changes to my .pro file.

    My .pro file looks as below

    TEMPLATE=subdirs
    CONFIG += ordered
    SUBDIRS += installerbuilder examples tools

    test.target=test
    test.commands=(cd installerbuilder && $(MAKE) test)
    test.depends = $(TARGET)
    QMAKE_EXTRA_TARGETS += test

    Thanks in advance.

    Regards,
    Pradeep



  • You must build again using -static in configure.exe. I don't use +static in .pro because is useless if you don't have static build of Qt. I think releasing static built apps without license is illegal. Read Qt license agreament or something.


  • Moderators

    I guess you like to compile Qt 4.7.4 for obtaining static libs. The QtSDK has version 1.1.4 at the moment.

    When you have done the compilation of the static libs you use the new lib path for your linking. That should be all you have to do.



  • but there is no configure.exe exists in C:\QtSDK\Desktop\Qt\4.7.4\msvc2008..
    how to compile for static ???







  • Do not(!) recompile Qt out of the sources bundled with the SDK or any other prebuilt package. This will both wreck your current installation and you won't be able to compile your new version.

    Grab yourself the "vanilla sources":http://qt.nokia.com/downloads/downloads#qt-lib instead.



  • i have installed "Qt libraries 4.8.0 for Windows (VS 2008, 273 MB)" since i have VS 2008.
    then could able to configure for static with command
    "configure -static -fast -release -confirm-license -opensource -platform win32-msvc2008"
    then successfully gave "nmake"

    From Qt creator added the qmake.exe from qt4.8 and when i tried to compile qt 4.7.4 installer source code getting the below error :

    installer.lib(init.obj):-1: error: LNK2019: unresolved external symbol "class QObject * __cdecl qt_plugin_instance_qsqlite(void)" (?qt_plugin_instance_qsqlite@@YAPAVQObject@@XZ) referenced in function "public: __thiscall void __cdecl initResources(void)'::6'::StaticqsqlitePluginInstance::StaticqsqlitePluginInstance(void)" (??0StaticqsqlitePluginInstance@?5??initResources@@YAXXZ@QAE@XZ)

    But i am able to compile qt 4.7.1 version of installer source code.

    /Pradeep


  • Moderators

    Please see this:

    [quote author="Volker" date="1326454385"]Do not(!) recompile Qt out of the sources bundled with the SDK or any other prebuilt package. This will both wreck your current installation and you won't be able to compile your new version.

    Grab yourself the "vanilla sources":http://qt.nokia.com/downloads/downloads#qt-lib instead.[/quote]

    You must not use the sources delivered with the prebuilt.



  • I am not getting your points.

    just i want to compile the latest QT installer source code for our product and want to link it statically.
    I tried to compile the source using qt 4.7.4 sdk and could not compile it statically as there is no configure.exe..

    so as suggested by Volker i have installed Qt 4.8.0 pkg for VS 2008 and configured for static. Then used the same qmake.exe to compile the opensource installer code but its failing with some linking errors.

    FYI : i could able to compile the old version of installer source code using the same qmake.exe
    could you please suggest me how i can compile them statically.
    /Pradeep


  • Moderators

    Did you download the sources you like to compile separately?
    The sources as delivered with the SDK and/or the prebuilt you cannot compile. If you like to build a static version you need to download the source from the link supplied by Volker. If you like to build under windows you need to use the zip-file.



  • [quote author="pradeep.symbian" date="1326881439"]
    so as suggested by Volker i have installed Qt 4.8.0 pkg for VS 2008 and configured for static. Then used the same qmake.exe to compile the opensource installer code but its failing with some linking errors.[/quote]

    NO, I did not suggest this. I told you you to download the vanilla sources and not to recompile Qt out of the sources bundled with the SDK or any other prebuilt package.



  • @Volker: where is the Vanilla sources ?
    i downloaded the pre compiled version of qt 4.8.0 from http://qt.nokia.com/downloads/downloads#qt-lib

    Plz give me a link from where i can download.



  • [quote author="Pradeep Biswal" date="1326885211"]@Volker: where is the Vanilla sources ?
    i downloaded the pre compiled version of qt 4.8.0 from http://qt.nokia.com/downloads/downloads#qt-lib

    Plz give me a link from where i can download.

    [/quote]

    Search for "source" on that page....

    bq. Here is the latest version of the Qt libraries. The edition you download here must match the OS you have your development system on.
    The source code is available as a zip (261 MB) or a tar.gz (228 MB). Or visit the repository at qt.gitorious.org/qt.



  • I have downloaded the source as qt-everywhere-opensource-src-4.8.0.zip and configured for static.

    Now while building its giving me error as

    LINK : fatal error LNK1181: cannot open input file 'qsqlite.lib'

    and i searched and could not found the qsqlite.lib or dll in that dir.

    where as in installed other qtsdk say qtsdk 4.7.4 has sqlite libs as C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\plugins\sqldrivers\qsqlite4.lib and dll.

    how to resolve this linking error?



  • to resolve the above error i am following the below link.. let's see if it resolves the error

    http://developer.qt.nokia.com/doc/qt-4.8/sql-driver.html#qsqlite



  • it did not solve the problem. still i am getting the same error as

    link /LIBPATH:"c:\Qt\src\qt-everywhere-opensource-src-4.8.0\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /MANIFEST /MANIFESTFILE:".obj\installer.intermediate.manifest" /OUT:..\lib\installer.dll @C:\Users\prbiswal\AppData\Local\Temp\installer.dll.6264.62993.jom
    LINK : fatal error LNK1181: cannot open input file 'qsqlite.lib'

    Need your help to resolve this.



  • it did not solve the problem :

    its giving the same error as

    link /LIBPATH:"c:\Qt\src\qt-everywhere-opensource-src-4.8.0\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /MANIFEST /MANIFESTFILE:".obj\installer.intermediate.manifest" /OUT:..\lib\installer.dll @C:\Users\prbiswal\AppData\Local\Temp\installer.dll.6264.62993.jom
    LINK : fatal error LNK1181: cannot open input file 'qsqlite.lib'



  • Hi All,

    Issue is resolved :)

    I will share how this worked...

    1. downloaded the qt 4.7.4 source using "maintain qt sdk" tool (can be found from windows>>start>>qtsdk>>maintain qt sdk). This basically downloads the source package for diff releases from the repository.
    2. once update/download is successful then you can find the source code and some tools under %installed Qt SDK 4.7.4%\QtSources\4.7.4\ (for me its under C:\QtSDK\QtSources\4.7.4)
    3. Now for Qt static release build just follow http://qt.gitorious.org/qt-labs/installer-framework/blobs/master/README

    and it works. i could able to create the single exe.



  • And yes now need to link to the latest qmake.exe


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.