PDA

View Full Version : How to configure Qt to work with MinGW-64?



Skywalker
8th July 2009, 02:50
I'd like to use Qt with MinGW 64 (http://sourceforge.net/projects/mingw-w64/). I read the following links but I've got some questions :)
Installing Qt/Windows (http://doc.trolltech.com/4.1/install-win.html)
configure Options (Qt) (http://doc.trolltech.com/qtopia4.3/buildsystem/over-configure-options-qt-1.html)

What do I need to do to configure Qt? I think I need to do 'configure -platform ...', but don't know what exactly to put there.

My MinGW-64 download has g++ and gcc commands, but didn't come with any 'make' command. How should I build with it? Is the lack of a 'make' command a problem? [edit: I was directed to just use mingw32-make, which should work]

Also I've set my PATH environment variable to include the mingw-64\bin folder, and it works from normal cmd command prompt, but the path isn't recognized Qt command prompt. I have to manually set PATH= inside the Qt prompt. How do I have the Qt command prompt initialize with the mingw-64\bin path as well as qt\bin?

nish
8th July 2009, 03:17
try to put win32-g++..
as for the make ... you can create a batch file make.bat which calls mingw-make or something..

what do you mean by qt command prompt? the qt sources do not come with a command prompt.. so it should work

Skywalker
8th July 2009, 03:47
'configure -platform win32-g++' starts, but gives me the error:

make (e=2): The system cannot find the file specified.
mingw32-make: *** [project.o] Error 2
Building qmake failed, return code 2
By command prompt I mean the Qt command prompt which sets up the MinGW/Qt environment.

nish
8th July 2009, 03:52
are u using qt sdk or qt library source?
sdk wont work.. use source

nish
8th July 2009, 03:55
By command prompt I mean the Qt command prompt which sets up the MinGW/Qt environment.

ya i ment the same... its just a batch file which calls cmd.exe... but this file only comes with a sdk and not with source.

Skywalker
8th July 2009, 04:26
are u using qt sdk or qt library source?
sdk wont work.. use source
I'm using SDK v2009.03. I'm on Windows - Vista 64. I'm afraid I'm not even sure where to get source :( Didn't see a link on the download (http://www.qtsoftware.com/downloads) page.

nish
8th July 2009, 04:46
http://www.qtcentre.org/forum/f-newbie-4/t-download-source-code-22248.html

Skywalker
8th July 2009, 18:42
http://www.qtcentre.org/forum/f-newbie-4/t-download-source-code-22248.html
Thanks. I'd actually prefer to use the SDK, though I'd be willing to try just the source. However I actually see that qtenv.bat, "win32-g++" is already the QMAKESPEC. What I'd like is to change it to mingw-w64 (mingw-w64\bin\mingw32-make.exe is the make command on my computer, mingw-w64\bin\x86_64-w64-mingw32-g++.exe and C:\mingw-w64\bin\x86_64-w64-mingw32-gcc.exe are the compilers).

I tried editing qtenv.bat to "set QMAKESPEC=x86_64-w64-mingw32" and "set QMAKESPEC=c:\mingw-w64\bin\x86_64-w64-mingw32" but the programs being compiled were still using the 32 bit compiler.

"configure -platform c:\mingw-w64\bin\x86_64-w64-mingw32-g++" and "configure -platform x86_64-w64-mingw32-g++" both give me "Invalid option "c:\mingw-w64\bin\x86_64-w64-mingw32-g++" for -platform." type errors.

Should I uninstall the SDK and try to run configure again with the source, and/or is there something else I should be using other than x86_64-w64-mingw32?

Skywalker
9th July 2009, 01:00
Alternatively, is there a temporary modification I can make to the Makefile to have it build with MinGW-64? I need to be getting some work done :D

nish
9th July 2009, 01:37
try everything you mentioned with source only... the sdk comes precompiled and QtCreator etc are dependent on it.. if you configure it again .. they will break... we have seen a lot of ppl having problems with sdk when they try to change it (for example use it with msvc).
Theotrically SDKs are standalone products and they should not be changed.

so first try win32-g++ with Qt source and make sure that no mingw(32bit) compiler is present on your machine.

Skywalker
9th July 2009, 03:48
I uninstalled the SDK and installed 4.5.2. During installation I pointed it to the location of MinGW 64 though it said it couldn't locate g++, I guess because it was looking for the 32 bit filename. Renaming the file might be an option there anyway.

I ran 'configure -platform win32-g++' but I'm getting the same error as with the SDK.

"make (e=2): The system cannot find the file specified.
mingw32-make: *** [project.o] Error 2
Building qmake failed, return code 2"

Also when I try to launch Assistant, Demos, etc. I get the error "mingwm10.dll was not found". I searched in the mingw-w64 folder and there's no such DLL, the only DLLs are libgcc_s_sjlj-1.dll, lissp-0.dll, and libssp.dll.a.

nish
9th July 2009, 04:16
I uninstalled the SDK and installed 4.5.2. During installation I pointed it to the location of MinGW 64


are you sure you are using the sources? did you downloaded the 4.5.2 exe file? if yes then download the source here

http://get.qtsoftware.com/qt/source/qt-win-opensource-src-4.5.2.zip

Skywalker
9th July 2009, 04:44
Whoops you're - I read the wrong post in the thread you directed me to - saw the one about "right column", missed your post with the link.

I actually got the same error as before however. This time it occurred to me to copy 'x86_64-w64-mingw32-g++.exe' to 'g++.exe', and surprisingly that actually seems to have worked in bypassing that particular error. Must have been the problem since the start.

After I uninstalled 4.5.2, I unzipped and ran 'configure -platform win32-g++'. It ran for a while but fails with the error message:

C:\Qt/src/corelib/tools/qdatetime.cpp: In function 'void localToUtc(QDate&, QTim
e&, int)':
C:\Qt/src/corelib/tools/qdatetime.cpp:3768:12: error: '_tzset' was not declared
in this scope
C:\Qt/src/corelib/tools/qdatetime.cpp: In member function 'QString QDateTimePars
er::sectionText(const QString&, int, int) const':
C:\Qt/src/corelib/tools/qdatetime.cpp:4424:10: warning: case label value is less
than minimum value for type
C:\Qt/src/corelib/tools/qdatetime.cpp:4425:10: warning: case label value is less
than minimum value for type
C:\Qt/src/corelib/tools/qdatetime.cpp:4426:10: warning: case label value is less
than minimum value for type
C:\Qt/src/corelib/tools/qdatetime.cpp: In member function 'QString QDateTimePars
er::sectionText(int) const':
C:\Qt/src/corelib/tools/qdatetime.cpp:4438:10: warning: case label value is less
than minimum value for type
C:\Qt/src/corelib/tools/qdatetime.cpp:4439:10: warning: case label value is less
than minimum value for type
C:\Qt/src/corelib/tools/qdatetime.cpp:4440:10: warning: case label value is less
than minimum value for type
mingw32-make: *** [qdatetime.o] Error 1
Building qmake failed, return code 2

nish
9th July 2009, 04:50
looks like only Mr. Wysota or Google can help you now.. I dont have 64machine.. cant test myselft sorry :(

Skywalker
9th July 2009, 04:57
OK - thanks for your help :)

Skywalker
9th July 2009, 22:15
I commented out the _tzset() line in qdatetime.cpp to see if that would help, but now I'm getting many new errors, now from qfsfileengine_win.cpp. They seem to be the same as for the person on this post to the mailing list (http://lists.trolltech.com/pipermail/qt-interest/2008-December/000484.html).

C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:112:123: warning: 'dllimport' attr
ibute ignored
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:114:162: warning: 'dllimport' attr
ibute ignored
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:122:56: warning: 'dllimport' attri
bute ignored
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In static member function 'static
void QFSFileEnginePrivate::resolveLibs()':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:177:99: warning: deprecated conver
sion from string constant to 'WCHAR*'
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:181:98: warning: deprecated conver
sion from string constant to 'WCHAR*'
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:184:101: warning: deprecated conve
rsion from string constant to 'WCHAR*'
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'qint64 QFSFil
eEnginePrivate::nativeSize() const':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:666:50: error: '_get_osfhandle' wa
s not declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'int QFSFileEn
ginePrivate::nativeHandle() const':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:903:33: error: '_fileno' was not d
eclared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:913:60: error: '_open_osfhandle' w
as not declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'bool QFSFileE
nginePrivate::nativeIsSequential() const':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:934:57: error: '_fileno' was not d
eclared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:934:58: error: '_get_osfhandle' wa
s not declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'bool QFSFileE
nginePrivate::doStat() const':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:1323:50: error: '_get_osfhandle' w
as not declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'virtual bool
QFSFileEngine::setPermissions(uint)':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:1918:4: error: '::_chmod' has not
been declared
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'virtual bool
QFSFileEngine::setSize(qint64)':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:1938:46: error: '_get_osfhandle' w
as not declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'virtual QDate
Time QFSFileEngine::fileTime(QAbstractFileEngine::FileT ime) const':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:2004:49: error: '_get_osfhandle' w
as not declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp: In member function 'uchar* QFSFil
eEnginePrivate::map(qint64, qint64, QFile::MemoryMapFlags)':
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:2056:53: error: '_fileno' was not
declared in this scope
C:\Qt\qt/src/corelib/io/qfsfileengine_win.cpp:2056:54: error: '_get_osfhandle' w
as not declared in this scope
mingw32-make: *** [qfsfileengine_win.o] Error 1
Building qmake failed, return code 2

rubenvb
5th March 2010, 12:15
Sorry for digging up an old thread, but this is one of the first hits on Google for "mingw64 Qt", and there is now a way to easily use Qt with that toolchain:

https://sourceforge.net/apps/trac/mingw-w64/wiki/Building%20QT%204_6

It comes down to this:
- download the patched sources
- download sezero's latest build of mingw64 (has almost all that you need)
- if you want sse/sse2, appply the small patch described under the "Download" section of the above linked wiki.
- configure, build and use like you would normally

Just thought this is pretty vital info for anyone searching for an answer.

PS: Mingw64 has a 32-bit and 64-bit toolchain, so you can build both versions with mingw64 (there are seperate downloads for win32 and win64 targets).

carl_tw
23rd October 2010, 20:45
mingw-w64 wiki updated:
How to build Qt with mingw-w64 (https://sourceforge.net/apps/trac/mingw-w64/wiki/BuildingQt)