Qt 5.02 won't build with MSVC2012



  • Hi all,

    I'm trying to do a static build of Qt 5.0.2 using MSVC2012. However, I'm getting the following error:

    @ Creating library D:\Qt\qt-everywhere-opensource-src-5.0.2\x86_64\qtbase\bin\q
    mlscene.lib and object D:\Qt\qt-everywhere-opensource-src-5.0.2\x86_64\qtbase\bi
    n\qmlscene.exp
    Qt5Quick.lib(qquickshadereffectsource.obj) : error LNK2001: unresolved external
    symbol __imp_glBindTexture
    Qt5Gui.lib(qopenglpaintengine.obj) : error LNK2001: unresolved external symbol _
    _imp_glStencilOpSeparate
    D:\Qt\qt-everywhere-opensource-src-5.0.2\x86_64\qtbase\bin\qmlscene.exe : fatal
    error LNK1120: 100 unresolved externals
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
    \VC\BIN\x86_amd64\link.EXE"' : return code '0x460'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.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.
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    Stop.
    @

    (shortened, output was too large to fit into post, see full output at http://pastebin.com/m0dMRgnF)
    I can't find anything about it. Is this a bug?


  • Moderators

    Not a bug -- the compiler just can't find your OpenGL libraries.

    What are your 'configure' options?



  • Thanks for your reply!

    These are my configure options:
    @..\configure -nomake tests -nomake examples -no-openssl -no-rtti -release -static -platform win32-msvc2012 -mp -ltcg@

    The wiki says the following about OpenGL:

    bq. A copy of ANGLE is bundled in Qt 5. To use Option 1, you need to install the DirectX SDK [msdn.microsoft.com] (Note: Starting from Windows Kit 8, this is included in the Windows SDK).

    http://qt-project.org/wiki/Building_Qt_5_from_Git#aea23489ce3aa9b6406ebb28e0cda430

    I did install the Windows SDK 8, so I should have the DirectX SDK.


  • Moderators

    Hmm... I don't know the answer for sure (I only have experience with dynamic builds, not static ones), but here are some things you can try (clean out your build tree before reconfiguring):

    • "This page":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html#building-qt-statically says to call "nmake sub-src" instead of just "nmake" for static builds
    • I've read that "-no-rtti" has caused problems for people before; try removing that option
    • You don't need to specify "-platform win32-msvc2012" because Qt should auto-detect it
    • Instead of typing "..\configure", try going up one level and typing just "configure"

    If none of those work, you'll have to wait for someone else to come and help you, sorry!



  • bq. This page [qt-project.org] says to call “nmake sub-src” instead of just “nmake” for static builds

    • http://qtnode.net/wiki/Building_static says nmake sub-src will not build examples and demo's. Apparently that's the only difference with nmake, so it has nothing to do with static builds :)
      I already excluded those with the configure options -nomake tests -nomake examples.

    bq. I’ve read that “-no-rtti” has caused problems for people before; try removing that option

    • I reconfigured it with -opengl desktop, so I'm compiling again now. We'll see if this succeeds. If it doesn't, I'll try without -no-rtti :)

    bq. You don’t need to specify “-platform win32-msvc2012” because Qt should auto-detect it

    • How could it possibly auto-detect that? I mean, in the case that I have msvc2010, msvc2012 and MinGW installed on my build environment at the same time (which is totally valid), how does the build script know what compiler I want to use?

    bq. Instead of typing “..\configure”, try going up one level and typing just “configure”

    • I'm using this because I want my build to be in a subfolder (qt-everywhere-opensource-src-5.0.2\x86_64). After the x86_64 I'm gonna compile a x86 version too, in qt-everywhere-opensource-src-5.0.2\x86. That's why ;)
      Otherwise I would have to duplicate the whole source.

  • Moderators

    [quote author="Compizfox" date="1372387383"]* http://qtnode.net/wiki/Building_static says nmake sub-src will not build examples and demo's. Apparently that's the only difference with nmake, so it has nothing to do with static builds :)
    I already excluded those with the configure options -nomake tests -nomake examples.[/quote]Ah, you're right :)

    [quote]bq. You don’t need to specify “-platform win32-msvc2012” because Qt should auto-detect it

    • How could it possibly auto-detect that? I mean, in the case that I have msvc2010, msvc2012 and MinGW installed on my build environment at the same time (which is totally valid), how does the build script know what compiler I want to use?[/quote]Hmm... I wouldn't put multiple tool chains in my environment, especially if they're different versions of the same tools. Even if you tell the script which compiler to use, your compiler could end up invoking the wrong version of another tool with the same name, unless Microsoft has programmed their tools to look in particular places all the time and ignore the environment variables.

    That's why your Visual Studio installation comes with a Command Prompt shortcut -- Instead of exposing the tools to the global environment, the shortcut sets up a temporary isolated environment within that shell, to reduce the risk of invoking wrong tools.

    [quote]bq. Instead of typing “..\configure”, try going up one level and typing just “configure”

    • I'm using this because I want my build to be in a subfolder (qt-everywhere-opensource-src-5.0.2\x86_64). After the x86_64 I'm gonna compile a x86 version too, in qt-everywhere-opensource-src-5.0.2\x86. That's why ;)
      Otherwise I would have to duplicate the whole source.[/quote]The official way to do that is to use the -prefix configure option, if I'm not mistaken. I haven't seen this method before, but it looks like a convenient alternative if it works.

Log in to reply
 

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