Cannot compile Tomcat Native Library on Windows 10 - c++

Background -
I'm using Tomcat 9.0.8 as webserver for an Oracle APEX installation. I now need to make Tomcat FIPS-140 compliant. To this end, I'm trying to build the Tomcat Native Library, incorporating a FIPS-compliant OpenSSL. I've been working from these instructions:
https://www.ysofters.com/2017/07/25/building-and-using-fips-capable-openssl-in-apache-tomcat/
There are "official" Tomcat Native build instructions from Apache, but they require the use of Mladen's Custom Microsoft Compiler Toolkit Compilation, which AFAIK can't be built on Windows 10.
The build steps were as follows:
Build the OpenSSL FIPS Object Module
Build the FIPS capable OpenSSL
Build Apache Portable Runtime
Build Tomcat Native library
The last step is what failed, hence my question today.
Build Configuration -
Windows 10 SDK (10.0.19041.0)
Visual Studio Community 2019 Version 16.9.6
Build Errors -
According to the build docs, I needed to run the following nmake command:
nmake -f NMAKEMakefile WITH_APR=E:\native_build\deps\apr WITH_OPENSSL=E:\native_build\deps\openssl APR_DECLARE_STATIC=1 ENABLE_OCSP=1 WITH_FIPS=1
E:\native_build\deps contains compiled versions of Apache Portable Runtime and OpenSSL, built in the previous steps.
That nmake command results in these errors:
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2146: syntax error: missing ')' before identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2081: 'FILE_INFO_BY_HANDLE_CLASS': name in formal parameter list illegal
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2061: syntax error: identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2059: syntax error: ';'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2059: syntax error: ','
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1108): error C2059: syntax error: ')'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2146: syntax error: missing ')' before identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2081: 'FILE_INFO_BY_HANDLE_CLASS': name in formal parameter list illegal
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2061: syntax error: identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2059: syntax error: ';'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2059: syntax error: ','
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9121): error C2059: syntax error: ')'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.EXE"' : return code '0x2'
I haven't been able to locate a solution to this, or even another instance of the problem, so hoping you folks have some insights.

Related

Libtorch operator/syntax errors in Visual Studio

Hi recently I’ve installed Libtorch and I was able to use it in my new Visual Studio project without a problem. Currently I am trying to use Libtorch in an existing CUDA project. But I am having these strange errors when I include torch header and I couldn’t find any solution in the internet regarding to my problem. Does anyone have any idea what might be the cause of these errors?
Severity Code Description Project File Line Suppression State
Error C2833 'operator {' is not a recognized operator or type DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2059 syntax error: 'newline' DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2238 unexpected token(s) preceding ';' DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2143 syntax error: missing ';' before 'const' DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2833 'operator {' is not a recognized operator or type DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Error C2059 syntax error: 'newline' DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Error C2238 unexpected token(s) preceding ';' DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Error C2143 syntax error: missing ';' before 'const' DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Environment
Windows 10
CUDA 10.1
Visual Studio 2017
C++14
Thanks to #john I have realized that there was a macro in another library which has the same name as a typename in Libtorch library(which was a macro called V in my case), that’s why it was confused in compilation. I am sticking to this solution for now.
warning C4003: not enough actual parameters for macro 'max' - Visual Studio 2010 C++

OpenSSL - rsa.h error C2143: syntax error : missing ')' before 'constant'

I need to add SSL capability to an existing C++ socket client application. I've downloaded and installed OpenSSL, and the appropriate libs and includes are in my Visual Studio folder. Forgive the age of the dev environment (VC++ 6.0) but it's a legacy project, and only runs on Windows XP.
After adding this line:
// OpenSSL implementation for secure socket
#include <openssl/ssl.h>
To one of my header files, I now get this compile error:
c:\program files\microsoft visual studio\vc98\include\openssl\rsa.h(410) : error C2143: syntax error : missing ')' before 'constant'
c:\program files\microsoft visual studio\vc98\include\openssl\rsa.h(410) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft visual studio\vc98\include\openssl\rsa.h(410) : fatal error C1004: unexpected end of file found
The line of the file causing the error is in rsa.h
int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
const EVP_MD *Hash, const unsigned char *EM, int sLen);
Any ideas what could be causing this error?
Thanks

