Getting an error building static libcurl VS2019 - c++

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. :)

Related

How to build a CMake project with MSVC 2015?

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

ProtocolBuffer C++ Visual Studio 2019

I am trying to build Protocolbuffer for Visual Studio 2019 x86,
I followed the steps in this page
https://github.com/protocolbuffers/protobuf/blob/main/cmake/README.md
for release I tried:
cmake -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_GENERATOR_PLATFORM=Win32 ^
-DCMAKE_INSTALL_PREFIX=C:\protocolbuffers\install ^
C:\protocolbuffers\protobuf
I have the error
CMake Error at CMakeLists.txt:24 (project): Generator
NMake Makefiles
does not support platform specification, but platform
Win32
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake
Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
if I removed the -DCMAKE_GENERATOR_PLATFORM=Win32 ^ I can create the correct files but when I compile the error is
protocolbuffers\protobuf\src\google\protobuf\extension_set_unittest.cc(871):
note: see reference to function template instantiation 'int
google::protobuf::internal::RepeatedFieldLowerClampLimit<int64_t,4>(void)'
being compiled NMAKE : fatal error U1077: '"C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"'
: return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program
Files (x86)\Microsoft Visual
Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"'
: return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program
Files (x86)\Microsoft Visual
Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"'
: return code '0x2' Stop.
I need to create the lib files for:
libprotobuf.lib, libprotobuf-lite.lib, libprotoc.lib
and
protoc.exe

NMAKE : fatal error U1077: return code '0x2'

I am trying to build libsvm binary for Windows. But nmake returns an error code.
C:\Users\user\Desktop\libsvm-3.23>nmake -f Makefile.win clean all
Microsoft (R) Program Maintenance Utility Version 14.14.26433.0
Copyright (C) Microsoft Corporation. All rights reserved.
erase /Q *.obj windows\*.exe windows\*.dll windows\*.exp windows\*.lib
Could Not Find C:\Users\user\Desktop\libsvm-3.23\*.obj
Could Not Find C:\Users\user\Desktop\libsvm-3.23\windows\*.exe
cl.exe /nologo /O2 /EHsc /I. /D _WIN64 /D _CRT_SECURE_NO_DEPRECATE -c sv
m.cpp
svm.cpp
C:\Program Files (x86)\Microsoft VisualStudio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\include\vcruntime.h(180): error C2371: 'size_t': redefinition;different basic types
predefined C++ types (compiler internal)(16): note: see declaration of 'size_t'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe"' : return code '0x2'
Stop.
C:\Users\user\Desktop\libsvm-3.23>
What is the wrong with this?

getting No such file or directory when I try to build chromium

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:

compiling C++ in windows cannot open file 'libcpmt.lib'

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?