Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Fixing Static Building of Qt SDK 4.7.1 or later, under Windows
Qt 6.12 LTS is out! See what's new in the release blog

Fixing Static Building of Qt SDK 4.7.1 or later, under Windows

Scheduled Pinned Locked Moved General and Desktop
13 Posts 8 Posters 11.9k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    dialingo
    wrote on last edited by
    #2

    Can you provide a link to an official statemant about static linking not working? Inside the link you mentioned I can not see a statement like this.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cppdeveloper
      wrote on last edited by
      #3

      I tried it myself and it failed, for Qt SDK >= 4.7.1, under Windows 7.

      Qt SDK 4.7.0. builds OK.

      Has it worked for you?

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #4

        What exactly fails? Have you "filed a bug report":http://bugreports.qt.nokia.com/ ? If this is indeed a bug, then mentioning it in the forum will not get it fixed!

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #5

          I strongly recommend to build your static Qt libs not from the SDK but from the vanilla source tarball. You can download it from the resources link on DevNet.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dialingo
            wrote on last edited by
            #6

            bq. I strongly recommend to build your static Qt libs not from the SDK but from the vanilla source tarball.

            Be careful to take the .zip file and not the .tar.gz since you are running on windows. The versions differ only by line endings, but the configure script will complain in a cryptic way when you pick the wrong package.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cppdeveloper
              wrote on last edited by
              #7

              Thanks fellows, I will give the vanilla sources of Qt 4.7.3 a try. :-)

              1 Reply Last reply
              0
              • L Offline
                L Offline
                ludde
                wrote on last edited by
                #8

                I built a static 4.7.3 from the sources using VS2008 on a 64-bit Windows 7 machine without any problems. If you're using shadow building, it's probably a good idea to skip the examples, though (using the -nomake examples configure option). Shadow building is nice, because it lets you build all your different builds from the same source tree - and whenever a build fails, you can start it over again without having to unpack a fresh source tree again.

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cppdeveloper
                  wrote on last edited by
                  #9
                  1. I installed Qt SDK 4.7.3 to its default directory C:\QtSDK.

                  2. Extracted the vanilla sources of Qt Library 4.7.3 (http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.zip) to

                  C:\qt-everywhere-opensource-src-4.7.3

                  1. I ran the Qt Command Prompt (with "Run as Administrator" option),

                  and cded to C:\qt-everywhere-opensource-src-4.7.3

                  1. configure -static -release -platform win32-g++ -nomake examples

                  succeeded.

                  1. mingw32-make was building without problem for about 3 hours, when it failed with these messages:

                  g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
                  oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o ....\bin\qmlviewer.exe object
                  _script.qmlviewer.Release -L"c:\qt-everywhere-opensource-src-4.7.3\lib" -L"c:\q
                  t-everywhere-opensource-src-4.7.3\lib" -lmingw32 -lqtmain -lQtDeclarative -lQtOp
                  enGL -lQtScript -lQtSvg -lQtSql -lQtXmlPatterns -lglu32 -lopengl32 -lQtGui -lgdi
                  32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtNetwork -lQtCo
                  re -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qpaintengineex_opengl2.o
                  ):qpaintengineex_opengl2.cpp:(.text+0x11c0): undefined reference to _imp___Z16q t_imageForBrushib' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qpaintengine_opengl.o):q paintengine_opengl.cpp:(.text+0xacda): undefined reference to _imp___Z16qt_imag
                  eForBrushib'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qpixmapdata_gl.o):qpixma
                  pdata_gl.cpp:(.text+0xcd): undefined reference to _imp___Z14qt_defaultDpiXv' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qpixmapdata_gl.o):qpixma pdata_gl.cpp:(.text+0xe1): undefined reference to _imp___Z14qt_defaultDpiYv'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qpixmapdata_gl.o):qpixma
                  pdata_gl.cpp:(.text+0xfa): undefined reference to _imp___Z14qt_defaultDpiYv' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qpixmapdata_gl.o):qpixma pdata_gl.cpp:(.text+0x13a): undefined reference to _imp___Z14qt_defaultDpiXv'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixmapfilter.o):qglpi
                  xmapfilter.cpp:(.text+0x1842): undefined reference to _imp___Z13qt_halfScaledRK 6QImage' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixmapfilter.o):qglpi xmapfilter.cpp:(.text+0x1b3b): undefined reference to _imp___Z13qt_halfScaledRK
                  6QImage'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixmapfilter.o):qglpi
                  xmapfilter.cpp:(.text+0x1e19): undefined reference to _imp___Z12qt_blurImageR6Q Imagedbi' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixmapfilter.o):qglpi xmapfilter.cpp:(.text+0x26ff): undefined reference to _imp___Z12qt_blurImageR6Q
                  Imagedbi'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixmapfilter.o):qglpi
                  xmapfilter.cpp:(.text+0x2e1e): undefined reference to _imp___Z13qt_halfScaledRK 6QImage' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixmapfilter.o):qglpi xmapfilter.cpp:(.text+0x2efc): undefined reference to imp___Z17qt_memrotate90
                  glPKjiiiPji'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglframebufferobject.o):
                  qglframebufferobject.cpp:(.text+0x53f): undefined reference to _imp___Z14qt_def aultDpiXv' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglframebufferobject.o): qglframebufferobject.cpp:(.text+0x569): undefined reference to _imp___Z14qt_def
                  aultDpiYv'
                  c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixelbuffer.o):qglpix
                  elbuffer.cpp:(.text+0x20b): undefined reference to _imp___Z14qt_defaultDpiXv' c:\qt-everywhere-opensource-src-4.7.3\lib/libQtOpenGL.a(qglpixelbuffer.o):qglpix elbuffer.cpp:(.text+0x235): undefined reference to _imp___Z14qt_defaultDpiYv'
                  collect2: ld returned 1 exit status
                  mingw32-make[3]: *** [....\bin\qmlviewer.exe] Error 1
                  mingw32-make[3]: Leaving directory C:/qt-everywhere-opensource-src-4.7.3/tools/ qml' mingw32-make[2]: *** [release] Error 2 mingw32-make[2]: Leaving directory C:/qt-everywhere-opensource-src-4.7.3/tools/
                  qml'
                  mingw32-make[1]: *** [sub-qml-make_default-ordered] Error 2
                  mingw32-make[1]: Leaving directory `C:/qt-everywhere-opensource-src-4.7.3/tools'

                  mingw32-make: *** [sub-tools-make_default-ordered] Error 2

                  C:\qt-everywhere-opensource-src-4.7.3>

                  What am I doing wrong? Thank you a lot.

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

                    Hi,

                    There are some fixes for static building that didn't make it into the 4.7.3 release. The patches are used by mingw-cross-env, a project focused on cross building static static libraries.

                    The project is here http://mingw-cross-env.nongnu.org/.

                    If you just want the patches, they are here:
                    http://hg.savannah.gnu.org/hgweb/mingw-cross-env/file/1de8581a1adf/src/qt-1-cherrypicks.patch

                    Mark

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #11

                      Hi Mark,

                      I am having same issue as Ioannis Vranos, I am using QT SDK 3.7.3. How do I apply the patches you mentioned?

                      Thanks!

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on last edited by
                        #12

                        Hi,

                        I build teh static version of Qt 4.7.1 like in this "described wiki article":http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc . For me it worked with MinGW. The problem is that some modules do not support static building anymore without changing a bit. But afterwards it worked perfectly.

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #13

                          Gerolf,

                          In the editing config files are you suppose to add the bold lines in or replace the existing lines in the config files? Also, what does the "..." in "LFLAGS = -static -static-libgcc …" mean, is to represent that there should something after it?

                          Thanks

                          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
                          • Unsolved