When I try to build my app, which depends on openssl3, with conan, I get the following error while conan is trying to build openssl3:
> conan install . --build=missing --profile:build=default_windows_x64_release --profile=default_windows_x64_debug
...
openssl/3.0.8: Generating aggregated env files
openssl/3.0.8: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
openssl/3.0.8: Calling build()
openssl/3.0.8: RUN: C:/Users/username/.conan2/p/straw898fb56546adc/p/bin/perl.exe ./Configure "VC-conan-Debug-Windows-x86_64-msvc-191" no-shared --prefix=/ --libdir=lib --openssldir="C:\Users\username\.conan2\p\b\opens4a3ff4f862506\p\res" no-unit-test threads PERL=C:/Users/username/.conan2/p/straw898fb56546adc/p/bin/perl.exe no-tests --debug enable-fips no-md2 zlib --with-zlib-include="C:/Users/username/.conan2/p/b/zlib69dc6f0d4df93/p/include" --with-zlib-lib="C:/Users/username/.conan2/p/b/zlib69dc6f0d4df93/p/lib/zlib.lib"
conanvcvars.bat: Activating environment Visual Studio 15 - amd64 - winsdk_version=None - vcvars_ver=14.1
[vcvarsall.bat] Environment initialized for: 'x64'
Configuring OpenSSL version 3.0.8 for target VC-conan-Debug-Windows-x86_64-msvc-191
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created makefile.in
Created makefile
Created include\openssl\configuration.h
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL.md file first) ***
*** ***
**********************************************************************
openssl/3.0.8: RUN: nmake
conanvcvars.bat: Activating environment Visual Studio 15 - amd64 - winsdk_version=None - vcvars_ver=14.1
[vcvarsall.bat] Environment initialized for: 'x64'
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:/Users/username/.conan2/p/straw898fb56546adc/p/bin/perl.exe" "-I." -Mconfigdata "util\dofile.pl" "-omakefile" "include\crypto\bn_conf.h.in" > include\crypto\bn_conf.h
...
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" / depend
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" / _build_sw
Microsoft (R) Program Maintenance Utility Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
"cl" /Zi /Fdossl_static.pdb /MTd /Zl /Gs0 /GF /Gy -MTd -Zi -Ob0 -Od -FS -MTd -Zi -Ob0 -Od -FS -I"." -I"include" -I"apps\include" -D"L_ENDIAN" -D"OPENSSL_PIC" -D"OPENSSLDIR=\"C:\\Users\\username\\.conan2\\p\\b\\opens4a3ff4f862506\\p\\res\"" -D"ENGINESDIR=\"\\lib\\engines-3\"" -D"MODULESDIR=\"\\lib\\ossl-modules\"" -D"OPENSSL_BUILDING_OPENSSL" -D"ZLIB" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"DEBUG" -D"_DEBUG" -I"C:/Users/username/.conan2/p/b/zlib69dc6f0d4df93/p/include" -c /Foapps\lib\libapps-lib-app_libctx.obj "apps\lib\app_libctx.c"
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27051 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
app_libctx.c
C:\Users\username\.conan2\p\b\opens4a3ff4f862506\b\src\include\openssl/crypto.h(25): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
I suspect this happens because MSVS doesn't set all of the includes and paths correctly. I think so, because when I execute "set INCLUDE" in Developer Command Prompt for VS 2017, I get this:
>set include
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include;C:\PROGRA~1\IBM\SQLLIB\INCLUDE;C:\PROGRA~1\IBM\SQLLIB\LIB
On the other hand, when I manually add missing includes in my Developer Command Prompt, like this:
set INCLUDE=%INCLUDE%;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\um;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\UnitTest\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include;C:\3coreserver\commlib2a\openssl\windows\vs2012\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\PlatformSDK\include;C:\Program Files (x86)\Windows Kits\10\Source\10.0.16299.0\ucrt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\VS\src;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\crt\src;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\src\atl;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\src\mfcm;C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\src\mfc;
I get different error:
legacyprov.c
cmd /C ""cl" /Zs /showIncludes /Zi /Fddso.pdb /Gs0 /GF /Gy -MTd -Zi -Ob0 -Od -FS -MTd -Zi -Ob0 -Od -FS -I"include" -I"providers\implementations\include" -I"providers\common\include" -D"OPENSSL_BUILDING_OPENSSL" -D"ZLIB" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"DEBUG" -D"_DEBUG" -I"C:/Users/username/.conan2/p/b/zlib69dc6f0d4df93/p/include" "providers\legacyprov.c" > providers\legacy-dso-legacyprov.d 2>&1"
"C:/Users/username/.conan2/p/straw898fb56546adc/p/bin/perl.exe" "util\mkrc.pl" legacy > providers\legacy.rc
"rc" /foproviders\legacy-dso-legacy.res "providers\legacy.rc"
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
"C:/Users/username/.conan2/p/straw898fb56546adc/p/bin/perl.exe" "util\mkdef.pl" --type dso --ordinals util\providers.num --name legacy --OS windows > providers\legacy.def
IF EXIST providers\legacy.dll.manifest DEL /F /Q providers\legacy.dll.manifest
cmd /C ""link" -debug /dll -debug -debug @C:\Users\username\AppData\Local\Temp\2\nm17C5.tmp || (DEL /Q legacy.* providers\legacy.* & EXIT 1)"
Microsoft (R) Incremental Linker Version 14.16.27051.0
Copyright (C) Microsoft Corporation. All rights reserved.
providers\legacy-dso-legacyprov.obj
/out:providers\legacy.dll
providers\liblegacy.lib
providers\libcommon.lib
libcrypto.lib
C:/Users/username/.conan2/p/b/zlib69dc6f0d4df93/p/lib/zlib.lib ws2_32.lib gdi32.lib advapi32.lib crypt32.lib user32.lib
/def:providers\legacy.def providers\legacy-dso-legacy.res
LINK : fatal error LNK1104: cannot open file 'ws2_32.lib'
Could Not Find C:\Users\username\.conan2\p\b\opensdbeefee112c1f\b\src\legacy.*
NMAKE : fatal error U1077: 'cmd' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
I have Microsoft SDK (10.0.16299.0) installed for VS 2017 but its include and libs paths are not set by default.
I don't understand how do I fix this, please help.