GNU bug report logs - #75939
bug in compile wrapper when using MSVC from Msys2

Previous Next

Package: automake;

Reported by: Kirill Makurin <maiddaisuki <at> outlook.com>

Date: Thu, 30 Jan 2025 04:59:02 UTC

Severity: normal

Done: Karl Berry <karl <at> freefriends.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kirill Makurin <maiddaisuki <at> outlook.com>
To: "bug-automake <at> gnu.org" <bug-automake <at> gnu.org>
Subject: bug in compile wrapper when using MSVC from Msys2
Date: Wed, 29 Jan 2025 23:09:40 +0000
[Message part 1 (text/plain, inline)]
Hi,

I would like to report one quite annoying issue related to Automake's `compile` wrapper when it is used with `cl.exe` to compile some C++ files from Msys2.

I was building some GNU packages with MSVC's `cl.exe`, and compilation of some C++ source files was failing with `cl.exe` reporting non-sensual filenames like `H:E:/Msys2/{builddir}/somefile.cxx`.

Apparently, the issue is double conversion of a unix-style filename by Msys2's shell. In example above, Msys2 is installed to `E:/Msys2` and builddir is `/h/{builddir}`.

As I figured out later, it was happening because `compile` was converting `/h/{builddir}/somefile.cxx` to `H:/{builddir}/somefile.cxx` and passing it as `-TpH:/{builddir}/somefile.cxx` to `cl.exe`. However, Msys2 was interpreting `/{builddir}/somefile.cxx` as a unix-style path and converted it again, resulting in `-TpH:E:/Msys2/{builddir}/somefile.cxx`.

One way to work around this issue is :

```
export MSYS2_ARG_CONV_EXCL='-Tp'
```

However, this must be set by the user, which is inconvenient. I wonder if anything can be done in the `compile` wrapper to fix this.

I am using latest versions of MSVC tools and `cl.exe` allows to pass argument to `-Tp` as a separate argument and this seems to work correctly. However, I don't know whether older versions of `cl.exe` allow it.

- Kirill Makurin
[Message part 2 (text/html, inline)]

This bug report was last modified 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.