Closed calebkiage closed 1 year ago
It fails with VS2022 over here like so:
libsodium/1.0.18: WARN: Build folder is dirty, removing it: C:\.conan\5488b6\1
libsodium/1.0.18: Copying sources to build folder
libsodium/1.0.18: Building your package in C:\.conan\5488b6\1
libsodium/1.0.18: Generator cmake created conanbuildinfo.cmake
libsodium/1.0.18: Aggregating env generators
libsodium/1.0.18: Calling build()
libsodium/1.0.18: libsodium/1.0.18: ERROR: Package '0b05059ca636ddfa23e6dc44613da1b6a0c20b36' build failed
libsodium/1.0.18: WARN: Build folder C:\.conan\5488b6\1
ERROR: libsodium/1.0.18: Invalid configuration: Unsupported msvc version: 17
I've just tried it here and it works for me. It updates the toolset from v142 to v143 and builds fine.
This issue seems to have been fixed by using the new MSBuild
from package conan.tools.microsoft
Description
When I have multiple MSVC toolsets on Visual Studio 2022, building the library fails for some of the toolsets.
Tested toolsets: MSBuild 17.4 MSVC v140 - VS 2015 - pass MSBuild 17.4 MSVC v141 - VS 2017 - fail MSBuild 17.4 MSVC v142 - VS 2019 - fail MSBuild 17.4 MSVC v143 - VS 2022 - pass
This is a screenshot of the tools I have installed for visual studio
Work around
I found a work around to fix the issue locally that I can open a PR for. The work around involves:
Package and Environment Details
Conan profile
[settings] os=Windows arch=x86_64
build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=static compiler.version=191
[conf] tools.microsoft.msbuild:vs_version = 17
Steps to reproduce
conan install . --build libsodium/* --profile:host ./.conan/profiles/win-x64/win-x64-host --profile:build ./.conan/profiles/win-x64/win-x64-host --settings:build build_type=Release --settings:host build_type=Release --settings:host compiler.runtime=dynamic
Logs
Click to expand log
``` Configuration (profile_host): [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=191 os=Windows [options] [build_requires] [env] [conf] tools.microsoft.msbuild:vs_version=17 tools.microsoft.msbuild:verbosity=Normal Configuration (profile_build): [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=static compiler.runtime_type=Release compiler.version=191 os=Windows [options] [build_requires] [env] [conf] tools.microsoft.msbuild:vs_version=17 tools.microsoft.msbuild:verbosity=Normal catch2/3.1.0: Main binary package '16041e00ee7792b16701a7a92918452f6b5a519b' missing. Using compatible package '6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7' fmt/9.1.0: Main binary package '3da0313181279a1d9c8fe73b0cc5c53165ce845c' missing. Using compatible package '8270b003766febceb5d9d24a7b7c6ee95f6a94d7' libsodium/1.0.18: Forced build from source spdlog/1.11.0: Main binary package 'c75fefb15e33a09eff126ebe14e057073ae7b5b6' missing. Using compatible package '304e089472614b68b915bef54bff3f1159403980' zeromq/4.3.4: Main binary package 'dde1239d1a1912a68c95b6edfcffc533c1e72cef' missing. Using compatible package '92105e8fc16d129eb40755d7d2152c4855f68c46' conanfile.py: Installing package Requirements asio/1.24.0 from 'conancenter' - Cache boost/1.80.0 from 'conancenter' - Cache catch2/3.1.0 from 'conancenter' - Cache cppzmq/4.9.0 from 'conancenter' - Cache cxxopts/3.0.0 from 'conancenter' - Cache fmt/9.1.0 from 'conancenter' - Cache libsodium/1.0.18 from 'conancenter' - Cache spdlog/1.11.0 from 'conancenter' - Cache zeromq/4.3.4 from 'conancenter' - Cache Packages asio/1.24.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache boost/1.80.0:524ea35a8120baabdde02483add58d81bf541327 - Cache catch2/3.1.0:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 - Cache cppzmq/4.9.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache cxxopts/3.0.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache fmt/9.1.0:8270b003766febceb5d9d24a7b7c6ee95f6a94d7 - Cache libsodium/1.0.18:7b29bd067fdfb16abfe9ea2a31df29d4e11ef2b2 - Build spdlog/1.11.0:304e089472614b68b915bef54bff3f1159403980 - Cache zeromq/4.3.4:92105e8fc16d129eb40755d7d2152c4855f68c46 - Cache Installing (downloading, building) binaries... asio/1.24.0: Already installed! boost/1.80.0: Already installed! catch2/3.1.0: Already installed! cxxopts/3.0.0: Already installed! fmt/9.1.0: Already installed! Downloading conan_sources.tgz completed [0.58k] Decompressing conan_sources.tgz completed [0.00k] libsodium/1.0.18: Configuring sources in C:\dev\.conan\0d8924\1 Downloading libsodium-1.0.18.tar.gz completed [1874.82k] libsodium/1.0.18: Copying sources to build folder libsodium/1.0.18: Building your package in C:\dev\.conan\30b2f9\1 libsodium/1.0.18: Generator txt created conanbuildinfo.txt libsodium/1.0.18: Aggregating env generators libsodium/1.0.18: Calling build() libsodium/1.0.18: Found Visual Studio 17 libsodium/1.0.18: Skipped sln project upgrade ********************************************************************** ** Visual Studio 2022 Developer Command Prompt v17.4.1 ** Copyright (c) 2022 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x64' MSBuild version 17.4.0+18d5aef85 for .NET Framework C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.Redirect.15.targets(69,5): error MSB8052: MSVC Toolset Version '14.34.31933' is not compatible with 'v141' Platform Toolset. Please ei ther change Platform Toolset to v143 or MSVC Toolset Version (VCToolsVersion property) to the version with the format '14.1*.*'. To use default MSVC Toolset Version for a given Platform Toolset don't set VCToolsVersion property. [ C:\dev\.conan\30b2f9\1\source_subfolder\builds\msvc\vs2017\libsodium\libsodium.vcxproj] libsodium/1.0.18: libsodium/1.0.18: ERROR: Package '7b29bd067fdfb16abfe9ea2a31df29d4e11ef2b2' build failed libsodium/1.0.18: WARN: Build folder C:\dev\.conan\30b2f9\1 ERROR: libsodium/1.0.18: Error in build() method, line 143 self._build_msvc() while calling '_build_msvc', line 115 msbuild.build(sln_path, upgrade_project=upgrade_project, platforms={"x86": "Win32"}, build_type=build_type) ConanException: Error 1 while executing set "VSCMD_START_DIR=%CD%" && call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC/Auxiliary/Build/vcvarsall.bat" amd64 && msbuild "C:\dev\.conan\30b2f9\1\source_subfolder\builds\msvc\vs2017\libsodium.sln" /p:Configuration="StaticRelease" /p:UseEnv=true /p:Platform="x64" /m:8 /verbosity:minimal /p:ForceImportBeforeCppTargets="C:\dev\.conan\30b2f9\1\conan_build.props" ```