Skip to contentSkip to conversation

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

PATCH In review Fabrice Fontaine 3 participants 3 messages Sep 25, 2022 – Nov 3, 2022

lore
Share & tools
lore
#0 lore raw

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

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

---
 package/vdr/0001-getloadavg.patch | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/vdr/0001-getloadavg.patch +3 -1
index 9e6316e284..fbb02d4dd1 100644
@@ -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 <[email protected]>
+{Fabrice: drop static to fix build with gcc >= 11 and uclibc < 1.0.0]
+Signed-off-by: Fabrice Fontaine <[email protected]>
 
 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;
 +
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Fabrice, All,

On 2022-09-25 17:24 +0200, Fabrice Fontaine spake thusly:

Quoted 3 lines

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--]

package/vdr/0001-getloadavg.patch diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c · line 19

Quoted 8 lines

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

package/vdr/0001-getloadavg.patch +1 -1
@@ -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.

Quoted 10 lines
package/vdr/0001-getloadavg.patch +0 -0
 +{
 +  int fd;
 +
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Fabrice Fontaine
Quoted 3 lines · On Sun, 25 Sep 2022 17:24:52 +0200 Fabrice Fontaine…

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?

Quoted 15 lines

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)
      |            ^~~~~~~~~~
Quoted 4 lines

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

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

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot