QtCore.dll missing error after build static app



  • Hi everyone.
    I've successfully built static qt based on Document and WiKi
    With these options :

    configure -release -opensource -static -platform win32-msvc2013
    -qt-sql-odbc -confirm-license -nomake examples -nomake tests -qt-zlib
    
    nmake
    nmake install
    

    Now i have a 5GB Qt directory called D:\Qt5.7 and also have qt in my environment.

    After trying to build my project using this command :

    qmake -config release App.pro
    nmake
    

    I get log :

    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /debug /opt:ref
    /INCREMENTAL:NO /Debug /SUBSYSTEM:WINDOWS
    "/MANIFESTDEPENDENCY:type='win32'
    name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
    publicKeyToken='6595b64144ccf1df' language=''
    processorArchitecture='
    '" /MANIFEST:embed /OUT:release\App.exe
    @C:\Users<user>\AppData\Local\Temp\nm5AE9.tmp

    Now i have a 15MB executable App.exe witch throw error after running :

    enter image description here

    I'm using Visual Studio 2013(nmake) + windows10 + Qt5.7 and .pro is this :

    TARGET       = App
    TEMPLATE     = app
    QT          += core gui widgets sql network printsupport
    CONFIG      += static
    LIBS        += -L$$PWD/quazip/lib -lquazip
    INCLUDEPATH += .
    RESOURCES   += app.qrc
    include($$PWD/breakpad/crash_handler.pri)
    
    QMAKE_CFLAGS_RELEASE +=/Zi
    QMAKE_LFLAGS_RELEASE +=/debug /opt:ref
    QMAKE_LFLAGS_RELEASE +=/INCREMENTAL:NO /Debug
    
    SOURCES += main.cpp\
        .
        .
        .
    
    HEADERS  += \
       .
       .
       .
    

    Dependency walker result :

    enter image description here

    What is the wrong ?


  • Moderators

    @IMAN4K

    The docs for CONFIG say:
    static The target is a static library (lib only). The proper compiler flags will automatically be added to the project.

    Therefore, I guess you are still linking with the lib stubs for dlls. Make sure that you are using the qmake generated with the static lib compilation.



  • @koahnig

    Make sure that you are using the qmake generated with the static lib compilation

    Yes i'm sure because while i have another qt installation (in another path) but just static bin path is in environment variable so i'm using qmake from D:\Qt5.7\qtbase\bin



  • Could anyone help me please :(


  • Qt Champions 2016

    Hi
    You can try to use it as a kit
    https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW#Using_the_Qt_static_environment

    "Using the Qt static environment with Qt Creator"

    Also I had to edit
    C:\Qt\Qt5_static\mkspecs\win32-g++\
    (for mingw)
    To make it use static.

    I build static 5.7 following this guide
    http://dimitris.apeiro.gr/2015/06/24/build-a-static-qt5-for-windows-by-compiling/



  • Thanks @mrjj .
    The Problem was the Quazip that was linking to dynamic Qt libs witch Dependency walker won't show up at run time.

    First i should build it as static like so :

    TEMPLATE = lib
    CONFIG += qt warn_on
    QT -= gui
    DEFINES += QUAZIP_BUILD
    CONFIG += staticlib
    CONFIG(staticlib): DEFINES += QUAZIP_STATIC
    include(quazip.pri)
    

    Then i should link that in my .pro :

    .
    .
    .
    LIBS += -L$$PWD/quazip/ -lquazip
    INCLUDEPATH += $$PWD/quazip
    PRE_TARGETDEPS += $$PWD/quazip/quazip.lib
    DEFINES += QUAZIP_STATIC
    .
    .
    .
    


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