3.2.0 with Visual Studio 2017 C++ - installation problem with cmake

1,218 views
Skip to first unread message

Karsten Saunte

unread,
Apr 10, 2017, 10:11:12 AM4/10/17
to Protocol Buffers
Hi

New to protocol buffers, downloaded 3.2.0 and followed the guide in cmake/README.md

It fails at this step

*****
To start using a *Release* configuration:

     C:\Path\to\protobuf\cmake\build>mkdir release & cd release
     C:\Path\to\protobuf\cmake\build\release>cmake -G "NMake Makefiles" ^
     -DCMAKE_BUILD_TYPE=Release ^
     -DCMAKE_INSTALL_PREFIX=../../../../install ^
     ../..
*****
with the following error
********************************************************************************************************************************************************
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual
  Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe" is
  not able to compile a simple test program.

  It fails with the following output:

   Change Dir: M:/SandBox/proto/cpp/protobuf-3.2.0/cmake/build/release/CMakeFiles/CMakeTmp



  Run Build Command:"nmake" "/NOLOGO" "cmTC_e9028\fast"

        "c:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\nmake.exe"
  -f CMakeFiles\cmTC_e9028.dir\build.make /nologo -L
  CMakeFiles\cmTC_e9028.dir\build

  Building C object CMakeFiles/cmTC_e9028.dir/testCCompiler.c.obj


        C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1410~1.250\bin\HostX86\x86\cl.exe
  @C:\Users\Karsten\AppData\Local\Temp\nmEF9D.tmp

  testCCompiler.c

  Linking C executable cmTC_e9028.exe

        "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe
  --intdir=CMakeFiles\cmTC_e9028.dir --manifests --
  C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1410~1.250\bin\HostX86\x86\link.exe
  /nologo @CMakeFiles\cmTC_e9028.dir\objects1.rsp
  @C:\Users\Karsten\AppData\Local\Temp\nmF0D7.tmp

  RC Pass 1 failed to run.

  NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' :
  return code '0xffffffff'

  Stop.

  NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
  Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\nmake.exe"'
  : return code '0x2'

  Stop.
********************************************************************************************************************************************************

I'm really an IDE user - so not that familiar with cmake and nmake - I can't find the exact spot where it fails - i managed to extract a few parts here and there to compile and link testCCompiler.c.exe

Any clues?



Feng Xiao

unread,
Apr 10, 2017, 1:45:13 PM4/10/17
to Karsten Saunte, Protocol Buffers
Can you try "cmake --help"? It should print a list of Visual Compilers it supports. If VS 2017 is on the supported list, just invoke cmake with:
cmake -G "Visual Studio [VERSION_NUMBER]" ../..

and it should generate a protobuf.sln file that you can open with VS 2017.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Karsten Saunte

unread,
Apr 11, 2017, 7:11:43 AM4/11/17
to Protocol Buffers, kar...@saunte.com
Hi Feng

 "Visual Studio 15 2017" is supported.

The above command line refers to "NMake makefiles" not visual studio.

Anyway tried your suggestion with -G "Visual Studio 15 2017"

This fails with "-- The C compiler identification is unknown" (which worked with the "NMake makefiles" profile") - and this is due to a linker error (CMake Error log file)
  >> LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [M:\SandBox\proto\cpp\protobuf-3.2.0\cmake\build\solution\CMakeFiles\3.8.0-rc4\CompilerIdC\CompilerIdC.vcxproj]

Tried to fix the issue by adding c:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64\ to LIBPATH but didn't solv the issue.




To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.

Feng Xiao

unread,
Apr 11, 2017, 2:49:58 PM4/11/17
to Karsten Saunte, Protocol Buffers
On Tue, Apr 11, 2017 at 4:11 AM, Karsten Saunte <kar...@saunte.com> wrote:
Hi Feng

 "Visual Studio 15 2017" is supported.

The above command line refers to "NMake makefiles" not visual studio.

Anyway tried your suggestion with -G "Visual Studio 15 2017"

This fails with "-- The C compiler identification is unknown" (which worked with the "NMake makefiles" profile") - and this is due to a linker error (CMake Error log file)
  >> LINK : fatal error LNK1181: cannot open input file 'gdi32.lib' [M:\SandBox\proto\cpp\protobuf-3.2.0\cmake\build\solution\CMakeFiles\3.8.0-rc4\CompilerIdC\CompilerIdC.vcxproj]

Tried to fix the issue by adding c:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64\ to LIBPATH but didn't solv the issue.
It seems to me an installation problem with visual studio. 

Some people say it can be fixed by reinstall visual studio. Can you give it a try? Alternatively, can you try with a different version of visual studio?
 
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages