Subject: Re: bug#54020: Impossible to pass `-no-suppress` to `libtool` via automake files

From: Roumen Petrov <[email-masked]>
Date: Sun, 21 Jan 2024 20:00:56 +0200

Mike Frysinger wrote:
> On 17 Jan 2024 00:11, Mike Frysinger wrote:
>> On 15 Feb 2022 23:03, Damian Szuberski wrote:
>>> A standard `libtool` invocation line generated by automake looks like:
>>> ```
>>> LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
>>>          $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
>>>          $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
>>>          $(AM_CFLAGS) $(CFLAGS)
>>> ```
>>> Sometimes files compiled using the method above make the compiler emit
>>> errors. Those errors are suppressed by default which makes troubleshooting
>>> impossible. [SNIP]
This is not for first compilation. Only second i.e. static build is applicable.
>> i was reading the libtool manual today and was reminded that libtool processes
>> some standard options straight out of the wrapped command rather than forcing
>> you to split things up.  for example, it detects the -o option and parses that.
>> then i was reminded that when passing libtool linker options like -no-undefined,
>> you simply add them to the standard LDFLAGS.
>>
>> which is to say, options like -no-suppress do not need exact placement.  put it
>> in existing CFLAGS variables as makes sense for your target.
>> 	AM_CFLAGS = -no-suppress
>> or
>> 	libfoo_la_CFLAGS = $(AM_CFLAGS) -no-suppress
>> and libtool should parse & discard it before invoking the underlying compiler.
Yes but this is not for regular builds.
Question is for exceptional cases.
How to debug when second i.e. static compilation fail?
So something like this CC='...' CFLAGS='...' make -e
Like  Mike point  -no-suppress cold be set accordingly.

Also with --disable-shared static build will be only one and so libtool will show all compilations errors.

> the Automake manual has libtool examples for general & linking flags,
> but nothing for compiling.  we could add some to make it more clear.

Yes as it should define target_XXXX if libtool is used, hows to define dependent libraries, how to force static and etc. builds.
For my point of view compilation rules are common. With and without libtool we use target_CFLAGS target_CPPFLAGS, and etc..
Integration between libtool and automake is general process.
Linking is specific - if executable (..._LD_ADD) or shared library (..._LIBADD).  What to add to _LDFLAGS and what to library list.

> -mike

Regards,
Roumen