Winbase.h doesn't support in creating DLL file

I would like to create a project use to call c++ method using c#. So, I need to create a dll file for all of my c++ function. But when i get an error in y sqlite source code such as "AreFileApisASNSI undeclared identifier". So, i import winbase.h which is part of the mingw-w64 runtime package to my visual studio 2012 express DLL project. After import the file, I get many errors such as below:-
error c4430: missing type specifier - int assumed. Note: C++ does not support default - int
error C2143: syntax error : missing ';' before '_stdcall'
error c1003 error count exceeds 100; stopping compilation
error c2061: syntax error: identifier ' WINBOOL'
error c2086: 'int_CRT_INLINE' : redefinition
error c2143: syntax error: missing ';' before ''
error C2146: syntax error : missing ';' before identifier 'LONGLONG'
error C2146: syntax error : missing ';' before identifier 'PVOID'
any solution for those error? please help!!
The documentation for the function has this header requirement:
WinBase.h (include Windows.h)
This is telling you that the function is declared in WinBase.h, but that you should include Windows.h which in turn will include WinBase.h. So, you need to change your include to
#include <Windows.h>
I also wonder why you are talking about mingw considering that your compiler is MSVC. That compiler ships with a comprehensive Windows SDK. Why would you be using an SDK from mingw?

error C2061: syntax error : identifier 'WTTMetadataDefinition' in WTTLogger.h Microsoft header file

I'm using the WTTLogger (downloaded from WLK- windows logo kit) in my c++ application. I don't get any compilation/linker errors with an older version of wtt library WTTLog.DLL/lib and WTTlogger.h header file.
But with a latest version of the header file and library , I'm getting the following error in the header file
This is a Microsoft given header file and I'm not able to understand this error in the microsoft given header file. Any inputs would be greatly appreciated.
::
error C2061: syntax error : identifier 'WTTMetadataDefinition'
error C2061: syntax error : identifier 'WTTMetadataReference'
error C2061: syntax error : identifier 'WTTMetadataDefinition'
error C2061: syntax error : identifier 'WTTMetadataReference'

Ms Sitelock 1.15 and VS 2005

I'm trying to implement the MS Sitelock template into one of my Active-X Controls. I've downloaded the sitelock 1.15 sdk and I'm stuck on the very first step.
Including the sitelock.h header file causes a bunch of compile errors that have to do with the sal.h header file. It looks to me like sitelock.h wants to use attribute sal but that sal.h is only defining declspec sal. I'm using VS 2005, but the sitelock 1.5 documentation says that vs 2005 is supported. Is there something I need to do to reference attribute sal? I do have the Vista platform sdk installed. I'm including the sitelock.h in the header file of my active-x object. Perhaps that's not the place to do it?
See compile errors below:
....\public\sitelock.h(308) : error C2061: syntax error : identifier '_In_opt_count_'
..\..\public\sitelock.h(605) : see reference to class template instantiation 'CSiteLock<T>' being compiled
\public\sitelock.h(308) : error C2059: syntax error : ')'
...\public\sitelock.h(310) : error C2143: syntax error : missing ')' before '{'
...\public\sitelock.h(401) : error C2061: syntax error : identifier '_In_z_'
..\public\sitelock.h(401) : error C2059: syntax error : ')'
..\public\sitelock.h(402) : error C2143: syntax error : missing ')' before '{'
C2061: syntax error : identifier '_Inout_z_count_'
....\public\sitelock.h(451) : error C2059: syntax error : ')'
...\public\sitelock.h(452) : error C2143: syntax error : missing ')' before '{'
..\public\sitelock.h(520) : error C2061: syntax error : identifier '_In_z_'
..\public\sitelock.h(520) : error C2059: syntax error : ')'
...\public\sitelock.h(521) : error C2143: syntax error : missing ')' before '{'
...\public\sitelock.h(555) : error C2061: syntax error : identifier '_In_z_'
New SAL.H is included in the Windows server 2008 SDK, not the Vista one.
I'm still using the Vista SDK and have gotten by my compiler errors by translating the attribute sal macros to declspec sal macros in sitelock.h.
Used the notes in the following url to do the translation:
http://blogs.msdn.com/sdl/archive/2009/06/11/a-declspec-sal-to-attribute-sal-rosetta-stone.aspx