conan-io / conan-vs-extension

Conan Extension for Visual Studio
https://marketplace.visualstudio.com/items?itemName=conan-io.conan-vs-extension
MIT License
59 stars 34 forks source link

Build fails because nmake, ml64 missing #153

Closed jdee closed 4 years ago

jdee commented 4 years ago

When using this extension to build a Visual Studio project with Poco, the build step for OpenSSL always fails. I always have to set the build_policy to missing or never and then manually seed the Conan cache. The conan command that the extension attempts to run always fails, but the same command succeeds in a Native Tools Command Prompt. I suspect the vcvars32/vcvars64 environment is somehow not available to the extension, but it's not clear why or how to enable it.

An example project to demonstrate the problem can be found here: https://github.com/jdee/ConanExtensionExample.

Complete VS output from Conan:


7/29/2019 12:44:54 PM: [Conan.VisualStudio] Calling process 'C:\Users\Jimmy Dee\AppData\Roaming\Python\Python37\Scripts\conan.exe' with arguments 'install C:\github\jdee\ConanExtensionExample\conanfile.txt -g visual_studio --install-folder C:\github\jdee\ConanExtensionExample\x64\Debug\.conan -s arch=x86_64 -s build_type=Debug -s compiler.toolset=v142 -s compiler.version=16 -s compiler.runtime=MDd  --build=missing'
7/29/2019 12:44:56 PM: Configuration:
7/29/2019 12:44:56 PM: [settings]
7/29/2019 12:44:56 PM: arch=x86_64
7/29/2019 12:44:56 PM: arch_build=x86_64
7/29/2019 12:44:56 PM: build_type=Debug
7/29/2019 12:44:56 PM: compiler=Visual Studio
7/29/2019 12:44:56 PM: compiler.runtime=MDd
7/29/2019 12:44:56 PM: compiler.toolset=v142
7/29/2019 12:44:56 PM: compiler.version=16
7/29/2019 12:44:56 PM: os=Windows
7/29/2019 12:44:56 PM: os_build=Windows
7/29/2019 12:44:56 PM: [options]
7/29/2019 12:44:56 PM: [build_requires]
7/29/2019 12:44:56 PM: [env]
7/29/2019 12:45:00 PM: strawberryperl/5.28.1.1@conan/stable: Not found in local cache, looking in remotes...
7/29/2019 12:45:00 PM: strawberryperl/5.28.1.1@conan/stable: Trying with 'conan-center'...
7/29/2019 12:45:01 PM: Downloading conanmanifest.txt
7/29/2019 12:45:05 PM: Downloading conanfile.py
7/29/2019 12:45:07 PM: strawberryperl/5.28.1.1@conan/stable: Downloaded recipe revision 0
7/29/2019 12:45:09 PM: conanfile.txt: Installing package
7/29/2019 12:45:09 PM: Requirements
7/29/2019 12:45:09 PM:     OpenSSL/1.0.2o@conan/stable from 'conan-center' - Cache
7/29/2019 12:45:09 PM:     Poco/1.9.0@pocoproject/stable from 'conan-center' - Cache
7/29/2019 12:45:09 PM:     zlib/1.2.11@conan/stable from 'conan-center' - Cache
7/29/2019 12:45:09 PM: Packages
7/29/2019 12:45:09 PM:     OpenSSL/1.0.2o@conan/stable:6acf24cd4adf2df742e006cc0e5f0329e3b6e60b - Build
7/29/2019 12:45:09 PM:     Poco/1.9.0@pocoproject/stable:dad7f9c58f95b75337543a4206ab3833670814b2 - Build
7/29/2019 12:45:09 PM:     zlib/1.2.11@conan/stable:d057732059ea44a47760900cb5e4855d2bea8714 - Cache
7/29/2019 12:45:09 PM: Build requirements
7/29/2019 12:45:09 PM:     strawberryperl/5.28.1.1@conan/stable from 'conan-center' - Downloaded
7/29/2019 12:45:09 PM: Build requirements packages
7/29/2019 12:45:09 PM:     strawberryperl/5.28.1.1@conan/stable:456f15897172eef340fcbac8a70811f2beb26a93 - Download
7/29/2019 12:45:09 PM: strawberryperl/5.28.1.1@conan/stable: Retrieving package 456f15897172eef340fcbac8a70811f2beb26a93 from remote 'conan-center' 
7/29/2019 12:45:11 PM: Downloading conanmanifest.txt
7/29/2019 12:45:17 PM: Downloading conaninfo.txt
7/29/2019 12:45:19 PM: Downloading conan_package.tgz
7/29/2019 12:48:16 PM: .........
7/29/2019 12:48:19 PM: strawberryperl/5.28.1.1@conan/stable: Package installed 456f15897172eef340fcbac8a70811f2beb26a93
7/29/2019 12:48:19 PM: strawberryperl/5.28.1.1@conan/stable: Downloaded package revision 0
7/29/2019 12:48:19 PM: zlib/1.2.11@conan/stable: Already installed!
7/29/2019 12:48:19 PM: OpenSSL/1.0.2o@conan/stable: Applying build-requirement: strawberryperl/5.28.1.1@conan/stable
7/29/2019 12:48:19 PM: OpenSSL/1.0.2o@conan/stable: Configuring sources in C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\source
7/29/2019 12:48:19 PM: OpenSSL/1.0.2o@conan/stable: Downloading https://www.openssl.org/source/openssl-1.0.2o.tar.gz
7/29/2019 12:48:46 PM: OpenSSL/1.0.2o@conan/stable: Copying sources to build folder
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable: Building your package in C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable: Generator txt created conanbuildinfo.txt
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable: Calling build()
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable: =====> Options:  --with-zlib-include="C:\github\.conan\data\zlib\1.2.11\conan\stable\package\d057732059ea44a47760900cb5e4855d2bea8714\include" --with-zlib-lib="C:\github\.conan\data\zlib\1.2.11\conan\stable\package\d057732059ea44a47760900cb5e4855d2bea8714\lib/zlib.lib"
7/29/2019 12:49:04 PM: This is perl 5, version 28, subversion 1 (v5.28.1) built for MSWin32-x64-multi-thread
7/29/2019 12:49:04 PM: Copyright 1987-2018, Larry Wall
7/29/2019 12:49:04 PM: Perl may be copied only under the terms of either the Artistic License or the
7/29/2019 12:49:04 PM: GNU General Public License, which may be found in the Perl 5 source kit.
7/29/2019 12:49:04 PM: Complete documentation for Perl, including FAQ lists, should be found on
7/29/2019 12:49:04 PM: this system using "man perl" or "perldoc perl".  If you have access to the
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable: WARN: ----------CONFIGURING OPENSSL FOR WINDOWS. 1.0.2o-------------
7/29/2019 12:49:04 PM: Internet, point your browser at http://www.perl.org/, the Perl Home Page.
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable:  
7/29/2019 12:49:04 PM: Conan:vcvars already set 
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable: WARN: perl Configure debug-VC-WIN64A  --prefix=../binaries  --with-zlib-include="C:\github\.conan\data\zlib\1.2.11\conan\stable\package\d057732059ea44a47760900cb5e4855d2bea8714\include" --with-zlib-lib="C:\github\.conan\data\zlib\1.2.11\conan\stable\package\d057732059ea44a47760900cb5e4855d2bea8714\lib/zlib.lib"
7/29/2019 12:49:04 PM: Configuring for debug-VC-WIN64A
7/29/2019 12:49:04 PM:     no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
7/29/2019 12:49:04 PM:     no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
7/29/2019 12:49:04 PM:     no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
7/29/2019 12:49:04 PM:     no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
7/29/2019 12:49:04 PM:     no-libunbound   [experimental] OPENSSL_NO_LIBUNBOUND (skip dir)
7/29/2019 12:49:04 PM:     no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
7/29/2019 12:49:04 PM:     no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
7/29/2019 12:49:04 PM:     no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)
7/29/2019 12:49:04 PM:     no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)
7/29/2019 12:49:04 PM:     no-shared       [default] 
7/29/2019 12:49:04 PM:     no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE (skip dir)
7/29/2019 12:49:04 PM:     no-ssl2         [default]  OPENSSL_NO_SSL2 (skip dir)
7/29/2019 12:49:04 PM:     no-store        [experimental] OPENSSL_NO_STORE (skip dir)
7/29/2019 12:49:04 PM:     no-unit-test    [default]  OPENSSL_NO_UNIT_TEST (skip dir)
7/29/2019 12:49:04 PM:     no-weak-ssl-ciphers [default]  OPENSSL_NO_WEAK_SSL_CIPHERS (skip dir)
7/29/2019 12:49:04 PM:     no-zlib         [default] 
7/29/2019 12:49:04 PM:     no-zlib-dynamic [default] 
7/29/2019 12:49:04 PM: IsMK1MF=1
7/29/2019 12:49:04 PM: CC            =cl
7/29/2019 12:49:04 PM: CFLAG         =-DOPENSSL_THREADS  -DDSO_WIN32 -W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
7/29/2019 12:49:04 PM: EX_LIBS       =
7/29/2019 12:49:04 PM: CPUID_OBJ     =x86_64cpuid.o
7/29/2019 12:49:04 PM: BN_ASM        =bn_asm.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o
7/29/2019 12:49:04 PM: EC_ASM        =ecp_nistz256.o ecp_nistz256-x86_64.o
7/29/2019 12:49:04 PM: DES_ENC       =des_enc.o fcrypt_b.o
7/29/2019 12:49:04 PM: AES_ENC       =aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o
7/29/2019 12:49:04 PM: BF_ENC        =bf_enc.o
7/29/2019 12:49:04 PM: CAST_ENC      =c_enc.o
7/29/2019 12:49:04 PM: RC4_ENC       =rc4-x86_64.o rc4-md5-x86_64.o
7/29/2019 12:49:04 PM: RC5_ENC       =rc5_enc.o
7/29/2019 12:49:04 PM: MD5_OBJ_ASM   =md5-x86_64.o
7/29/2019 12:49:04 PM: SHA1_OBJ_ASM  =sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o
7/29/2019 12:49:04 PM: RMD160_OBJ_ASM=
7/29/2019 12:49:04 PM: CMLL_ENC      =cmll-x86_64.o cmll_misc.o
7/29/2019 12:49:04 PM: MODES_OBJ     =ghash-x86_64.o aesni-gcm-x86_64.o
7/29/2019 12:49:04 PM: ENGINES_OBJ   =
7/29/2019 12:49:04 PM: PROCESSOR     =
7/29/2019 12:49:04 PM: RANLIB        =true
7/29/2019 12:49:04 PM: ARFLAGS       =
7/29/2019 12:49:04 PM: PERL          =perl
7/29/2019 12:49:04 PM: SIXTY_FOUR_BIT mode
7/29/2019 12:49:04 PM: DES_INT used
7/29/2019 12:49:04 PM: RC4_CHUNK is unsigned long long
7/29/2019 12:49:04 PM: Configured for debug-VC-WIN64A.
7/29/2019 12:49:04 PM: OpenSSL/1.0.2o@conan/stable:  
7/29/2019 12:49:04 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>perl util\mkfiles.pl  1>MINFO 
7/29/2019 12:49:04 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>cmd /c "nasm -f win64 -v"  1>NUL 2>&1 
7/29/2019 12:49:04 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>if 1 NEQ 0 goto ml64 
7/29/2019 12:49:04 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>perl ms\uplink-x86_64.pl masm  1>ms\uptable.asm 
7/29/2019 12:49:05 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>ml64 -c -Foms\uptable.obj ms\uptable.asm 
7/29/2019 12:49:05 PM: 'ml64' is not recognized as an internal or external command,
7/29/2019 12:49:05 PM: operable program or batch file.
7/29/2019 12:49:05 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>perl util\mk1mf.pl VC-WIN64A  1>ms\nt.mak 
7/29/2019 12:49:05 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>perl util\mk1mf.pl dll VC-WIN64A  1>ms\ntdll.mak 
7/29/2019 12:49:05 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>perl util\mkdef.pl 32 libeay  1>ms\libeay32.def 
7/29/2019 12:49:06 PM: C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b\openssl-1.0.2o>perl util\mkdef.pl 32 ssleay  1>ms\ssleay32.def 
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable:  
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable: WARN: replace vs runtime /MDd in ./openssl-1.0.2o/ms/ntdll.mak
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable: WARN: replace vs runtime /MTd in ./openssl-1.0.2o/ms/nt.mak
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable: WARN: ----------MAKE OPENSSL 1.0.2o-------------
7/29/2019 12:49:07 PM: 'nmake' is not recognized as an internal or external command,
7/29/2019 12:49:07 PM: operable program or batch file.
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable: 
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable: ERROR: Package '6acf24cd4adf2df742e006cc0e5f0329e3b6e60b' build failed
7/29/2019 12:49:07 PM: OpenSSL/1.0.2o@conan/stable: WARN: Build folder C:\github\.conan\data\OpenSSL\1.0.2o\conan\stable\build\6acf24cd4adf2df742e006cc0e5f0329e3b6e60b
7/29/2019 12:49:07 PM: ERROR: OpenSSL/1.0.2o@conan/stable: Error in build() method, line 120
7/29/2019 12:49:07 PM:  self.visual_build(config_options_string)
7/29/2019 12:49:07 PM: while calling 'visual_build', line 310
7/29/2019 12:49:07 PM:  self.run_in_src(make_command)
7/29/2019 12:49:07 PM: while calling 'run_in_src', line 134
7/29/2019 12:49:07 PM:  self.run(command)
7/29/2019 12:49:07 PM:  ConanException: Error 1 while executing nmake -f ms\nt.mak 
7/29/2019 12:49:08 PM: Conan has returned exit code '1' while processing configuration 'Architecture: x86_64, build type: Debug, compiler toolset: v142, compiler version: 16;, runtime library: MDd'. Please check file 'C:\github\jdee\ConanExtensionExample\x64\Debug\.conan\conan_a07ee162-5dbe-49bc-bc62-c12a9ae62704.log' for details.
``
SSE4 commented 4 years ago

@jgsogo OpenSSL definitely sets vcvars: https://github.com/conan-community/conan-openssl/blob/release/1.1.1c/conanfile.py#L488 as we're running conan from the Visual Studio context, it's possible that vcvars variables are already set in this context, but might be for .NET/C# development, or another form. it might be needed to reset some environment variables when launching conan process(es).

jgsogo commented 4 years ago

I've opened an issue to the Conan repository, I think it is the place to fix it. If the issue doesn't get enough priority we can think about patching it here to the extension. Let's wait for the triaging of that one.

SSE4 commented 4 years ago

@jdee new release with fix is available on marketplace

jdee commented 4 years ago

Thank you, @SSE4. I found it, and it works well. Sorry for the delay in getting back to you.

Here is an example app using our new conan package and the VS extension: https://github.com/BranchMetrics/cpp-branch-deep-linking-attribution/tree/master/BranchSDK-Samples/Windows/BranchDemo. This SDK is still alpha, but will be released to production and conan-center soon.

The one thing that would be nice for me during testing would be to be able to specify a specific remote to the extension. If there's not an open issue about this already, I'll open one. It's a minor concern.

Thanks for addressing this so quickly!