Building Qt 5.2.1 in latest Visual Studios



  • Hello,

    I am evaluating Qt 5.2.1 using the latest Visual Studios; at least VS2012 Update 4, and/or VC++ November 12 CTP, whichever gets me the latest possible compiler compliance support.

    I will also try building with VS2013, which also has Update 1 available, for the same reason: latest possible compiler support.

    I don't necessarily care about any QtCreator or anything like that. In fact, we'll likely be supporting and/or building through Visual Studio, if possible.

    For what it's worth, as far as I know, for this application we don't care about UI parts, just the QtCore.

    Has anyone build in these scenarios in the latest possible Qt versions?

    I am hesitant to buy into any hype, so keep it straight. Of course I could also be a biased bigot, but that's okay.

    Best regards,

    Michael


  • Moderators

    Hi,

    Yes I regularly built Qt's latest source code from git using VS 2012, and then using VS 2013 when it came out.

    My latest VS 2013 build was done 1 week ago.

    The instructions are at http://qt-project.org/wiki/Building_Qt_5_from_Git



  • Thanks. It's a good start. Ah, with the perpetual take on dependencies... (i.e. Perl, Python, etc).

    Now, I won't need QtWebKit I don't think. We just want QtCore-only. This can be isolated from the graphical parts of Qt?

    Thank ye...


  • Moderators

    Release packages (.zip for Windows) do not depend on Perl. If you skip webkit and qtquick, you also do not need Python.



  • Thanks. That's fine, but we might like to build for: 1) multi-threaded, 2) dynamic and/or static DLL, etc. This all gets configured in the configure.sh?


  • Moderators

    Yes. Default is to use multiple threads and DLLs. Run configure --help to get more info.



  • MINGW is a hard requirement? Or we can build with MSVC? i.e. XPLATFORM_MINGW=yes



  • How to build without the WebKit or other unnecessary (for our purposes) parts? Those are not listed in the help.


  • Moderators

    [quote author="mwpowellhtx" date="1393690963"]MINGW is a hard requirement? Or we can build with MSVC? i.e. XPLATFORM_MINGW=yes[/quote]

    JKSH has already told you, that MSVC is fine... I usually use MSVC 2010 and it works well.

    No, MinGW is not needed. Actually, Qt will not work if you mix MSVC and MinGW.

    [quote]How to build without the WebKit or other unnecessary (for our purposes) parts? Those are not listed in the help.[/quote]

    "skip" command is your friend. Alternatively, you can just delete the module folder. It should still compile fine. Here is what I use to compile Qt on Windows:
    @
    configure -opensource -confirm-license -opengl desktop -mp -skip webkit -skip qtquick1 -nomake tests -nomake examples -prefix CD/qtbase
    @

    CD must be enclosed with pecentage signs (I can't put them here on forum; the system blocks it). Compilation takes 15 minutes on Linux, and about an hour on Windows (for a quad-core CPU with HT).


  • Moderators

    And to specify the compiler, you need to use "-platform" flag (and then just pass one of the mkspecs).



  • Again, maybe I am bigoted re: configure, but where are the <parts> listed in the help? This is not a Qt problem, per se, but an "accepted convention", would-be mid-range end-users such as myself are simply expected to "know" what to nomake or skip. Anyhow, I cannot seem to see help again since the last failed attempt: command not found. So I need start fresh it seems... Oi. BTW, I am following the steps on the build page, but it's not very well outlined: Building Qt 5 from Git. I would like to build with JOM if I can somehow make that work, since I have 8 cores, to cut the time down some.


  • Moderators

    IIRC "parts" is more or less Qt modules.



  • That's not what I was asking. I get that: parts == modules. What I was asking is: where are the list of parts? Generally, configure(s) do not list these, and it is annoying as hell.



  • What would a configure look like: we're not doing any Qt UI, we want QtCore only. I tried even the earlier configure, and it chokes:

    I:\Source\qt5>configure -opensource -confirm-license -opengl desktop -mp -skip webkit -skip qtquick1 -nomake tests -nomake examples -prefix CD/qtbase

    • cd qtbase
    • I:\Source\qt5\qtbase\configure.bat -top-level -opensource -confirm-license -opengl desktop -mp -skip webkit -skip qtquick1 -nomake tests -nomake examples -prefix CD/qtbase
      Please wait while bootstrapping configure ...
      <srcbase> = I:/Source/qt5/qtbase
      <outbase> = I:/Source/qt5/qtbase

    Microsoft (R) Program Maintenance Utility Version 11.00.60610.1
    Copyright (C) Microsoft Corporation. All rights reserved.

        cl -c -Yc -nologo -Zm200 -Zc:wchar_t -MT -W3 -GR -EHsc -w34100 -w34189 -DUNICODE -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DCOMMERCIAL_VERSION -I"..\..\include" -I"..\..\include\QtCore" -I"..\..\include\QtCore\5.3.0" -I"..\..\include\QtCore\5.3.0\QtCore" -I"I:\Source\qt5\qtbase\tools\shared" -I"I:\Source\qt5\qtbase\mkspecs\win32-msvc2008" -Fpconfigure_pch.pch -Foconfigure_pch.obj -TP I:\Source\qt5\qtbase\tools\configure\configure_pch.h
    

    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.EXE"' : return code '0xc0000135'
    Stop.



  • I am thinking that my environment is confused, but I don't know if it's a configuration issues, the fact that I've got VS2010 and VS2012 and VS2013 all installed, or what.

    I may give the installer a gander after all and see if it will at least get us by. Would be nice if I could get past this issue though.


  • Moderators

    Here is a list of all modules: "link":http://qt-project.org/doc/qt-5/qtmodules.html.

    Seems like you are using wrong mkspecs. Are you running that from your MSVC-enabled command line? To make the compiler choice specific, add this to configure:
    @
    -platform win32-msvc2013
    @

    (or msvc2012, depending on your choice). If you really, really just need QtCore, it will probably take some iterations to nail a working configure line, as it is a highly specific use case (most people compile whole Qt, some skip webkit and QtQuick1, but almost nobody goes further :P).

    I'll give you 2 ways to do it, but there are many more.

    remove all folders from your Qt dir, except for qtbase, qttools and qtdoc, then run configure as usual. This will still not be ideal for you: modules like QtNetwork are inside qtbase (but it is a small module, compiles in seconds)

    keep patiently removing all Qt modules with -skip flag...


  • Moderators

    OK, I'll throw in the third way: run the configure line as usual, but then don't run the global Makefile. Instead, cd into qtbase and run nmake (or jom) there. This should only build QtCore, QtNetwork, and other base modules.



  • As long as I can identify them (more or less), yes. Thanks for the tips (and the patience!)...



  • I added -platform win32-mscv2012, and same error. Yes, I need an MSVC command line?



  • I'm just reading the notes: http://qt-project.org/wiki/Building_Qt_5_from_Git

    And nowhere after configure does it say to CD qtbase when using jom, or any of the other options. Or maybe I am reading it wrong?

    Oh! Bit of a clue: the prefix is where the stuff lands, so that's why...

    I am spoiled by IDEs, workspace and project files, which are a dialect all their own...


  • Moderators

    Qt is being built based on Makefiles (which are being normally read and executed by make on Unix and nmake on Windows). When you run "configure", it will do the following for you:

    • bootstrap Qt tools (namely: create qmake binary, which is then used to generate Makefiles, create moc and friends)
    • generate main Makefile
    • generate a separate Makefile for every module

    So. Standard Qt compilation instructions (the ones you have inked) instruct you to just run "nmake". This will run the main Makefile, which in turn runs all module Makefiles.

    But you are not forced to do it: if you simply cd into any module and run nmake there, only that single module will be compiled.

    All resulting libraries and binaries are always put into qtbase.

    Having said all this, I still think that if you are a "mid-range" end user, you should not be concerned about all this: just grab the precompiled Qt installer, or compile the whole package without getting into advanced and custom configuration. You will probably waste much more time trying to compile Qt in your specific way (we are already talking for the whole day), especially on Windows where things tend to break every time Microsoft decides to bless us all with an update to their compiler.

    Now, getting to that error. It seems to be coming from precompiled headers. I don't remember the dev consensus exactly, but it might be that headers are precompiled in the .zip package. I am no expert here, but they may not be compatible with MSVC 2k13 (MS has a habit of breaking the compatibility on a regular basis). In that case, you may have more luck checking out from git (but that will take a long time + pull the Perl dependency).



  • Ah, I didn't need to change dir to qtbase, there is no Makefile there. Actually it's in the <path/to/qt5>.



  • Configure done. Now jom is running. Coffee, movie...



  • I'd agree with the installer approach if I was the only end-user. We're supporting software across platforms, so need the flexibility to build it how we want across platforms.

    I'm not sure how long the build runs (2 cores, 1 hour?), or if JOM is actually helping at all. At least it's building. We'll see...



  • Actually, the build was finishing just as I wrote that...



  • So... ~50 minutes, give or take. JOM helped a little? More cores, maybe a non factor. Not sure if I set the CL to /MP, now that I think about it. I'm sure it could be helped.



  • Okay, now what? I've got some includes to include, and some cmakes in CD to make?

    Actually I see a bunch of promising output in qtbase/lib to go with the includes.



  • ... So really we "just" need the includes and the output from the prefix PWD/qtbase? The harder part is establishing a strategy for maintenance, end-user consumption, etc.



  • Okay, I reconfigured, no prefix, "qtbase/lib" dropped "in place" alongside "qtbase/include". I set the CL environment variable and ran JOM; and the build that took nearly 1 hour before, took maybe 2 minutes (conservatively)! That's on an 8-core machine. I can hardly believe that. It sure does look like the DLLs and all are there. WOW,



  • If I could mark it as an answer I would. Thanks again for setting me straight.


  • Moderators

    Well, you don't need to build Qt for your end-users. For them, you just deploy the libraries you need ("link":http://qt-project.org/doc/qt-5/windows-deployment.html, there are guides like that for every platform). But of course, you know your situation better than I do.

    [quote]Okay, now what? I’ve got some includes to include, and some cmakes in CD to make?[/quote]

    That depends on what you want to achieve. If you want to use Qt Creator for development, then you just need to point it to your newly built qmake.exe, and it will configure itself automatically; no need to link or include anything by hand.

    If you want to use Visual Studio - there is a plugin for that available on the downloads page.

    If you want to run everything from command line, you need to add qtbase/bin to PATH.

    [quote]So really we “just” need the includes and the output from the prefix PWD/qtbase?[/quote]

    qtbase/bin, qtbase/includes, qtbase/mkspecs. You can automatically separate those if you perform an out of source build, like this:
    @
    // assuming Qt source code is in qt-src
    mkdir qt-build
    cd qt-build
    ..\qt-src\configure <your Qt flags> -prefix CD\qtbase
    nmake
    nmake install
    @

    This will compile and install Qt to qt-build, leaving your Qt source code intact.



  • Right I understand re: developers and deployed binaries. The configure make system is a little foreign to me is all, and when I have used it a bit opaque if cumbersome. I'm sure not once you get used to it.

    Anyhow, I expect there's some way to identify libs (and dlls or .sos) for linkage on the other side of their includes. Much of which is IDE specific.

    The much harder part about our situation is mitigating cross platform risk factors, less technical and more geo-political in nature, coordinating the builds.

    Thanks...


  • Moderators

    Yeah, cross-platform build servers are always problematic. Qt makes the compilation part quite easy (the same code works on all platforms without any changes), but there always are lots of other problems to solve ;)

    OK, I hope I've helped you at least a bit. If there are more questions, please ask. Have fun! :)



  • I can build QT using VC++ 2013 without OpenSSL, but with OpenSSL I get the errors below.

    Suggestions?

    Robin

        cl -c -FIqt_pch.h -Yuqt_pch.h -Fp.pch\debug\Qt5Networkd_pch.pch -nologo
    

    -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 /Fd....\lib\Qt5Networkd.pdb
    -DUNICODE -DWIN32 -DQT_NO_USING_NAMESPACE -DQT_BUILD_NETWORK_LIB -DQT_BUILDING_
    QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRI
    NGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -D_US
    E_MATH_DEFINES -DQT_NO_EXCEPTIONS -DQT_CORE_LIB -I"C:\qt\openssl-1.0.1f\openssl-
    1.0.1f\include" -I"....\include" -I"....\include\QtNetwork" -I"....\include\Q
    tNetwork\5.2.1" -I"....\include\QtNetwork\5.2.1\QtNetwork" -I"tmp" -I"..\3rdpar
    ty\zlib" -I"kernel" -I"....\include\QtCore\5.2.1" -I"....\include\QtCore\5.2.1
    \QtCore" -I"....\include\QtCore" -I".moc\debug" -I"....\mkspecs\win32-msvc2010
    " -Fo.obj\debug\ @C:\Users\rower\AppData\Local\Temp\nm68AA.tmp
    qhttpnetworkreply.cpp
    C:\qt\openssl-1.0.1f\openssl-1.0.1f\include\openssl/ssl.h(1) : error C2059: synt
    ax error : '.'
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(69) : error C2143: syntax error : missing ';' before ''
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(69) : error C4430: missing type specifier - int assumed. Note: C++ d
    oes not support default-int
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(69) : warning C4183: 'createSsl': missing return type; assumed to be
    a member function returning 'int'
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(70) : error C2061: syntax error : identifier 'SSL'
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(79) : error C2143: syntax error : missing ';' before '
    '
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(79) : error C4430: missing type specifier - int assumed. Note: C++ d
    oes not support default-int
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(80) : error C2143: syntax error : missing ';' before ''
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(80) : error C4430: missing type specifier - int assumed. Note: C++ d
    oes not support default-int
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(81) : error C2143: syntax error : missing ';' before '
    '
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(81) : error C4430: missing type specifier - int assumed. Note: C++ d
    oes not support default-int



  • Research C4430? Possibly a language standard thing? I don't know the configure option(s), but could C++11 (or other) be specified?



  • I configured openssl like this:

    perl Configure VC-WIN32 --prefix=c:\Qt\openssl-1.0.1f\openssl-1.0.1f\release

    Qt5 like this:

    configure -prefix



  • I configured openssl like this:

    perl Configure VC-WIN32 --prefix=c:\Qt\openssl-1.0.1f\openssl-1.0.1f\release

    Qt5 like this:

    configure -prefix



  • I configured openssl like this:

    perl Configure VC-WIN32 --prefix=c:\Qt\openssl-1.0.1f\openssl-1.0.1f\release

    Qt5 like this:

    configure -opensource -opengl desktop -nomake tests -openssl -I C:\qt\openssl-1.0.1f\openssl-1.0.1f\include

    Also tried with C++11:

    configure.exe -platform win32-msvc2012 -c++11 -opensource -openssl -I C:\qt\openssl-1.0.1f\openssl-1.0.1f\include

    The error message points to this line of code:

    SSL* createSsl();
    

    I can't see anything wrong with that. Error message below.

    Ideas?

    Robin

    qhttpthreaddelegate.cpp
    C:\qt\openssl-1.0.1f\openssl-1.0.1f\include\openssl/ssl.h(1) : error C2059: synt
    ax error : '.'
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(69) : error C2143: syntax error : missing ';' before '*'
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(69) : error C4430: missing type specifier - int assumed. Note: C++ d
    oes not support default-int
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(69) : warning C4183: 'createSsl': missing return type; assumed to be
    a member function returning 'int'
    c:\qt\qt-everywhere-opensource-src-5.2.1\qt-everywhere-opensource-src-5.2.1\qtba
    se\include\qtnetwork\5.2.1\qtnetwork\private../../../../../src/network/ssl/qssl
    context_p.h(70) : error C2061: syntax error : identifier 'SSL'



  • This was a forum about building Qt. Not openssl. Can I suggest start fresh so as not to confuse readers?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.