Skip to content

[bug] Unable to run Msbuild.exe when using AutotoolsToolchain #15627

@chr-thien

Description

@chr-thien

Environment details

  • Operating System+version: Windows 11 22H2
  • Compiler+version: msvc16 (VS2019)
  • Conan version: 2.0.17
  • Python version: integrated in Conan release

Steps to reproduce

When using the AutotoolsToolchain then later calls to MSBuild build helper will fail, because command 'msbuild' is not found.

E.g. in a recipe one could do:

def generate(self):
tc = AutotoolsToolchain(self)
...
tc.generate()

def build(self):
autotools = Autotools(self)
autotools.configure(...)
autotools.make()
if self.settings.os == "Windows":
if self.options.shared:
msbuild = MSBuild(self)
msbuild.build("merge_module.sln")

The msbuild command line will be executed in MSYS2 environment.
But inside MSYS2 you cannot call 'msbuild' - that does not exist. You have to call 'msbuild.exe'. That one will be found. I verified this by manually starting MSYS2 bash and executing all generated conanbuild.bat and conanbuild.sh.
In source code of revision 2.0.17 one can find the assembly of msbuild command in msbuild.py line 58.

On the other hand I think it is not necessary to execute Msbuild inside of MSYS2 environment.
Is it possible to set another toolchain for Msbuild build helper?

Logs

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions