diff mbox series

[1/1] package/vdr: fix build with gcc >= 11 and uclibc < 1.0.0

Message ID 20220925152452.353907-1-fontaine.fabrice@gmail.com
State Changes Requested
Headers show
Series [1/1] package/vdr: fix build with gcc >= 11 and uclibc < 1.0.0 | expand

Commit Message

Fabrice Fontaine Sept. 25, 2022, 3:24 p.m. UTC
Drop static from first patch to fix the following build failure with
gcc >= 11 and uclibc < 1.0.0 (prior to
https://github.com/wbx-github/uclibc-ng/commit/5c484467f718a25e94a88b11bdbb670ddb1c0d0f):

skinlcars.c:1105:12: error: 'int getloadavg(double*, int)' was declared 'extern' and later 'static' [-fpermissive]
 1105 | static int getloadavg (double loadavg[], int nelem)
      |            ^~~~~~~~~~
In file included from /home/buildroot/autobuild/run/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/include/c++/11.3.0/cstdlib:75,
                 from /home/buildroot/autobuild/run/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/include/c++/11.3.0/stdlib.h:36,
                 from config.h:15,
                 from channels.h:13,
                 from skins.h:13,
                 from skinlcars.h:13,
                 from skinlcars.c:26:
/home/buildroot/autobuild/run/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/include/stdlib.h:920:12: note: previous declaration of 'int getloadavg(double*, int)'
  920 | extern int getloadavg (double __loadavg[], int __nelem)
      |            ^~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/2d9fe8548ccbbcad3f86051509bf811fedb1d8e9

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/vdr/0001-getloadavg.patch | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Yann E. MORIN Sept. 25, 2022, 7:50 p.m. UTC | #1
Fabrice, All,

On 2022-09-25 17:24 +0200, Fabrice Fontaine spake thusly:
> Drop static from first patch to fix the following build failure with
> gcc >= 11 and uclibc < 1.0.0 (prior to
> https://github.com/wbx-github/uclibc-ng/commit/5c484467f718a25e94a88b11bdbb670ddb1c0d0f):
[--SNIP--]
>  diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
>  --- vdr-2.3.1.org/skinlcars.c	2015-09-01 12:07:07.000000000 +0200
> @@ -14,7 +16,7 @@ diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
>   
>  +/* uclibc and dietlibc do not have this junk -ReneR */
>  +#if defined (__UCLIBC__) || defined (__dietlibc__)
> -+static int getloadavg (double loadavg[], int nelem)
> ++int getloadavg (double loadavg[], int nelem)

If you drop the static, the getlaodavag will come clashing with the one
defined in the C library: uClibc-ng does have a getloadavg since version
1.0.42, which we do have in Buildroot now.

So, what the patch should do, is really test whether getlaodavg is
available or not. But this is a generic-pacakge, so it's not going to be
trivial.

Regards,
Yann E. MORIN.

>  +{
>  +  int fd;
>  +
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni Nov. 3, 2022, 10:23 p.m. UTC | #2
On Sun, 25 Sep 2022 17:24:52 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Drop static from first patch to fix the following build failure with
> gcc >= 11 and uclibc < 1.0.0 (prior to
> https://github.com/wbx-github/uclibc-ng/commit/5c484467f718a25e94a88b11bdbb670ddb1c0d0f):

This explanation can't be correct, because the build failure does not
occur with uclibc < 1.0.0. The build failure you're pointing to is
recent, so it was with a recent version of uclibc, as the build failure
configuration is using an internal toolchain. Or I'm missing something?

> 
> skinlcars.c:1105:12: error: 'int getloadavg(double*, int)' was declared 'extern' and later 'static' [-fpermissive]
>  1105 | static int getloadavg (double loadavg[], int nelem)
>       |            ^~~~~~~~~~
> In file included from /home/buildroot/autobuild/run/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/include/c++/11.3.0/cstdlib:75,
>                  from /home/buildroot/autobuild/run/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/include/c++/11.3.0/stdlib.h:36,
>                  from config.h:15,
>                  from channels.h:13,
>                  from skins.h:13,
>                  from skinlcars.h:13,
>                  from skinlcars.c:26:
> /home/buildroot/autobuild/run/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/include/stdlib.h:920:12: note: previous declaration of 'int getloadavg(double*, int)'
>   920 | extern int getloadavg (double __loadavg[], int __nelem)
>       |            ^~~~~~~~~~
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/2d9fe8548ccbbcad3f86051509bf811fedb1d8e9
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Also, Yann came up with some feedback. Have you had the chance to look
into it?

Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/vdr/0001-getloadavg.patch b/package/vdr/0001-getloadavg.patch
index 9e6316e284..fbb02d4dd1 100644
--- a/package/vdr/0001-getloadavg.patch
+++ b/package/vdr/0001-getloadavg.patch
@@ -4,6 +4,8 @@  Ported from
 https://github.com/stschake/buildroot-grasshopper/blob/master/package/torsmo/torsmo-0.18-uclibc-getloadavg.patch
 
 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+{Fabrice: drop static to fix build with gcc >= 11 and uclibc < 1.0.0]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 
 diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
 --- vdr-2.3.1.org/skinlcars.c	2015-09-01 12:07:07.000000000 +0200
@@ -14,7 +16,7 @@  diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
  
 +/* uclibc and dietlibc do not have this junk -ReneR */
 +#if defined (__UCLIBC__) || defined (__dietlibc__)
-+static int getloadavg (double loadavg[], int nelem)
++int getloadavg (double loadavg[], int nelem)
 +{
 +  int fd;
 +