I try to build a CMake (v3.14) project with MSVC 2015. I use the CMake GUI to generate the makefile but when I hit the "Configure" button, I get the following error:
The C compiler identification is MSVC 19.0.24210.0
The CXX compiler identification is MSVC 19.0.24210.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Projets/geolibextern/build_msvc/CMakeFiles/CMakeTmp
Run Build Command(s):nmake /nologo cmTC_fa317\fast
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\cmTC_fa317.dir\build.make /nologo -L CMakeFiles\cmTC_fa317.dir\build
Building C object CMakeFiles/cmTC_fa317.dir/testCCompiler.c.obj
C:\PROGRA~2\MICROS~2.0\VC\bin\amd64\cl.exe #C:\Users\egrace\AppData\Local\Temp\nm88C7.tmp
testCCompiler.c
Linking C executable cmTC_fa317.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_fa317.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~2.0\VC\bin\amd64\link.exe /nologo #CMakeFiles\cmTC_fa317.dir\objects1.rsp #C:\Users\egrace\AppData\Local\Temp\nm8993.tmp
RC Pass 1: command "rc /foCMakeFiles\cmTC_fa317.dir/manifest.res CMakeFiles\cmTC_fa317.dir/manifest.rc" failed (exit code 0) with the following output:
Le fichier sp‚cifi‚ est introuvableNMAKE : 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 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
I also tried (unsuccessfully) to reinstall the Visual C++ build tools or to use a more recent version of CMake.
Indeed, CMake couldn't find the program mt.exe because the Windows SDK folder wasn't in the PATH variable. To solve this problem, I need to execute this command with these arguments:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 8.1
Related
I've been trying to build some code using CMake via PowerShell(administrator).
I've run Microsoft Visual Studio 10.0\VC\vcvarsall.bat for setting environment variables.
I also set every environment variable required for this project (for CMake, BUILD_ROOT, etc).
Also, I've windows SDK version 8.0 and 8.1 in the system.
But, when I try to compile, I get a compiler broken error and a 'kernel32.lib' missing error, even though 'kernel32.lib' is there in the windows SDK path.
Can anyone provide me with a possible solution, please?
Attaching the PowerShell Output below:
> PS > C:\project\build-dir> cmake ..
> -DBUILD_CLASSIFIER=Windows-x64-VS100 -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" $env:BUILD_ROOT\3rd_Party\lib-6.5.1
-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe - broken CMake Error at C:/Program
Files/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69
(message): The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/build-dir/CMakeFiles/CMakeTmp
Run Build Command(s):nmake -f Makefile /nologo cmTC_cefcc\fast && "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"
-f CMakeFiles\cmTC_cefcc.dir\build.make /nologo -L CMakeFiles\cmTC_cefcc.dir\bu ild
Building C object CMakeFiles/cmTC_cefcc.dir/testCCompiler.c.obj
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_cefcc.dir\testCCom
piler.c.obj.d
--working-dir=C:\GITWS\CP.24.0_dev_New\print_server\CMService\colorToolKit\ctk-build\CMakeFiles\CMakeTmp -
-filter-prefix="Note: including file: " -- C:\PROGRA~2\MICROS~4.0\VC\bin\cl.exe
#C:\Users\ADMINI~1.XER\AppData\Local\Tem p\nm8FBD.tmp
testCCompiler.c
Linking C executable cmTC_cefcc.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_cefcc.dir --rc=C:\PROGRA~2\MICROS ~1\Windows\v7.0A\Bin\RC.Exe
--mt=C:\PROGRA~2\MICROS~1\Windows\v7.0A\Bin\mt.exe --manifests -- C:\PROGRA~2\MICROS~4.0\VC\ bin\link.exe /nologo
#CMakeFiles\cmTC_cefcc.dir\objects1.rsp
#C:\Users\ADMINI~1.XER\AppData\Local\Temp\nm904A.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~4.0\VC\bin\link.exe /nologo #CMakeFiles\cmTC_cefcc.dir\objects1.rsp /out:cm TC_cefcc.exe
/implib:cmTC_cefcc.lib
/pdb:C:\GITWS\CP.24.0_dev_New\print_server\CMService\colorToolKit\ctk-build\CMakeFil
es\CMakeTmp\cmTC_cefcc.pdb /version:0.0 /machine:X86 /debug
/INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi3
2.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFi
les\cmTC_cefcc.dir/intermediate.manifest
CMakeFiles\cmTC_cefcc.dir/manifest.res" failed (exit code 1104) with
the follow ing output:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
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 10.0\VC\bin\nmake.exe"' : return code '0 x2'
Stop.
CMake will not be able to correctly generate this project. Call
Stack (most recent call first): CMakeLists.txt:4 (PROJECT)
-- Configuring incomplete, errors occurred! See also "C:/project/build-dir/CMakeFiles/CMakeOutput.log". See also
"C:/project/build-dir/CMakeFiles/CMakeError.log".
First I make nmake work:
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29812\bin\Hostx64\x86
then I git clone https://github.com/curl/curl.git --depth=1
Then I run buildconf.bat all seems fine.
then I go to winbuild and run nmake /f Makefile.vc mode=static and the build fails with the following error:
configuration name: libcurl-vc-x64-release-static-ipv6-sspi-schannel
cl /O2 /DNDEBUG /MD /DCURL_STATICLIB /I. /I ../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL /DUSE_WIN32_IDN /DWANT_IDN_PROTOTYPES /DUSE_IPV6 /DUSE_WINDOWS_SSPI /DUSE_SCHANNEL /Fo"..\builds\libcurl-vc-x64-release-static-ipv6-sspi-schannel-obj-lib/altsvc.obj" ..\lib\altsvc.c
altsvc.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\windows.h(167): fatal error C1083: Cannot open include file: 'excpt.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29812\bin\Hostx64\x86\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29812\bin\Hostx64\x86\nmake.exe"' : return code '0x2'
Stop.
Is my nmake installed wrong?
If your ultimate goal is to "Get a static library compiled with a local cl compiler", I suggest you try the "vcpkg".
All you have to do is "vcpkg install curl". It will download the source code and compiled locally. :)
I'm trying to build some C++ libraries using cmake using the VS2017 developer command prompt. I need to build them for a Release x64 setup, however, the command prompt only seems to build them to x86.
First, I run this command (note the build type Release64):
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release64 -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../../../install ../..
-- The C compiler identification is MSVC 19.16.27039.0
-- The CXX compiler identification is MSVC 19.16.27039.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
-- 3.13.0.0
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/test_game_server/protobuf/cmake/build/release64
Then I run nmake, but I see this error:
...
[ 49%] Linking CXX static library gmock_main.lib
[ 49%] Built target gmock_main
[ 50%] Generating C:/test_game_server/protobuf/src/google/protobuf/any_test.pb.cc
google/protobuf/any_test.pb.cc: while trying to create directory C:/test_game_server/protobuf/src/google: No error
NMAKE : fatal error U1077: '.\protoc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
This error still occurred even after I used Vcvarsall.bat to set a 64-bit hosted build architecture:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.22
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
It is worth noting that there are no errors when I compile the project with the option Release instead of Release64.
I looked for the x64 native or cross-tool developer command prompts, but I don't have any associated with VS2017 (I do have one for VS2010 but the C++ version is out of date). Compiling in my standard Windows command prompt is not an option.
How can I force this project to compile to x64 instead of x86?
If you do not require using NMake, you could use the Visual Studio's build system by first generating for 64 bit (note the Win64 part):
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release64 -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../../../../install ../..
And then building via cmake's build command:
cmake --build <directory> --config Release64
CMake will then generate and execute whatever command is needed for building using Visual Studio itself on the command line.
You aren't using CMAKE_BUILD_TYPE properly.
https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Unless you have defined a configuration besides the default ones (Debug, Release, RelWithDebInfo, MinSizeRel) what you are doing makes no sense.
Configurations have nothing to do with the architecture you are compiling for.
The architecture you are compiling for has to do with tool-chains and compiler options.
======================================
2nd
NMake Makefiles are ridiculously slow. Use Ninja or Visual Studio instead.
======================================
3rd
Here are instructions for building for x64/x86 using visual studio (I use 2019, but it shouldn't matter)
cmake -G "Visual Studio 16 2019" -A Win32 -S path_to_source -B "build32"
cmake --build build32 --config Release
cmake -G "Visual Studio 16 2019" -A x64 -S path_to_source -B "build64"
cmake --build build64 --config Release
======================================
4th
If you wondering how to configure/build for single configuration generators like ninja/nmake-builds please open up another question. Because it's a loaded question.
I am getting following when I try to build chromium
c:\src\chromium\src>ninja -C out\Default2 chrome
ninja: Entering directory `out\Default2'
[6/28555] CXX obj/base/base_static/pe_image.obj
FAILED: obj/base/base_static/pe_image.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\BIN\amd64/cl.exe" /nologo /showIncludes /FC #obj/base/base_static/pe
_image.obj.rsp /c ../../base/win/pe_image.cc /Foobj/base/base_static/pe_image.ob
j /Fd"obj/base/base_static_cc.pdb"
c:\src\chromium\src\base\win\pe_image.cc(8): fatal error C1083: Cannot open incl
ude file: 'stddef.h': No such file or directory
[7/28555] CXX obj/base/base_paths/base_paths.obj
FAILED: obj/base/base_paths/base_paths.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\BIN\amd64/cl.exe" /nologo /showIncludes /FC #obj/base/base_paths/bas
e_paths.obj.rsp /c ../../base/base_paths.cc /Foobj/base/base_paths/base_paths.ob
j /Fd"obj/base/base_paths_cc.pdb"
c:\src\chromium\src\base\files\file_path.h(105): fatal error C1083: Cannot open
include file: 'stddef.h': No such file or directory
[8/28555] CXX obj/base/base_paths/base_paths_win.obj
FAILED: obj/base/base_paths/base_paths_win.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\BIN\amd64/cl.exe" /nologo /showIncludes /FC #obj/base/base_paths/bas
e_paths_win.obj.rsp /c ../../base/base_paths_win.cc /Foobj/base/base_paths/base_
paths_win.obj /Fd"obj/base/base_paths_cc.pdb"
c:\program files (x86)\windows kits\10\include\10.0.10586.0\um\winnt.h(34): fata
l error C1083: Cannot open include file: 'ctype.h': No such file or directory
[11/28555] ACTION //base:build_date(//build/toolchain/win:x64)
ninja: build stopped: subcommand failed.
This is my first time building chroium,
I have visual studio 2015 community edition installed with Windows SDK , and also installed WDK seperately without which "gn gen out/Default2" was not working
Any idea what this issue could be
1.Your build errors:
c:\src\chromium\src\base\win\pe_image.cc(8): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
c:\src\chromium\src\base\files\file_path.h(105): fatal error C1083: Cannot openinclude file: 'stddef.h': No such file or directory
c:\program files (x86)\windows kits\10\include\10.0.10586.0\um\winnt.h(34): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
2.You may need to check the header files which caused the build errors:
The headers, sources, and libraries are now distributed as part of a separate Universal CRT SDK.
Excerpt from the above:
Visual C++ SDK. The headers, sources, and libraries are now distributed as part of a separate Universal CRT SDK. This SDK is included with Visual Studio; it is installed by default to C:\Program Files (x86)\Windows Kits\10. The debug ucrtbased.dll is also included as part of this SDK and is installed to the system directory.
3.You can also try to reference the following links, it's the same issue with yours:
I am trying to compile libffm on my windows 10 machine:
https://github.com/guestwalk/libffm
I have Visual Studio Express 2013 installed and am using the VS2013 x64 Cross Tools Command Prompt to try and compile the package.
e:\libffm\nmake -f Makefile.win clean all
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
erase /Q *.obj *.exe windows\.
rd windows
mkdir windows
cl.exe /nologo /O2 /EHsc /D "_CRT_SECURE_NO_DEPRECATE" /D "USEOMP" /openmp -c ffm.cpp
ffm.cpp
ffm.cpp(1) : warning C4068: unknown pragma
cl.exe /nologo /O2 /EHsc /D "_CRT_SECURE_NO_DEPRECATE" /D "USEOMP" /openmp ffm-train.cpp ffm.obj -Fewindows\ffm-train.exe
ffm-train.cpp
ffm-train.cpp(1) : warning C4068: unknown pragma
LINK : fatal error LNK1104: cannot open file 'libcpmt.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64\cl.exe"' : return code '0x2'
Stop.
I read that it maybe issues with my environment variables so have reinstalled the tools for C++ for VS2013 Express.
When I check the path variables I get:
echo %LIB%
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64;
echo %LIBPATH%
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;
any ideas what to try next?