September 14, 2011

arturo arturo
Lab Rat
7 posts

[Solved] Problem building Qt statically in Windows

 

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:

  1. 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:

  1. [...]
  2. 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
  3. cppcodemarker.cpp: In member function 'QString CppCodeMarker::addMarkUp(const QString&, const Node*, const Location&)':
  4. cppcodemarker.cpp:950: error: 'isalpha' was not declared in this scope
  5. cppcodemarker.cpp:956: error: 'isalnum' was not declared in this scope
  6. cppcodemarker.cpp:973: error: 'isdigit' was not declared in this scope
  7. cppcodemarker.cpp:977: error: 'isalnum' was not declared in this scope
  8. cppcodemarker.cpp: At global scope:
  9. cppcodemarker.cpp:879: warning: 'QString untabified(const QString&)' defined but not used
  10. mingw32-make[3]: *** [tmp/obj/release_static/cppcodemarker.o] Error 1
  11. mingw32-make[3]: Leaving directory `C:/Users/Arturo/Desktop/Qt/tools/qdoc3'
  12. mingw32-make[2]: *** [release] Error 2
  13. mingw32-make[2]: Leaving directory `C:/Users/Arturo/Desktop/Qt/tools/qdoc3'
  14. mingw32-make[1]: *** [sub-qdoc3-make_default-ordered] Error 2
  15. mingw32-make[1]: Leaving directory `C:/Users/Arturo/Desktop/Qt/tools'
  16. 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.

6 replies

September 14, 2011

Gerolf Gerolf
Mad Scientist
3005 posts

you should restrict the static build on the libs.
Have a look at this wiki page [developer.qt.nokia.com]

 Signature 

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

September 14, 2011

arturo arturo
Lab Rat
7 posts

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!

September 14, 2011

Gerolf Gerolf
Mad Scientist
3005 posts

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

 Signature 

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

September 14, 2011

hkhauke hkhauke
Lab Rat
1 posts

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.

September 15, 2011

arturo arturo
Lab Rat
7 posts
Gerolf wrote:
Regard the changes, that the wiki article describe. without them, itv was not compilable, as some modules do not support static building by default.

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

hkhauke wrote:
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.

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.

October 21, 2011

rogermc rogermc
Lab Rat
1 posts

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

 
  ‹‹ how to create an xcode 4 project from a .pro?      [SOLVED] Problem with Installing application @ device that use .cpp and .qml file ››

You must log in to post a reply. Not a member yet? Register here!