bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54020: Impossible to pass `-no-suppress` to `libtool` via automake f


From: Mike Frysinger
Subject: bug#54020: Impossible to pass `-no-suppress` to `libtool` via automake files
Date: Wed, 17 Jan 2024 00:11:03 -0500

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. `libtool` has a command line option, `-no-suppress` which can
> be used to make the compiler verbose. Unfortunately, there is no way to
> inject that option since `libtool` demands that it comes after
> `--mode=compile`. `AM_LIBTOOLFLAGS` nor `LIBTOOLFLAGS` cannot be used for
> that purpose since "it is too early", according to `libtool`'s command line
> parser. It is somewhat possible to use `AM_CFLAGS` for that purpose but
> then it breaks modes other than `--mode=compile`.

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.

for example:
$ echo 'main(){}' > test.c
$ libtool --tag=CC --mode=compile gcc -c -Wall test.c -no-suppress
libtool: compile:  gcc -c -Wall -Wextra test.c  -fPIC -DPIC -o .libs/test.o
test.c:1:1: warning: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){}
      | ^~~~        
libtool: compile:  gcc -c -Wall -Wextra test.c -o test.o
test.c:1:1: warning: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){}
      | ^~~~
-mike

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]