awslabs / aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Apache License 2.0
73 stars 62 forks source link

Compilation failure in Windows 10 using Visual studio 2019 #471

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello,

I compiled the Medical Imaging API thus have to compile the CRT repository as part of the AWS C++ Sdk.

I've hit a few compilation errors because of wrong Windows header includes:

pki_utils.h:

#ifdef _WIN32
/* It's ok to include external headers because this is a PRIVATE header file
 * (it is usually a crime to include windows.h from header file) */
#    include <Windows.h>
#    include <schannel.h>

_WIN32 is defined as WIN32_ Resharper also suggested to include schannel.h. Without it, it doesn't compile.

iocp_event_loop.c

Order of includes:

#include <Windows.h>
#include <schannel.h>

Flags I'm using:

Thank you.

graebm commented 1 year ago

We haven't seen this issue before.

Please share the exact cmake configure command, and the exact build command you are using

The recommended way to build the AWS C++ SDK is documented in their README. This builds aws-crt-cpp as a side-effect.

ghost commented 1 year ago

I'm using CMake gui, the command inside:

Commandline options:
-DAWS_SUPPORT_WIN7:BOOL="0" -DUSE_OPENSSL:BOOL="1" -DSANITIZERS:STRING="address;undefined" -DCMAKE_INSTALL_PREFIX:PATH="C:/Program Files (x86)/aws-crt-cpp" -DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release;MinSizeRel;RelWithDebInfo" -DWINDOWS_KERNEL_LIB:STRING="Kernel32" 

Cache file:
AWS_SUPPORT_WIN7:BOOL=0
USE_OPENSSL:BOOL=1
SANITIZERS:STRING=address;undefined
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/aws-crt-cpp
CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release;MinSizeRel;RelWithDebInfo
WINDOWS_KERNEL_LIB:STRING=Kernel32

Building via Microsoft Visual Studio Professional 2019 Version 16.11.22

Compile flags:

/MP /ifcOutput "aws-c-io.dir\Release\" /GS /W4 /wd"4204" /wd"4221" /Zc:wchar_t /I"D:\Ilya\Code\Sources\Amazon\aws-sdk-cpp\crt\aws-crt-cpp\crt\aws-c-io\include" /I"D:\Ilya\Code\Sources\Amazon\aws-sdk-cpp\crt\aws-crt-cpp\crt\aws-c-common\include" /I"D:\Ilya\Code\Sources\Amazon\aws-sdk-cpp\crt\aws-crt-cpp\sdk_build\crt\aws-c-common\generated\include" /I"D:\Ilya\Code\Sources\Amazon\aws-sdk-cpp\crt\aws-crt-cpp\crt\aws-c-cal\include" /Gm- /O2 /Ob2 /Fd"D:\Ilya\Code\Sources\Amazon\aws-sdk-cpp\crt\aws-crt-cpp\sdk_build\crt\aws-c-io\Release\aws-c-io.pdb" /Zc:inline /fp:precise /D "_WIN32" /D "_WIN32_WINNT=0x0602" /D "ACE_LACKS_TIME_H" /D "ACE_HAS_POSIX_TIME" /D "_SCL_SECURE_NO_DEPRECATE" /D "_CRT_NON_CONFORMING_WCSTOK" /D "_WINSOCK_DEPRECATED_NO_WARNINGS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_SECURE_SCL=0" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "_SCL_SECURE_NO_WARNINGS" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32_LEAN_AND_MEAN" /D "_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "AWS_USE_IO_COMPLETION_PORTS" /D "CMAKE_INTDIR=\"Release\"" /errorReport:prompt /WX- /Zc:forScope /Gd /MD /Fa"aws-c-io.dir\Release\" /nologo /Fo"aws-c-io.dir\Release\" /Fp"aws-c-io.dir\Release\aws-c-io.pch" /diagnostics:column

Link:

/OUT:"D:\Ilya\Code\Sources\Amazon\aws-sdk-cpp\crt\aws-crt-cpp\sdk_build\crt\aws-c-io\Release\aws-c-io.lib" /MACHINE:X64 /NOLOGO 

Thanks

graebm commented 1 year ago

I cannot reproduce this. I did the following:

and it all built fine

I did the same, but started by cloning the aws-crt-cpp repo, and that also worked fine

ghost commented 1 year ago

Im using Windows Kit 10.0.22000.0 usually located at C:\Program Files (x86)\Windows Kits\10\Include Building Release/Debug on x64 Can you check which Windows.h does it include?

Also not sure how to provide you with but I'm using VS Professional.

Thanks!

graebm commented 1 year ago

I installed Windows Kit 10.0.22000.0. When reconfiguring the project, it selected that kit, and it still builds fine. Can you please attach the full logs of your CMake configure step (delete your build folder and re-configure so that everything gets printed out)? Can you also attach the full logs of your build step? You can attach .txt files by dragging them onto this page.

graebm commented 1 year ago

closing due to inactivity

ghost commented 1 year ago

I installed Windows Kit 10.0.22000.0. When reconfiguring the project, it selected that kit, and it still builds fine. Can you please attach the full logs of your CMake configure step (delete your build folder and re-configure so that everything gets printed out)? Can you also attach the full logs of your build step? You can attach .txt files by dragging them onto this page.

Hi, What SDK are you building?

I'm building this from the Healthlake SDK given by AWS team, To try to see if I did something wrong with the CMake I deleted the whole cache and started over with getting back the updated submodules both for the repository and the inner CRT repository.

It seems it was persistent for me in that case.

Thanks, Ilya.

graebm commented 1 year ago

Can you please attach the full logs of your CMake configure step (delete your build folder and re-configure so that everything gets printed out)? Can you also attach the full logs of your build step? You can attach .txt files by dragging them onto this page