tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Fixing configure failures from newer gcc
Martin Husemann <martin%duskware.de@localhost> writes:
> I had to add the following hack to x11/rxvt/Makefile to get it to build
> on newer NetBSD current.
>
> This obviously is wrong, but what is the proper idiom for fixing fallout
> like this? Not making it depend on NetBSD and at least checking for
> CC_VERSION:Mgcc-14.* sounds still awkward to me.
The proper thing is to figure out if the warnings are valid or not, and
either fix upstream or gcc.
I think it's broken to have -Werror in configure, unless both upstream
and the operating system are squeaky clean about everything in configure
and view a report like this as a reason to issue a fixed micro within a
week or two. But essentially zero upstreams view warnings thrown by
just-released gcc as an emergency, and I have to say they're right about
that. So one approach is to patch out -Werror, which is presumably in
there somehow, as warnings in configure tests should otherwise not be
fatal.
It's also possible that gcc14 is defaulting to some new c std, and this
program simply isn't in that standard. I think that's also broken of
gcc; program that want c23 should ask for it. So a good question is
"what std is this program in", and then configure should be checking for
and setting that. Maybe that is happening, maybe not, and it might or
might not be relevant.
> Without this -Wno- additions gcc 14 fails a lot of (broken) configure tests
> and we end up with a non-buildable configuration.
Sure, but often these -Wno-fancy-warning-that-gcc-just-added flags are
treated as invalid by older compilers, so they really should be added
only on compilers that support them.
Thus, your idea of "if gcc and gcc>=14 add these flags" is basically the
right approach, if patching on -Werror isnt' ok. This is almost
certainly not about NetBSD, unless the bad code that is objected to is
from NetBSD and rxvt is POSIX-C-pdneatically-clean here.
We could hoist these to be WARN_FOO added to CC_FEATURES, with
compiler.mk adding -Wno-warn-foo to compiler versions that are known to
support the foo warning. That makes WARN_FOO not quite the same
semantically so probably better to pick a new variable.
> Index: Makefile
> ===================================================================
> RCS file: /cvsroot/pkgsrc/x11/rxvt/Makefile,v
> retrieving revision 1.66
> diff -u -r1.66 Makefile
> --- Makefile 24 Nov 2021 06:55:41 -0000 1.66
> +++ Makefile 11 Oct 2025 07:31:03 -0000
> @@ -50,6 +50,7 @@
>
> # Make sure _NETBSD_SOURCE is defined for updlastlogx
> CFLAGS.NetBSD+= -D_NETBSD_SOURCE
> +CFLAGS.NetBSD+= -Wno-implicit-function-declaration -Wno-implicit-int
>
> post-patch:
> ${MV} ${WRKSRC}/src/feature.h ${WRKSRC}/src/feature.h.orig
Did that work ok on NetBSD 9?
Home |
Main Index |
Thread Index |
Old Index