CMake not detecting VS 2012 / VS 2013 properly (on Win 8.1)

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

CMake not detecting VS 2012 / VS 2013 properly (on Win 8.1)

Post by AshMcConnell »

Hi Folks,

I'm trying to Cmake compile Ogre default branch with VIsual Studio 2012 (and 2013). Unfortunately it just won't work at all, I am using the latest CMake (2.8.12.2).

I have tried: -

- Running using visual studio command prompt
- VS command prompt run as admin
- Run cmake-gui as admin
- Specifying the compiler location manually
- Installing Visual Studio 2013 from scratch in the default folder
- Installing the windows 8.1 SDK

What step am I missing here? I'm starting to go insane :)

Thanks for your help!


Here is the output: -

VS2012
:-

Code: Select all

The C compiler identification is MSVC 17.0.60610.1
The CXX compiler identification is MSVC 17.0.60610.1
Check for working C compiler using: Visual Studio 11
Check for working C compiler using: Visual Studio 11 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "G:/Program Files (x86)/Microsoft Visual Studio
  11.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeTmp

  

  Run Build Command:G:\PROGRA~1\MICROS~1.0\Common7\IDE\devenv.com
  CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec2863877349

  


  Microsoft (R) Microsoft Visual Studio 2012 Version 11.0.60610.1.


  Copyright (C) Microsoft Corp.  All rights reserved.


  1>------ Build started: Project: cmTryCompileExec2863877349, Configuration:
  Debug Win32 ------


  1> Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60610.1 for x86


  1> Copyright (C) Microsoft Corporation.  All rights reserved.


  1> 


  1> cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D
  "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t
  /Zc:forScope /Fo"cmTryCompileExec2863877349.dir\Debug\\"
  /Fd"cmTryCompileExec2863877349.dir\Debug\vc110.pdb" /Gd /TC /analyze-
  /errorReport:prompt testCCompiler.c


  1> 


  1> testCCompiler.c


  1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'


  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
  ==========


  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:48 (project)


Configuring incomplete, errors occurred!
See also "C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeError.log".

VS2013
:-

Code: Select all

The C compiler identification is MSVC 18.0.21005.1
The CXX compiler identification is MSVC 18.0.21005.1
Check for working C compiler using: Visual Studio 12
Check for working C compiler using: Visual Studio 12 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
  12.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeTmp

  

  Run Build Command:C:\PROGRA~2\MSBuild\12.0\Bin\MSBuild.exe
  cmTryCompileExec937682278.vcxproj /p:Configuration=Debug
  /p:VisualStudioVersion=12.0

  Microsoft (R) Build Engine version 12.0.21005.1


  [Microsoft .NET Framework, version 4.0.30319.34011]


  Copyright (C) Microsoft Corporation.  All rights reserved.


  


  Build started 09/03/2014 16:32:11.


  Project
  "C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\cmTryCompileExec937682278.vcxproj"
  on node 1 (default targets).


  PrepareForBuild:


    Creating directory "cmTryCompileExec937682278.dir\Debug\".

    Creating directory "C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\Debug\".

    Creating directory "cmTryCompileExec937682278.dir\Debug\cmTryCom.50D6FD06.tlog\".


  InitializeBuildStatus:


    Creating "cmTryCompileExec937682278.dir\Debug\cmTryCom.50D6FD06.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.


  ClCompile:


    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec937682278.dir\Debug\\" /Fd"cmTryCompileExec937682278.dir\Debug\vc120.pdb" /Gd /TC /analyze- /errorReport:queue testCCompiler.c

    Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86

    Copyright (C) Microsoft Corporation.  All rights reserved.

    

    testCCompiler.c

    cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec937682278.dir\Debug\\" /Fd"cmTryCompileExec937682278.dir\Debug\vc120.pdb" /Gd /TC /analyze- /errorReport:queue testCCompiler.c

    


  Link:


    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec937682278.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec937682278.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec937682278.lib" /MACHINE:X86 /SAFESEH  /machine:X86 /debug cmTryCompileExec937682278.dir\Debug\testCCompiler.obj


  LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
  [C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\cmTryCompileExec937682278.vcxproj]



  Done Building Project
  "C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\cmTryCompileExec937682278.vcxproj"
  (default targets) -- FAILED.


  


  Build FAILED.


  


  
  "C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\cmTryCompileExec937682278.vcxproj"
  (default target) (1) ->


  (Link target) -> 


    LINK : fatal error LNK1104: cannot open file 'kernel32.lib' [C:\Users\Ashley\3rdParty\code\ogre\CMakeFiles\CMakeTmp\cmTryCompileExec937682278.vcxproj]


  


      0 Warning(s)

      1 Error(s)


  


  Time Elapsed 00:00:00.85


  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:48 (project)


Configuring incomplete, errors occurred!
See also "C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Ashley/3rdParty/code/ogre/CMakeFiles/CMakeError.log".
Last edited by AshMcConnell on Sun Mar 09, 2014 7:49 pm, edited 1 time in total.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: CMake not detecting VS 2012 / VS 2013 (on Win 8.1)

Post by Wolfmanfx »

Are you able to install VS to the c drive?
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: CMake not detecting VS 2012 / VS 2013 (on Win 8.1)

Post by AshMcConnell »

Wolfmanfx wrote:Are you able to install VS to the c drive?
I installed VS 2013 on the C drive, but my 2012 installation is currently on the G drive

I can try with VS 2012 on the c drive, but I'm not sure that is the problem in this case as both errors are similar.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by AshMcConnell »

*UPDATE* I tried on my laptop (MBP Windows 8.0) and it worked pretty much straight away. I'll try and figure out what is different between the 2 configurations, but I did don't think I did anything different. CMake seems very fragile.

There was some weirdness in picking up the dependencies. I had to put the dependencies in Ogre/OgreDependencies to get them picked up, but when I went to compile it was looking in Ogre/Dependencies (and failed), when I went back and ran CMake with the deps in Ogre/Dependencies it worked (and also compiled).
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by c6burns »

I've never known CMake to be very fragile but its worth understanding as much about it as you can. I've never known an easier way to build the same project for multiple target platforms from a common source.

The best way to link ogredeps is to have them in the proper folder structure in <ogre src dir>/Dependencies ... otherwise you have to set CMake vars to indicate their location.
dunderwood
Gnoblar
Posts: 7
Joined: Mon Feb 10, 2014 11:50 pm
Location: Raleigh, NC

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by dunderwood »

My best guess is that you install some sort of Windows SDK that messed with the location of 'kernel32.lib'.

Can you compile C++ applications in Visual Studio normally? If not, check the options for the compiler under Tools -> Options -> Visual C++ Compiler (I think).
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by AshMcConnell »

c6burns wrote:I've never known CMake to be very fragile but its worth understanding as much about it as you can. I've never known an easier way to build the same project for multiple target platforms from a common source.

The best way to link ogredeps is to have them in the proper folder structure in <ogre src dir>/Dependencies ... otherwise you have to set CMake vars to indicate their location.
Hi c6burns, I know, just getting frustrated :). I did originally have OgreDeps in the proper folder structure (<ogre src dir>/Dependencies) but it didn't get picked up until I put it in <ogre src dir>/OgreDependencies), then I put it back to <ogre src dir>/Dependencies and it also worked (but only after running it with <ogre src dir>/OgreDependencies)....I don't get why, that's what was strange.
dunderwood wrote:My best guess is that you install some sort of Windows SDK that messed with the location of 'kernel32.lib'.

Can you compile C++ applications in Visual Studio normally? If not, check the options for the compiler under Tools -> Options -> Visual C++ Compiler (I think).
Yeah, it *must* be something to do with the Windows SDK, but Visual Studio runs absolutely fine (and has done for a couple of years) through the IDE. I'll check for differences between the laptop and the desktop.

Thanks for your help!
buz11
Gnoblar
Posts: 2
Joined: Wed Apr 23, 2014 7:51 pm

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by buz11 »

Hi, I'm not an Ogre user (yet!) but ran into this problem recently, and found that the issue was that CMAKE currently depends on Windows SDK 8.0, or else it fails to build the test vcxproj it generates to determine compiler features. We encountered this on a clean install of Windows 7 with the Visual Studio Update 4, which installs the 8.1 SDK but not the 8.0 SDK. Installing the 8.0 SDK fixes the problem but CMAKE should be more robust.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by AshMcConnell »

buz11 wrote:Hi, I'm not an Ogre user (yet!) but ran into this problem recently, and found that the issue was that CMAKE currently depends on Windows SDK 8.0, or else it fails to build the test vcxproj it generates to determine compiler features. We encountered this on a clean install of Windows 7 with the Visual Studio Update 4, which installs the 8.1 SDK but not the 8.0 SDK. Installing the 8.0 SDK fixes the problem but CMAKE should be more robust.
Thanks for registering to help me, but unfortunately it didn't work for me. I have 7.0A/7.1A/8.0/8.0A/8.1/8.1A all installed (I've tried a lot of things!). Not sure why it won't detect it :-S. I've resorted to compiling it on my laptop, which is a bit awkward.

Thanks again for your help
Ash
buz11
Gnoblar
Posts: 2
Joined: Wed Apr 23, 2014 7:51 pm

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by buz11 »

That's unfortunate! This happened to us after a full install of Visual Studio 12 and Update 4 on Windows 7, which seemed to only install 8.1. We tracked it down to msbuild failing from inside cmake because of undefined environment variables, which were only defined after we installed 8.0. This happened on two machines, but the fishy thing was that the web deploy component failed during the VS 2012 install and may have led to an incomplete (rather than missing) installation of 8.0. Hope you get to the root of it.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by AshMcConnell »

Hmm, just checked the Uninstall control panel and there is only Windows SDK for Windows 7 (7.0) in there. Perhaps the others haven't installed correctly. Tried to run the 8.0 SDK, but it said it already was installed :-S
Softstar
Gnoblar
Posts: 13
Joined: Tue Oct 01, 2013 4:56 am

Re: CMake not detecting VS 2012 / VS 2013 properly (on Win 8

Post by Softstar »

the key is that the boost can't work with VS2013, as a resualt, I was fault in compling Ogre 1.9 with VS2013 Express
Post Reply