build failure on windows
atitusfwd opened this issue · 3 comments
Following the installation/build instructions on this page:
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/c-language-installation.html
Step 2, option A with SDK:
Using x64 native command prompt, Visual Studio 2017 version. Exact cmake version 3.12.18081601-MSVC_2.
For aws-sdk-cpp, its main branch, commit c90c529d0a
The build fails with the following:
`Determining if the pathconf exist failed with the following output:
Change Dir: C:/Temp/build/build-aws-sdk-cpp/CMakeFiles/CMakeTmp
Run Build Command:"C:/PROGRA2/MIB0551/2017/BUILDT1/Common7/IDE/COMMON1/MICROS~1/CMake/Ninja/ninja.exe" "cmTC_7b312"
[1/2] Building CXX object CMakeFiles\cmTC_7b312.dir\CheckSymbolExists.cxx.obj
FAILED: CMakeFiles/cmTC_7b312.dir/CheckSymbolExists.cxx.obj
C:\PROGRA2\MIB0551\2017\BUILDT1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\cl.exe /nologo /TP /DWIN32 /D_WINDOWS /W4 /GR /EHsc /MP /bigobj /WX /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_7b312.dir\CheckSymbolExists.cxx.obj /FdCMakeFiles\cmTC_7b312.dir\ /FS -c CheckSymbolExists.cxx
CheckSymbolExists.cxx(2): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
ninja: build stopped: subcommand failed.
File C:/Temp/build/build-aws-sdk-cpp/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:
/* */
#include <unistd.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pathconf
return ((int*)(&pathconf))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the umask exist failed with the following output:
Change Dir: C:/Temp/build/build-aws-sdk-cpp/CMakeFiles/CMakeTmp
Run Build Command:"C:/PROGRA2/MIB0551/2017/BUILDT1/Common7/IDE/COMMON1/MICROS~1/CMake/Ninja/ninja.exe" "cmTC_bc6f2"
[1/2] Building CXX object CMakeFiles\cmTC_bc6f2.dir\CheckSymbolExists.cxx.obj
FAILED: CMakeFiles/cmTC_bc6f2.dir/CheckSymbolExists.cxx.obj
C:\PROGRA2\MIB0551\2017\BUILDT1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\cl.exe /nologo /TP /DWIN32 /D_WINDOWS /W4 /GR /EHsc /MP /bigobj /WX /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_bc6f2.dir\CheckSymbolExists.cxx.obj /FdCMakeFiles\cmTC_bc6f2.dir\ /FS -c CheckSymbolExists.cxx
CheckSymbolExists.cxx(8): error C2065: 'umask': undeclared identifier
ninja: build stopped: subcommand failed.
File C:/Temp/build/build-aws-sdk-cpp/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:
/* */
#include <sys/stat.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef umask
return ((int*)(&umask))[argc];
#else
(void)argc;
return 0;
#endif
}`
Up to this point it was working fine. This error suggests the make is expecting linux instead of windows (its looking for unistd.h) but up to this point it seemed to be doing everything the right way for windows. I'm not sure how to debug the build from here, looking for help/suggestions -- thanks!
exact compiler info:
C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
I found the cause of the issue. The documentation page I referenced at the top of this for the encryption sdk, contains instructions for checking out the core c++ sdk, but these instructions omit the --recurse-subprojects option to git clone. I found this as part of the build instructions for the core sdk itself. When I cloned it this way, the build went through with no issue. The encryption sdk instructions should be updated.
Hey atitusfwd, thanks for the feedback. We're actively working on reworking the build instructions for this library (#713), and I think they capture your suggestion. We're now just linking directly to the AWS C++ SDK build instructions, which include the --recurse-submodules
you mentioned. We'll also be updating our public documentation to reflect these changes.
I'm closing this issue, but feel free to re-open or cut another if you have any other issues.
Thanks,
Ben