Important: Please read the Qt Code of Conduct -

Building from source using MSVC 2015 fails

  • I'm trying to build Qt from source (qt-everywhere-opensource-5.5.1) on a Windows 10 machine with a freshly downloaded Visual Studio 2015. The first problem was the fact that "python" didn't exist but "py" did. I ended up having to add a path environment variable to get past this point. But now after building for several hours, I'm stuck with a whole slew of "is not a member of 'global namespace'" errors. I'm following the procedure listed here: I've set up the qt5vars.cmd file as follows:

    REM Set up \Microsoft Visual Studio 2013, where <arch> is \c amd64, \c x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
    SET _ROOT=C:\Qt\5.5.1\qt-everywhere-opensource-5.5.1
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    REM Uncomment the below line when using a git checkout of the source repository
    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET QMAKESPEC=win32-msvc2013
    SET _ROOT=

    I've even tried SET QMAKESPEC=win32-msvc2015 but I wind up with the same errors.
    I've also tried the changes found in this reference:
    But those are clearly for an older version and some of the changes don't correspond to the current version.

    So, why doesn't the published procedure work? What do I need to do to fix it?
    All I'm after is a statically linked version so I can deploy a program.

  • Even if setting correct makespec did not help it does not mean you should keep using wrong one.

    Your comment about static build means you are using commercial version.
    This means that you could find more help from qt company support than in here.

    I would highly recommend to upgrade Qt to 5.6 first since if you look at Qt 5.1 documentation
    you would find that it does not support MSVC2015 yet:

  • Nope. Commercial version is not required.
    "Step 1: Install the License File (Commercial Editions Only)"
    "For the open source version you do not need a license file."

    Second, I'm trying to build 5.5.1 not 5.1. There is a MSVC 2015 mkspec in there.
    Third, static builds are supposed to be for any Windows deployment where you don't want to use shared libraries:

    At this point, I've tried building using amd64 and x86_amd64 architectures. These both fail but in a different way. The error I get says "don't know how to make qtbase\lib\Qt5Widgetsd.lib"

    Before each attempt, I've done nmake distclean just to be sure. Still no joy.

  • @RogueWarrior said:

    "For the open source version you do not need a license file."

    Above means that you must comply with LGPL.
    And this means that you can't link to Qt statically or you break a license.

  • Fine. I'll comply with the license. But that shouldn't prevent you from building the libraries. If it does, then they should say so in the docs. They don't.

  • Okay, so it would appear that nmake distclean doesn't really clean up the source tree as expected.
    I ended up trashing the whole directory and started over.

    For the record, the above qt5vars with QMAKESPEC=win32-msvc2015 is what I used. I also put the sources into C:\qt551 because I read a google reference about long path names and changed the SET _ROOT to that.

    My configure command was:
    configure -release -opensource -static -static-runtime -opengl desktop -nomake examples -nomake tools -nomake tests

    I tested this all out on the basicdrawing example. IMHO, the docs need to be updated and should also mention the need for a proper path to python.

Log in to reply