diff mbox series

[v2,1/1] package/file: fix build with gcc 4.8

Message ID 20220104205455.3632671-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [v2,1/1] package/file: fix build with gcc 4.8 | expand

Commit Message

Fabrice Fontaine Jan. 4, 2022, 8:54 p.m. UTC
Fix the following build failure raised since bump to version 5.41 in
commit d38b72bcd75392a88b5100839ac410859d0a6a79:

readelf.c: In function 'do_auxv_note':
readelf.c:1046:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (size_t off = 0; off + elsize <= descsz; off += elsize) {
  ^

Fixes:
 - http://autobuild.buildroot.org/results/31cbc313fceb84c0cbb1969fca5ac44244871dbc

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Yann E. Morin):
 - Set ac_cv_prog_c99 for host as already done for target instead of
   adding an upstreamable patch

 package/file/file.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Petazzoni Jan. 7, 2022, 6:08 p.m. UTC | #1
On Tue,  4 Jan 2022 21:54:55 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following build failure raised since bump to version 5.41 in
> commit d38b72bcd75392a88b5100839ac410859d0a6a79:
> 
> readelf.c: In function 'do_auxv_note':
> readelf.c:1046:2: error: 'for' loop initial declarations are only allowed in C99 mode
>   for (size_t off = 0; off + elsize <= descsz; off += elsize) {
>   ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/31cbc313fceb84c0cbb1969fca5ac44244871dbc
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2 (after review of Yann E. Morin):
>  - Set ac_cv_prog_c99 for host as already done for target instead of
>    adding an upstreamable patch

Applied to master, thanks.

Thomas
Thomas Petazzoni Jan. 8, 2022, 10:51 a.m. UTC | #2
On Tue,  4 Jan 2022 21:54:55 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following build failure raised since bump to version 5.41 in
> commit d38b72bcd75392a88b5100839ac410859d0a6a79:
> 
> readelf.c: In function 'do_auxv_note':
> readelf.c:1046:2: error: 'for' loop initial declarations are only allowed in C99 mode
>   for (size_t off = 0; off + elsize <= descsz; off += elsize) {
>   ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/31cbc313fceb84c0cbb1969fca5ac44244871dbc
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

I am afraid it seems like this didn't fix the problem, see:

  http://autobuild.buildroot.net/results/957/9573e8b01d8f21cd89a67475daabdeef533d31d7/build-end.log

ac_cv_prog_cc_c99='-std=gnu99' is properly passed to the configure
script, but it still fails.

Thomas
Fabrice Fontaine Jan. 8, 2022, 4:13 p.m. UTC | #3
Hi,

Le sam. 8 janv. 2022 à 11:51, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Tue,  4 Jan 2022 21:54:55 +0100
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > Fix the following build failure raised since bump to version 5.41 in
> > commit d38b72bcd75392a88b5100839ac410859d0a6a79:
> >
> > readelf.c: In function 'do_auxv_note':
> > readelf.c:1046:2: error: 'for' loop initial declarations are only allowed in C99 mode
> >   for (size_t off = 0; off + elsize <= descsz; off += elsize) {
> >   ^
> >
> > Fixes:
> >  - http://autobuild.buildroot.org/results/31cbc313fceb84c0cbb1969fca5ac44244871dbc
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>
> I am afraid it seems like this didn't fix the problem, see:
>
>   http://autobuild.buildroot.net/results/957/9573e8b01d8f21cd89a67475daabdeef533d31d7/build-end.log
>
> ac_cv_prog_cc_c99='-std=gnu99' is properly passed to the configure
> script, but it still fails.
Indeed, I suggest to revert this commit and apply the version 1 of
this patch instead of trying to understand what is "broken" in the
configure script.
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Best Regards,

Fabrice
Peter Seiderer Jan. 8, 2022, 5:39 p.m. UTC | #4
Hello Fabrice, *,

On Sat, 8 Jan 2022 17:13:47 +0100, Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Hi,
> 
> Le sam. 8 janv. 2022 à 11:51, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> a écrit :
> >
> > On Tue,  4 Jan 2022 21:54:55 +0100
> > Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> >  
> > > Fix the following build failure raised since bump to version 5.41 in
> > > commit d38b72bcd75392a88b5100839ac410859d0a6a79:
> > >
> > > readelf.c: In function 'do_auxv_note':
> > > readelf.c:1046:2: error: 'for' loop initial declarations are only allowed in C99 mode
> > >   for (size_t off = 0; off + elsize <= descsz; off += elsize) {
> > >   ^
> > >
> > > Fixes:
> > >  - http://autobuild.buildroot.org/results/31cbc313fceb84c0cbb1969fca5ac44244871dbc
> > >
> > > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>  
> >
> > I am afraid it seems like this didn't fix the problem, see:
> >
> >   http://autobuild.buildroot.net/results/957/9573e8b01d8f21cd89a67475daabdeef533d31d7/build-end.log
> >
> > ac_cv_prog_cc_c99='-std=gnu99' is properly passed to the configure
> > script, but it still fails.  
> Indeed, I suggest to revert this commit and apply the version 1 of
> this patch instead of trying to understand what is "broken" in the
> configure script.

The difference seems to be:

	$ diff -ru file-5.38/configure.ac file-5.41/configure.ac
[...]
@@ -88,7 +88,7 @@
 AC_SUBST(WARNINGS)
 
 dnl Checks for programs.
-AC_PROG_CC_STDC
+AC_PROG_CC
 AC_USE_SYSTEM_EXTENSIONS
 AM_PROG_CC_C_O
 AC_C_BIGENDIAN
[...]

According to [1] AC_PROG_CC checks/enables c89 and AC_PROG_CC_STDC checks/enabls C99 (or
use AC_PROG_CC_C99 to be more explicit)..., note that with AC_PROG_CC the ac_cv_prog_cc_c99
feature is gone (still used for target/host in package/file/file.mk)...

Regards,
Peter	

[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/C-Compiler.html

> >
> > Thomas
> > --
> > Thomas Petazzoni, co-owner and CEO, Bootlin
> > Embedded Linux and Kernel engineering and training
> > https://bootlin.com  
> Best Regards,
> 
> Fabrice
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni Jan. 8, 2022, 6:38 p.m. UTC | #5
On Sat, 8 Jan 2022 18:39:19 +0100
Peter Seiderer <ps.report@gmx.net> wrote:

> The difference seems to be:
> 
> 	$ diff -ru file-5.38/configure.ac file-5.41/configure.ac
> [...]
> @@ -88,7 +88,7 @@
>  AC_SUBST(WARNINGS)
>  
>  dnl Checks for programs.
> -AC_PROG_CC_STDC
> +AC_PROG_CC
>  AC_USE_SYSTEM_EXTENSIONS
>  AM_PROG_CC_C_O
>  AC_C_BIGENDIAN
> [...]
> 
> According to [1] AC_PROG_CC checks/enables c89 and AC_PROG_CC_STDC checks/enabls C99 (or
> use AC_PROG_CC_C99 to be more explicit)..., note that with AC_PROG_CC the ac_cv_prog_cc_c99
> feature is gone (still used for target/host in package/file/file.mk)...

But why the solution we use for the target package doesn't work for the
host package?

Or perhaps we're no longer testing the target package with gcc 4.8 ?

Thomas
Fabrice Fontaine Jan. 8, 2022, 6:46 p.m. UTC | #6
Le sam. 8 janv. 2022 à 19:38, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Sat, 8 Jan 2022 18:39:19 +0100
> Peter Seiderer <ps.report@gmx.net> wrote:
>
> > The difference seems to be:
> >
> >       $ diff -ru file-5.38/configure.ac file-5.41/configure.ac
> > [...]
> > @@ -88,7 +88,7 @@
> >  AC_SUBST(WARNINGS)
> >
> >  dnl Checks for programs.
> > -AC_PROG_CC_STDC
> > +AC_PROG_CC
> >  AC_USE_SYSTEM_EXTENSIONS
> >  AM_PROG_CC_C_O
> >  AC_C_BIGENDIAN
> > [...]
> >
> > According to [1] AC_PROG_CC checks/enables c89 and AC_PROG_CC_STDC checks/enabls C99 (or
> > use AC_PROG_CC_C99 to be more explicit)..., note that with AC_PROG_CC the ac_cv_prog_cc_c99
> > feature is gone (still used for target/host in package/file/file.mk)...
>
> But why the solution we use for the target package doesn't work for the
> host package?
>
> Or perhaps we're no longer testing the target package with gcc 4.8 ?
host-file is a dependency of file that's why we have only build
failure with host-file.
Build failures are raised only since the bump.
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Best Regards,

Fabrice
Arnout Vandecappelle Jan. 8, 2022, 6:50 p.m. UTC | #7
On 08/01/2022 19:38, Thomas Petazzoni wrote:
> On Sat, 8 Jan 2022 18:39:19 +0100
> Peter Seiderer <ps.report@gmx.net> wrote:
> 
>> The difference seems to be:
>>
>> 	$ diff -ru file-5.38/configure.ac file-5.41/configure.ac
>> [...]
>> @@ -88,7 +88,7 @@
>>   AC_SUBST(WARNINGS)
>>   
>>   dnl Checks for programs.
>> -AC_PROG_CC_STDC
>> +AC_PROG_CC
>>   AC_USE_SYSTEM_EXTENSIONS
>>   AM_PROG_CC_C_O
>>   AC_C_BIGENDIAN
>> [...]
>>
>> According to [1] AC_PROG_CC checks/enables c89 and AC_PROG_CC_STDC checks/enabls C99 (or
>> use AC_PROG_CC_C99 to be more explicit)..., note that with AC_PROG_CC the ac_cv_prog_cc_c99
>> feature is gone (still used for target/host in package/file/file.mk)...
> 
> But why the solution we use for the target package doesn't work for the
> host package?
> 
> Or perhaps we're no longer testing the target package with gcc 4.8 ?

sourcery-arm*.config uses the CodeSourcery toolchain which has gcc 4.8, so yes 
we should be testing it with gcc 4.8...

  Regards,
  Arnout
Fabrice Fontaine Jan. 8, 2022, 8:41 p.m. UTC | #8
Le sam. 8 janv. 2022 à 19:50, Arnout Vandecappelle <arnout@mind.be> a écrit :
>
>
>
> On 08/01/2022 19:38, Thomas Petazzoni wrote:
> > On Sat, 8 Jan 2022 18:39:19 +0100
> > Peter Seiderer <ps.report@gmx.net> wrote:
> >
> >> The difference seems to be:
> >>
> >>      $ diff -ru file-5.38/configure.ac file-5.41/configure.ac
> >> [...]
> >> @@ -88,7 +88,7 @@
> >>   AC_SUBST(WARNINGS)
> >>
> >>   dnl Checks for programs.
> >> -AC_PROG_CC_STDC
> >> +AC_PROG_CC
> >>   AC_USE_SYSTEM_EXTENSIONS
> >>   AM_PROG_CC_C_O
> >>   AC_C_BIGENDIAN
> >> [...]
> >>
> >> According to [1] AC_PROG_CC checks/enables c89 and AC_PROG_CC_STDC checks/enabls C99 (or
> >> use AC_PROG_CC_C99 to be more explicit)..., note that with AC_PROG_CC the ac_cv_prog_cc_c99
> >> feature is gone (still used for target/host in package/file/file.mk)...
> >
> > But why the solution we use for the target package doesn't work for the
> > host package?
> >
> > Or perhaps we're no longer testing the target package with gcc 4.8 ?
>
> sourcery-arm*.config uses the CodeSourcery toolchain which has gcc 4.8, so yes
> we should be testing it with gcc 4.8...
Here is the first build failure with gcc 4.8:
http://autobuild.buildroot.org/results/9e7/9e7868be00f2cd18205b2ce664be95f8b9e2b063/build-end.log
>
>   Regards,
>   Arnout
Best Regards,

Fabrice
Yann E. MORIN Jan. 8, 2022, 10:04 p.m. UTC | #9
Fabrice, All,

On 2022-01-04 21:54 +0100, Fabrice Fontaine spake thusly:
> Fix the following build failure raised since bump to version 5.41 in
> commit d38b72bcd75392a88b5100839ac410859d0a6a79:
> 
> readelf.c: In function 'do_auxv_note':
> readelf.c:1046:2: error: 'for' loop initial declarations are only allowed in C99 mode
>   for (size_t off = 0; off + elsize <= descsz; off += elsize) {
>   ^
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/31cbc313fceb84c0cbb1969fca5ac44244871dbc

It turned out that all that was needed is to tun autoreconf. See the
commti for the explanations:
    https://git.buildroot.org/buildroot/commit/package/file/file.mk?id=590d89fdad50f48c120b91ac008cc2ea4b625e15

Thanks!

Regards,
Yann E. MORIN.

> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2 (after review of Yann E. Morin):
>  - Set ac_cv_prog_c99 for host as already done for target instead of
>    adding an upstreamable patch
> 
>  package/file/file.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/file/file.mk b/package/file/file.mk
> index 12647af8bb..62cec4b2c9 100644
> --- a/package/file/file.mk
> +++ b/package/file/file.mk
> @@ -9,6 +9,7 @@ FILE_SITE = ftp://ftp.astron.com/pub/file
>  FILE_DEPENDENCIES = host-file
>  HOST_FILE_DEPENDENCIES = host-zlib
>  FILE_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
> +HOST_FILE_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
>  FILE_INSTALL_STAGING = YES
>  FILE_LICENSE = BSD-2-Clause, BSD-4-Clause (one file), BSD-3-Clause (one file)
>  FILE_LICENSE_FILES = COPYING src/mygetopt.h src/vasprintf.c
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/file/file.mk b/package/file/file.mk
index 12647af8bb..62cec4b2c9 100644
--- a/package/file/file.mk
+++ b/package/file/file.mk
@@ -9,6 +9,7 @@  FILE_SITE = ftp://ftp.astron.com/pub/file
 FILE_DEPENDENCIES = host-file
 HOST_FILE_DEPENDENCIES = host-zlib
 FILE_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+HOST_FILE_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
 FILE_INSTALL_STAGING = YES
 FILE_LICENSE = BSD-2-Clause, BSD-4-Clause (one file), BSD-3-Clause (one file)
 FILE_LICENSE_FILES = COPYING src/mygetopt.h src/vasprintf.c