Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved] Problem building Qt statically in Windows

[Solved] Problem building Qt statically in Windows

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 4 Posters 7.8k 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.
  • A Offline
    A Offline
    arturo
    wrote on last edited by
    #1

    Hi,

    I'm trying to deploy a small project by creating an executable file that works out of the box in Windows, so I need to compile Qt sources statically. I use the following configure command:

    @
    configure -release -static -platform win32-g++ -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -no-sql-sqlite -no-declarative -qt-sql-mysql -I C:\mysql\include -L C:\mysql\lib\opt -l mysql
    @

    Then I run mingw32-make. After some time compiling (more than half an hour, just in case that's relevant) I get the following output:

    @
    [...]
    g++ -c -Os -momit-leaf-frame-pointer -fno-exceptions -Wall -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQDOC2_COMPAT -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_XML_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NO_DYNAMIC_CAST -I"....\include\QtCore" -I"....\include\QtXml" -I"....\include" -I"c:\mysql\include" -I"....\include\QtDeclarative" -I"declarativeparser" -I"....\include\ActiveQt" -I"tmp\moc\release_static" -I"....\mkspecs\win32-g++" -o tmp\obj\release_static\cppcodemarker.o cppcodemarker.cpp
    cppcodemarker.cpp: In member function 'QString CppCodeMarker::addMarkUp(const QString&, const Node*, const Location&)':
    cppcodemarker.cpp:950: error: 'isalpha' was not declared in this scope
    cppcodemarker.cpp:956: error: 'isalnum' was not declared in this scope
    cppcodemarker.cpp:973: error: 'isdigit' was not declared in this scope
    cppcodemarker.cpp:977: error: 'isalnum' was not declared in this scope
    cppcodemarker.cpp: At global scope:
    cppcodemarker.cpp:879: warning: 'QString untabified(const QString&)' defined but not used
    mingw32-make[3]: *** [tmp/obj/release_static/cppcodemarker.o] Error 1
    mingw32-make[3]: Leaving directory C:/Users/Arturo/Desktop/Qt/tools/qdoc3' mingw32-make[2]: *** [release] Error 2 mingw32-make[2]: Leaving directory C:/Users/Arturo/Desktop/Qt/tools/qdoc3'
    mingw32-make[1]: *** [sub-qdoc3-make_default-ordered] Error 2
    mingw32-make[1]: Leaving directory `C:/Users/Arturo/Desktop/Qt/tools'
    mingw32-make: *** [sub-tools-make_default-ordered] Error 2
    @

    Can anybody give me any hints about what's wrong?

    Some additional info: I work in Windows 7, and I use gcc + MinGW to compile. The Qt sources are version 4.7.4, and I include the Qt MySQL plugin and the MySQL library.

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

      you should restrict the static build on the libs.
      Have a look at "this wiki page":http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc

      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
      • A Offline
        A Offline
        arturo
        wrote on last edited by
        #3

        Nice link, it'd have saved me a good amount of time had I seen it earlier!

        Anyway, I'm already compiling after restricting the build on the libs. It'll take some time, so I'll post the results tomorrow.

        Thanks for the quick reply!

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

          Regard the changes, that the wiki article describe. without them, itv was not compilable, as some modules do not support static building by default.

          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
          • H Offline
            H Offline
            hkhauke
            wrote on last edited by
            #5

            I found your problem description via Google. Had the same error message on Mac OS but I tried to compile to a shared library. The problem in my case was related to the -no-stl option (isAlpha) seems to be an STL function). By removing -no-stl from the configure line the problem was solved for me.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              arturo
              wrote on last edited by
              #6

              [quote author="Gerolf" date="1316007292"]Regard the changes, that the wiki article describe. without them, itv was not compilable, as some modules do not support static building by default.[/quote]

              Yeah, I applied them, except the one related to the WebKit, which I don't use.

              [quote author="hkhauke" date="1316008090"]The problem in my case was related to the -no-stl option (isAlpha) seems to be an STL function). By removing -no-stl from the configure line the problem was solved for me.
              [/quote]

              I was a bit puzzled about that, cause I thought isAlpha was part of the standard C library, and not of STL. Maybe I got something wrong... But anyway, restricting the compilation to just the Qt libraries, as suggested by Gerolf, solved the problem for me.

              Thank you all for your replies.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rogermc
                wrote on last edited by
                #7

                To correct
                cppcodemarker.cpp:950: error: 'isalpha' was not declared in this scope
                cppcodemarker.cpp:956: error: 'isalnum' was not declared in this scope
                cppcodemarker.cpp:973: error: 'isdigit' was not declared in this scope
                cppcodemarker.cpp:977: error: 'isalnum' was not declared in this scope

                In tools/qdoc3/cppcodemarker.cpp
                just add
                #include "ctype.h"
                to the list of #includes at the start of the file

                This fixed it for my system

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