Compiling standalone Qt application using MinGW

amethystAnt

I am trying to build a standalone Qt app without any DLLs needed. I recompiled Qt 5.4.1 statically. When I compile and run an application, it doesn't require any Qt DLLs, but it requires libgcc_s_dw2-1.dll instead. I have also edited my mkspecs before configuring and building Qt, I edited these values:

QMAKE_CFLAGS            = -pipe -fno-keep-inline-dllexport -static -static-libgcc
QMAKE_CXXFLAGS          = -pipe -fno-keep-inline-dllexport -static -static-libgcc -static-libstdc++

(added -static -static-libstdc++ and -static-libgcc)

I also added a QMAKESPECS environment variable. When I build something using Qt, I can always see this options in the output, so I am sure that the mkspecs are applying. When I build a non-Qt program with these options (-static -static-libgcc -static-libstdc++), it doesn't need any DLLs when I run it.

Can somebody help me? I use Qt 5.4.1 and MinGW-w64 4.9.2

amethystAnt

I solved my problem now. The problem was that although I edited the variable QMAKE_CXXFLAGS, it was still linking the standard libraries dynamically when linking the application itself, because it doesn't use this variable in the final step of the compilation. I only edited the mkspecs again and added the -static option to the variable QMAKE_LIBS and it works now, I have a standalone Qt application.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Building standalone application with Cython + MinGW

From Dev

Building standalone application with Cython + MinGW

From Dev

Compiling a Qt Application using Dev C++ on Windows

From Dev

Using mongodb in standalone application

From Dev

Compiling Qt5 hello world .cpp file under Windows using MinGW-w64 gives "undefined reference" error

From Dev

Compiling Qt statically on Windows XP and MinGW fail. Is it possible to achieve?

From Dev

Making static Build(standalone application) with Qt

From Dev

How to create manifest file for Qt standalone application

From Dev

Making static Build(standalone application) with Qt

From Dev

Making Standalone application from Qt project

From Dev

QGIS with standalone C++ application in Qt Creator

From Dev

Application segmentation fault, only when compiling on Windows with MinGW

From Dev

Qt Creator using MinGW compiler with CMake

From Dev

Can't link in libnanomsg for Windows MinGW, cross compiling using MXE

From Dev

Using Jetty's proxy in standalone Jetty application

From Dev

Using mailto in a standalone|fullscreen web application on iPhone

From Dev

Using mailto in a standalone|fullscreen web application on iPhone

From Dev

Using Chrome to open a web page as a standalone "application"?

From Dev

Using Jetty's proxy in standalone Jetty application

From Dev

AttributeError when using DAL and Auth in standalone application

From Dev

Freetype not compiling on windows with MinGW

From Dev

MinGW compiling excessively slow

From Dev

compiling armadillo with Rtools/MinGW

From Dev

MinGW compiling wrong

From Dev

compiling armadillo with Rtools/MinGW

From Dev

Compiling libvorbis with MinGW

From Dev

MinGW compiling wrong

From Dev

Compiling for windows on cygwin/mingw

From Dev

Error: QOpenGLShader: could not create shader - when compiling QtQuick applications with Qt5.2 Mingw OpenGL

Related Related

  1. 1

    Building standalone application with Cython + MinGW

  2. 2

    Building standalone application with Cython + MinGW

  3. 3

    Compiling a Qt Application using Dev C++ on Windows

  4. 4

    Using mongodb in standalone application

  5. 5

    Compiling Qt5 hello world .cpp file under Windows using MinGW-w64 gives "undefined reference" error

  6. 6

    Compiling Qt statically on Windows XP and MinGW fail. Is it possible to achieve?

  7. 7

    Making static Build(standalone application) with Qt

  8. 8

    How to create manifest file for Qt standalone application

  9. 9

    Making static Build(standalone application) with Qt

  10. 10

    Making Standalone application from Qt project

  11. 11

    QGIS with standalone C++ application in Qt Creator

  12. 12

    Application segmentation fault, only when compiling on Windows with MinGW

  13. 13

    Qt Creator using MinGW compiler with CMake

  14. 14

    Can't link in libnanomsg for Windows MinGW, cross compiling using MXE

  15. 15

    Using Jetty's proxy in standalone Jetty application

  16. 16

    Using mailto in a standalone|fullscreen web application on iPhone

  17. 17

    Using mailto in a standalone|fullscreen web application on iPhone

  18. 18

    Using Chrome to open a web page as a standalone "application"?

  19. 19

    Using Jetty's proxy in standalone Jetty application

  20. 20

    AttributeError when using DAL and Auth in standalone application

  21. 21

    Freetype not compiling on windows with MinGW

  22. 22

    MinGW compiling excessively slow

  23. 23

    compiling armadillo with Rtools/MinGW

  24. 24

    MinGW compiling wrong

  25. 25

    compiling armadillo with Rtools/MinGW

  26. 26

    Compiling libvorbis with MinGW

  27. 27

    MinGW compiling wrong

  28. 28

    Compiling for windows on cygwin/mingw

  29. 29

    Error: QOpenGLShader: could not create shader - when compiling QtQuick applications with Qt5.2 Mingw OpenGL

HotTag

Archive