Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/ethtool: fix build failure
@ 2023-05-20 21:12 Dario Binacchi
  2023-05-21 15:23 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Dario Binacchi @ 2023-05-20 21:12 UTC (permalink / raw)
  To: buildroot; +Cc: dario.binacchi

When I was fixing a build failure for the libmnl package ([1]), I got
this error for the ethtool compilation:

netlink/rss.c: In function 'rss_reply_cb':
netlink/rss.c:166:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
   ^
netlink/rss.c:166:3: note: use option -std=c99 or -std=gnu99 to compile your code

[1] http://autobuild.buildroot.net/results/15f6dc103eec7bdeb5020acbc0ae99dc97c00e4e
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 package/ethtool/ethtool.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/ethtool/ethtool.mk b/package/ethtool/ethtool.mk
index a35e274bc442..c72d59be3767 100644
--- a/package/ethtool/ethtool.mk
+++ b/package/ethtool/ethtool.mk
@@ -20,4 +20,6 @@ else
 ETHTOOL_CONF_OPTS += --disable-netlink
 endif
 
+ETHTOOL_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
+
 $(eval $(autotools-package))
-- 
2.32.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/ethtool: fix build failure
  2023-05-20 21:12 [Buildroot] [PATCH 1/1] package/ethtool: fix build failure Dario Binacchi
@ 2023-05-21 15:23 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2023-05-21 15:23 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: buildroot

Dario, All,

On 2023-05-20 23:12 +0200, Dario Binacchi spake thusly:
> When I was fixing a build failure for the libmnl package ([1]), I got
> this error for the ethtool compilation:
> 
> netlink/rss.c: In function 'rss_reply_cb':
> netlink/rss.c:166:3: error: 'for' loop initial declarations are only allowed in C99 mode
>    for (unsigned int i = 0; i < get_count(hash_funcs); i++) {
>    ^
> netlink/rss.c:166:3: note: use option -std=c99 or -std=gnu99 to compile your code
> 
> [1] http://autobuild.buildroot.net/results/15f6dc103eec7bdeb5020acbc0ae99dc97c00e4e
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>  package/ethtool/ethtool.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/ethtool/ethtool.mk b/package/ethtool/ethtool.mk
> index a35e274bc442..c72d59be3767 100644
> --- a/package/ethtool/ethtool.mk
> +++ b/package/ethtool/ethtool.mk
> @@ -20,4 +20,6 @@ else
>  ETHTOOL_CONF_OPTS += --disable-netlink
>  endif
>  
> +ETHTOOL_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"

The proper solution is to add AC_PROG_CC_C99 to configure.ac, and check
that ac_cv_prog_cc_c99 is not set to 'no':

    https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/C-Compiler.html#index-AC_005fPROG_005fCC_005fC99-866

(and then needs AUTORECONF=YES)

Alternatively, if upstream does not really need a C99 compiler, maybe
move the variable declaration out of the for-loop.

Regards,
Yann E. MORIN.

>  $(eval $(autotools-package))
> -- 
> 2.32.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-21 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-20 21:12 [Buildroot] [PATCH 1/1] package/ethtool: fix build failure Dario Binacchi
2023-05-21 15:23 ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox