Didac Perez Parera
Didac Perez Parera

Reputation: 3834

Compiling static QT libraries with /MT using MSVC2010

I am trying to build QT libraries statically and with /MT (runtime static linking).

I have followed the next steps: 1. Go to qmake.conf file and modify /MD to /MT in both release and debug configurations 2. I run configure command like this: configure -static -opensource 3. I run nmake

The problem is that nmake fails a few seconds after running. Here are the last output:

[..........]
qjson.cpp
qjsondocument.cpp
qjsonobject.cpp
qjsonarray.cpp
qjsonvalue.cpp
qjsonparser.cpp
qjsonwriter.cpp
Generating Code...
        cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MT -W3 -w34100 -w34189 -GR -DUNICO
DE -DWIN32 -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_COD
ECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT
_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT
_NO_TRANSLATION -DQT_QMAKE_LOCATION=\"F:/utils/Qt/5.0.0/Src/qtbase/bin/qmake\" -
DQT_NO_CAST_FROM_ASCII -DQT_BUILD_BOOTSTRAP_LIB -DQT_BUILDING_QT -DQT_ASCII_CAST
_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_
DISABLE_DEPRECATED_BEFORE=0x040800 -D_USE_MATH_DEFINES -DQT_NO_DEBUG -DQT_NO_EXC
EPTIONS -I"..\..\..\include" -I"..\..\..\include\QtCore" -I"..\..\..\include\QtC
ore\5.0.0" -I"..\..\..\include\QtCore\5.0.0\QtCore" -I"..\..\..\include\QtXml" -
I"F:\utils\Qt\5.0.0\Src\qtbase\include\QtXml\5.0.0" -I"F:\utils\Qt\5.0.0\Src\qtb
ase\include\QtXml\5.0.0\QtXml" -I"tmp" -I"..\..\corelib\global" -I"..\..\3rdpart
y\zlib" -I"..\..\..\mkspecs\win32-msvc2010" -Fo.obj\release_static\ @C:\Users\DI
DAC~1.PER\AppData\Local\Temp\nmE62A.tmp
qdom.cpp
..\..\..\include\QtXml\qdom.h(1) : fatal error C1083: Cannot open include file:
'../../../../../../../../f:/utils/Qt/5.0.0/Src/qtbase/src/xml/dom/qdom.h': Inval
id argument
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

Please, are you experiencing the same result? Anybody know how to solve this problem? Thanks in advance,

Cheers, Dídac Pérez

Upvotes: 1

Views: 1776

Answers (2)

Reza Ebrahimi
Reza Ebrahimi

Reputation: 3689

This is a known Qt bug on static building of Qt source with MSVC:

https://bugreports.qt-project.org/browse/QTBUG-28761

https://bugreports.qt-project.org/browse/QTBUG-28989

Upvotes: 1

Didac Perez Parera
Didac Perez Parera

Reputation: 3834

I have fixed the error. I think configure command generates wrong header files. For instance, qdom.h in qtbase/include/qtxml were like this:

#include "../../../../../../../../f:/utils/Qt/5.0.0/Src/qtbase/src/xml/dom/qdom.h"

and I had to move to:

#include "../../src/xml/dom/qdom.h"

And now it works. Maybe this is an issue of qt building system.

Kind regards,

Upvotes: 1

Related Questions