Skip to contentSkip to conversation

package/file: fix build with gcc 4.8

PATCH Applied Fabrice Fontaine 5 participants 10 messages Jan 4, 2022 – Jan 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/file: fix build with gcc 4.8

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

---
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(+)
package/file/file.mk +1 -0
index 12647af8bb..62cec4b2c9 100644
@@ -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
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 8 lines · On Tue, 4 Jan 2022 21:54:55 +0100 Fabrice Fontaine…

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) {
^

Quoted 8 lines

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

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

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Fabrice Fontaine
Quoted 8 lines · On Tue, 4 Jan 2022 21:54:55 +0100 Fabrice Fontaine…

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) {
^

Quoted 4 lines

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

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

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
#3 lore raw

Hi,

Quoted 15 lines · Thomas Petazzoni
Quoted 11 lines · On Tue, 4 Jan 2022 21:54:55 +0100 Fabrice Fontaine…

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

Quoted 8 lines
Quoted 1 line

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.

Quoted 6 lines

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hello Fabrice, *,

Quoted 23 lines · Fabrice Fontaine

Hi,

Quoted 19 lines · Thomas Petazzoni
Quoted 8 lines · On Tue, 4 Jan 2022 21:54:55 +0100 Fabrice Fontaine…

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) {
^

Quoted 4 lines

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

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

Quoted 7 lines
Quoted 4 lines

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

Quoted 6 lines
Quoted 6 lines

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Quoted 7 lines

Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

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

#5 lore raw
Quoted 15 lines · On Sat, 8 Jan 2022 18:39:19 +0100 Peter Seiderer <[email protected]> wrote:

The difference seems to be:

	$ diff -ru file-5.38/configure.ac file-5.41/configure.ac
[...]
(quoted diff) +1 -1
@@ -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
[...]
Quoted 3 lines

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

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
#6 lore raw
Quoted 19 lines · Thomas Petazzoni
Quoted 15 lines · On Sat, 8 Jan 2022 18:39:19 +0100 Peter Seiderer <[email protected]> wrote:

The difference seems to be:

      $ diff -ru file-5.38/configure.ac file-5.41/configure.ac
[...]
(quoted diff) +1 -1
@@ -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
[...]
Quoted 8 lines
Quoted 3 lines

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.

Quoted 6 lines

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw
In reply to Thomas Petazzoni
Quoted 18 lines · Thomas Petazzoni
Quoted 15 lines · On Sat, 8 Jan 2022 18:39:19 +0100 Peter Seiderer <[email protected]> wrote:

The difference seems to be:

	$ diff -ru file-5.38/configure.ac file-5.41/configure.ac
[...]
(quoted diff) +1 -1
@@ -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
[...]
Quoted 8 lines
Quoted 3 lines

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
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw
Quoted 29 lines · Arnout Vandecappelle
Quoted 25 lines · Thomas Petazzoni
Quoted 15 lines · On Sat, 8 Jan 2022 18:39:19 +0100 Peter Seiderer <[email protected]> wrote:

The difference seems to be:

     $ diff -ru file-5.38/configure.ac file-5.41/configure.ac
[...]
(quoted diff) +1 -1
@@ -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
[...]
Quoted 3 lines

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?

Quoted 4 lines
Quoted 1 line

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

Quoted 3 lines

Regards,
Arnout

Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw
In reply to Fabrice Fontaine

Fabrice, All,

On 2022-01-04 21:54 +0100, Fabrice Fontaine spake thusly:

Quoted 10 lines

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.

Quoted 28 lines

---
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(+)
package/file/file.mk +1 -0
index 12647af8bb..62cec4b2c9 100644
@@ -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
Signature · 6 lines
2.34.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