conan-io / conan-vs-extension

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

Conan doesn't use the latest MSVC toolset version while building the dependencies #247

Closed Jeanmilost closed 1 month ago

Jeanmilost commented 1 month ago

I recently tried to install a working compilation system on a new computer. The Conan version I use is the 2.5.0, and the VS extension is the 2.0.6

While trying to install Boost in my project, I faced the following issue:

1>-------- Installing package boost/1.85.0 (7 of 10) --------
1>boost/1.85.0: Building from source
1>boost/1.85.0: Package boost/1.85.0:b45a27d785c3d4a5eded16a7b99ede281c1a8497
1>boost/1.85.0: Building your package in C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\b
1>boost/1.85.0: Calling generate()
1>boost/1.85.0: Generators folder: C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\b\build-debug\conan
1>boost/1.85.0: Generating aggregated env files
1>boost/1.85.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
1>boost/1.85.0: Calling build()
1>boost/1.85.0: WARN: replace_in_file didn't find pattern '/* thread_local */' in 'C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
1>boost/1.85.0: WARN: replace_in_file didn't find pattern '/* static __thread */' in 'C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
1>boost/1.85.0: WARN: replace_in_file didn't find pattern 'local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;' in 'C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\tools\build\src\tools\gcc.jam' file.
1>boost/1.85.0: WARN: replace_in_file didn't find pattern 'local no-threading = android beos haiku sgi darwin vxworks ;' in 'C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\tools\build\src\tools\gcc.jam' file.
1>boost/1.85.0: WARN: replace_in_file didn't find pattern '    <conditional>@numa' in 'C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\libs\fiber\build\Jamfile.v2' file.
1>boost/1.85.0: WARN: Patching user-config.jam
1>boost/1.85.0: WARN:
1>using zlib : 1.3.1 : <include>"C:/Users/ericv/.conan2/p/b/zlib4d1716b3de7d3/p/include" <search>"C:/Users/ericv/.conan2/p/b/zlib4d1716b3de7d3/p/lib" <name>zlib ;
1>using bzip2 : 1.0.8 : <include>"C:/Users/ericv/.conan2/p/b/bzip2bfc1965594f24/p/include" <search>"C:/Users/ericv/.conan2/p/b/bzip2bfc1965594f24/p/lib" <name>bz2 ;
1>using "msvc" : 14.3 :  :
1> ;
1>boost/1.85.0: WARN: b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=static runtime-debugging=on threading=multi visibility=hidden link=static variant=debug --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\p -j16 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\b\build-debug"
1>boost/1.85.0: RUN: b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ericv\.conan2\p\boost61c71161686bc\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=static runtime-debugging=on threading=multi visibility=hidden link=static variant=debug --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\p -j16 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\b\build-debug"
1>conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.3
1>[ERROR:vcvars.bat] Toolset directory for version '14.3' was not found.
1>[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***
1>[ERROR:VsDevCmd.bat] In an uninitialized command prompt, please 'set VSCMD_DEBUG=[value]' and then re-run
1>[ERROR:VsDevCmd.bat] vsdevcmd.bat [args] for additional details.
1>[ERROR:VsDevCmd.bat] Where [value] is:
1>[ERROR:VsDevCmd.bat]    1 : basic debug logging
1>[ERROR:VsDevCmd.bat]    2 : detailed debug logging
1>[ERROR:VsDevCmd.bat]    3 : trace level logging. Redirection of output to a file when using this level is recommended.
1>[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3
1>[ERROR:VsDevCmd.bat]          vsdevcmd.bat > vsdevcmd.trace.txt 2>&1
1>
1>boost/1.85.0 : error :
1>Package 'b45a27d785c3d4a5eded16a7b99ede281c1a8497' build failed
1>boost/1.85.0: WARN: Build folder C:\Users\ericv\.conan2\p\b\boost7b1c1d4fbc325\b\build-debug
1>EXEC : error : boost/1.85.0: Error in build() method, line 1127
1>  self.run(full_command)
1>  ConanException: Error 1 while executing
1>EXEC : error : Conan installation failed. Please check the console output to troubleshoot issues.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: La commande "
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: set CONAN_BUILD_CONFIG="Debug_x64" && "C:\Users\ericv\Development\CopyTrans\CopyTransHEIC\CopyTransHEIC\.conan\conan_install.bat" . -pr:h=.conan/Debug_x64 -pr:b=default --build=missing
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :VCEnd" s'est arrêtée avec le code 1.
1>Génération du projet "CopyTransHEIC.vcxproj" terminée -- ÉCHEC.
========== Reconstruire tout : 0 réussi, 1 a échoué, 0 ignoré =========

As you can see, the issue is: Toolset directory for version '14.3' was not found

After searching a lot, I could find that the issue happened because I had only the 14.40.33807 version installed in my Visual Studio 2022 MSVC toolset folder (on my computer: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC), which is the latest version of the toolset.

After installed a previous version of this toolset (14.32.31326) from my Visual Studio Installer, all came fine and I could achieve my compilation.

Can you fix that please?

czoido commented 1 month ago

Hi @Jeanmilost,

Thanks a lot for reporting. I think that we are facing here the same issue as in this case: https://github.com/conan-io/conan/issues/16239

We are going to check what we can do in the plugin so that this does not happen. In the meantime you can modify the prebuild step that makes conan install the packages in Configuration Properties > Build Events > Pre-Build Event

You can add the -s="compiler.version=194" there,

or better, you can modify the part:

-pr:h=.conan/$(Configuration)_$(Platform) -pr:b=default

and instead of using that pr:h create another profile of your choice (it should have compiler.version=194 and match the Visual Studio settings selected in the project)

image

Hope this helps.

czoido commented 1 month ago

Hi @Jeanmilost, We have just released 2.0.7 of the extension, please update, the issue should have been fixed in this version. Thanks for reporting.