GNU bug report logs - #74175
libtool mishandles some compiler flags when used with MSVC tools

Previous Next

Package: libtool;

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

Date: Sat, 2 Nov 2024 07:52:02 UTC

Severity: normal

Done: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>

Full log


View this message in rfc822 format

From: Kirill Makurin <maiddaisuki <at> outlook.com>
To: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>, "74175 <at> debbugs.gnu.org" <74175 <at> debbugs.gnu.org>
Subject: bug#74175: libtool mishandles some compiler flags when used with MSVC tools
Date: Thu, 5 Jun 2025 16:26:23 +0000
[Message part 1 (text/plain, inline)]
Yes, this issue appears only with clang-cl.exe. The issue has been fixed for cl.exe.

I do not have icl.exe to test it, unfortunately.

- Kirill Makurin


________________________________
From: Ileana Dumitrescu
Sent: Friday, June 6, 2025 1:13 AM
To: 74175 <at> debbugs.gnu.org
Cc: Kirill Makurin
Subject: Re: bug#74175: libtool mishandles some compiler flags when used with MSVC tools

On 05/06/2025 13:09, Kirill Makurin wrote:
> I am actually wrong. If we would pass -Wl and friends as is to clang.exe
> it would handle them correctly by itself.
>
> Note: clang.exe installed with Visual Studio uses link.exe, just like
> cl.exe would.

Thank you for the updates. Is this an issue specifically with clang-cl?
I believe the issue is fixed with cl/cl.exe in development.

> What do you think about checking whether compiler defines _MSC_VER macro?

I do not have a strong opinion on this, so it could be added. Could you
submit a patch for review?

> - Kirill Makurin
> ------------------------------------------------------------------------
> *From:* bug-libtool-bounces+maiddaisuki=outlook.com <at> gnu.org <bug-
> libtool-bounces+maiddaisuki=outlook.com <at> gnu.org> on behalf of Kirill
> Makurin <maiddaisuki <at> outlook.com>
> *Sent:* Thursday, June 5, 2025 6:58 PM
> *To:* Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>;
> 74175 <at> debbugs.gnu.org <74175 <at> debbugs.gnu.org>
> *Subject:* bug#74175: libtool mishandles some compiler flags when used
> with MSVC tools
> Hi Ileana,
>
> The fix seems incomplete.
>
> See attached file for `libtool --mode=link` invocation with clang-cl.
> You may notice that the flag passed with -Wl is passed twice: once on
> its own (just like it was with cl.exe with the bug) and once properly
> with -Wl.
>
> Do you think checking compiler's name is a good idea? AFAIK, all three
> of cl.exe, clang-cl.exe and icl.exe (MSVC-like compilers handled by
> Automake's `compile` wrapper) define _MSC_VER macro. If libtool does
> check, it should be at least consistent with `compile` wrapper.

There are checks for compilers in libtool, like "cl* | icl*)" for
cc_basename when on a windows-like system. If libtool's configuration
when using clang-cl.exe is incorrect, these could be updated to avoid
clang-cl.exe or a new check could be added for the needed configuration.

> Maybe libtool could check during configuration whether compiler defines
> this macro to decide how to pass linker flags? Since `compile` wrapper
> should usually be involved, we need to just pass -Wl flags and friends
> as is, `compile` takes care of them.
>
> There is one problematic case though. If we would use clang.exe
> installed with Visual Studio, this will not work. It defines _MSC_VER,
> but it usus gcc-like command line options.

--
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354

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

This bug report was last modified 17 days ago.

Previous Next


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