ProtocolBuffer C++ Visual Studio 2019 - c++

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

Related

'PERL_EXECUTABLE-NOTFOUND' is not recognized as an internal or external command, operable program or batch file

While trying to compile amazon-kinesis-video-streams-producer-sdk-cpp-repo I am getting an error 'PERL_EXECUTABLE-NOTFOUND' is not recognized as an internal or external command, operable program or batch file. I find this error strange and cannot find any solution online. I have installed ActivePerl and I am using Windows 10. I have added the following paths(where ActivePerl is installed) to environment variables also:
C:\Users\amay\AppData\Local\activestate\bin
C:\Users\amay\AppData\Local\activestate\bin\perl.exe
C:\Users\amay\AppData\Roaming\ActiveState\bin
If I run perl -v on cmd it works fine so I am assuming the paths are not the issue here. I am running this command: cmake .. -G "NMake Makefiles" -DBUILD_GSTREAMER_PLUGIN=ON on x64 Native Tools Command Prompt VS 2017.
Here is the error:
[ 67%] Linking C executable lib1518.exe
[ 67%] Built target lib1518
Scanning dependencies of target lib1520
[ 67%] Building C object tests/libtest/CMakeFiles/lib1520.dir/lib1520.c.obj
cl : Command line warning D9025 : overriding '/MDd' with '/MTd'
lib1520.c
[ 67%] Building C object tests/libtest/CMakeFiles/lib1520.dir/first.c.obj
cl : Command line warning D9025 : overriding '/MDd' with '/MTd'
first.c
[ 67%] Linking C executable lib1520.exe
[ 67%] Built target lib1520
[ 67%] Generating lib1521.c
'PERL_EXECUTABLE-NOTFOUND' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'PERL_EXECUTABLE-NOTFOUND' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\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\HostX64\x64\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\HostX64\x64\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\HostX64\x64\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\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
CMake Error at dependency/libkvscproducer/kvscproducer-src/CMake/Utilities.cmake:93 (message):
CMake step for libcurl failed: 2
Call Stack (most recent call first):
dependency/libkvscproducer/kvscproducer-src/CMakeLists.txt:86 (build_dependency)
-- Configuring incomplete, errors occurred!
See also "C:/Users/amay/amazon-kinesis-video-streams-producer-sdk-cpp/build/CMakeFiles/CMakeOutput.log".

Getting an error building static libcurl VS2019

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

Trying to setup Qt: 'x64' conflicts with target machine type 'x86' while running nmake

I am trying to set up Qt4 on my 64bit Windows 10 environment. I have successfully ran the configure script, however when I try to run nmake I get the following error:
link /LIBPATH:"c:\Qt\4.8.5\src\tools\bootstrap\release" /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /OUT:..\..\..\bin\moc.exe #C:\Users\Evan\AppData\Local\Temp\nm1BD8.tmp
release\main.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x458'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
I know the problem is the conflict of the two system types (x64/x86) But I don't know how to get passed this problem.
All I'm trying to do is run nmake in a command line. I have ran vcvarsall before nmake as well in the Visual Studio 14 folder. Any ideas?

NMAKE : fatal error U1077: 'cd' :return code '0x2' cl.exe

I'm trying to compile QCAD (an open source CAD application which relies on Qt) from the source so I can build it for msvs2008. I've been following the instructions given here: http://www.qcad.org/en/component/content/article/78-qcad/111-qcad-compilation-from-sources.
I've managed to successfully configure and compile Qt 4.8.5 and I set my environment variable PATH. I created a new environment variable QMAKESPEC and set the value to win-32-msvc2008. I completed the configuration of QCAD without any problems. However, about 30 min into the compilation I've run into the following error: NMAKE : fatal error U1077: 'cd' :return code '0x2'. I've seen similar errors reported for the compilation of Qt, however, I had no problem there. Is there anyone who has any idea what may be wrong? Thanks in advance.
Generating Code...
c:\qcad\src\3rdparty\qt-labs-qtscriptgenerator-4.8.5\generated_cpp\com_trolltech_qt_webkit\qtscriptshell_qwebpluginfactory.cpp(58)
: warning C4715: 'QtScriptShell_QWebPluginFactory::create' : not all control paths return a value
c:\qcad\src\3rdparty\qt-labs-qtscriptgenerator-4.8.5\generated_cpp\com_trolltech_qt_webkit\qtscriptshell_qwebpluginfactory.cpp(128)
: warning C4715: 'QtScriptShell_QWebPluginFactory::plugins' : not all control paths return a value
c:\qcad\src\3rdparty\qt-labs-qtscriptgenerator-4.8.5\generated_cpp\com_trolltech_qt_webkit\qtscriptshell_qwebhistoryinterface.cpp(105)
: warning C4715: 'QtScriptShell_QWebHistoryInterface::historyContains' : not all control paths return a value
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.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.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
C:\qcad>
It took a while but I've solved the problem. The file QtScriptShell_QWebPluginFactory.cpp contained a couple of lines decalring empty arrays:
static const QWebPluginFactory::Extension qtscript_QWebPluginFactory_Extension_values[] = {};
static const char * const qtscript_QWebPluginFactory_Extension_keys[] = {};
Though this is acceptable for C99, the Visual Studio C++ compiler won't accept empty arrays. So I simply added a non-zero size and the error disappeared.
static const QWebPluginFactory::Extension qtscript_QWebPluginFactory_Extension_values[1];
static const char * const qtscript_QWebPluginFactory_Extension_keys[1];

Static build of Qt 5.1.1 on windows 7 - nmake and cl error

I'm trying to build a static version of Qt 5.1.1 on Windows, but eventually receive a bunch of errors from nmake.
Following that topic - standalone exe in Qt I did the following:
Downloaded Qt source code (http://download.qt-project.org/official_releases/qt/5.1/5.1.1/single/qt-everywhere-opensource-src-5.1.1.zip)
Configured executing the following: configure.bat -static -release -no-audio-backend -opengl desktop -opensource -confirm-license
Ran nmake from MS Visual Studio command line.
The compilation process runs for some while, and eventually throws the following:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(325) : err
or C2556: 'bool signbit(double)' : overloaded function differs only by return ty
pe from 'int signbit(double)'
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\win32-math.h(59) : see declaration of 'signbit'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(325) : err
or C2371: 'signbit' : redefinition; different basic types
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\platform.h(74) : see declaration of 'lrint'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(506) : err
or C2371: 'lrint' : redefinition; different basic types
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\platform.h(74) : see declaration of 'lrint'
snapshot-empty.cc
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(325) : err
or C2556: 'bool signbit(double)' : overloaded function differs only by return ty
pe from 'int signbit(double)'
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\win32-math.h(59) : see declaration of 'signbit'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(325) : err
or C2371: 'signbit' : redefinition; different basic types
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\win32-math.h(59) : see declaration of 'signbit'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(506) : err
or C2556: 'long lrint(double)' : overloaded function differs only by return type
from 'int lrint(double)'
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\platform.h(74) : see declaration of 'lrint'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(506) : err
or C2371: 'lrint' : redefinition; different basic types
c:\qt\qt-everywhere-opensource-src-5.1.1\qtjsbackend\src\3rdparty\v8\src
\platform.h(74) : see declaration of 'lrint'
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.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.
Has anyone met such case? I'm not sure why it's complaining about the Qt sources.
Thanks!
Solved. I was building it with VS 2013, which actually doesn't support V8 module properly, so I got to use VS 2012, that worked fine with the following configuration: configure.bat -static -release -no-audio-backend -opengl desktop -opensource -nomake examples -confirm-license