* [Buildroot] [PATCH 1/1] package/gmp: fix target build with host gcc 4.9
@ 2024-03-12 19:09 Brandon Maier via buildroot
2024-03-15 20:43 ` Arnout Vandecappelle via buildroot
2024-03-15 23:43 ` [Buildroot] [PATCH v2 " Brandon Maier via buildroot
0 siblings, 2 replies; 6+ messages in thread
From: Brandon Maier via buildroot @ 2024-03-12 19:09 UTC (permalink / raw)
To: buildroot; +Cc: Brandon Maier, Thomas Petazzoni
GMP does not build if the host gcc is v4.9 due to the following error
gen-sieve.c: In function 'setmask':
gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (unsigned i = 0; i < 2 * a * b; ++i)
^
gen-sieve.c:99:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
The gen-sieve utility was added in GMP v6.3.0. It is built using
CC_FOR_BUILD (host compiler) during cross compilation as it generates
build files. Autoconf does not have a macro for add -std=c99 to
CC_FOR_BUILD, so it must be set manually.
Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
package/gmp/gmp.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk
index bd401c6a80..85836a8c72 100644
--- a/package/gmp/gmp.mk
+++ b/package/gmp/gmp.mk
@@ -14,6 +14,11 @@ GMP_CPE_ID_VENDOR = gmplib
GMP_DEPENDENCIES = host-m4
HOST_GMP_DEPENDENCIES = host-m4
+# The compiler for build requires C99 but GCC 4.9 defaults to C89
+ifeq ($(BR2_HOST_GCC_AT_LEAST_5),)
+GMP_CONF_ENV += CC_FOR_BUILD="$(HOSTCC) -std=c99"
+endif
+
# GMP doesn't support assembly for coldfire or mips r6 ISA yet
# Disable for ARM v7m since it has different asm constraints
ifeq ($(BR2_m68k_cf)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6)$(BR2_ARM_CPU_ARMV7M),y)
--
2.44.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/gmp: fix target build with host gcc 4.9 2024-03-12 19:09 [Buildroot] [PATCH 1/1] package/gmp: fix target build with host gcc 4.9 Brandon Maier via buildroot @ 2024-03-15 20:43 ` Arnout Vandecappelle via buildroot 2024-03-15 23:37 ` [Buildroot] [External] " Maier, Brandon Collins via buildroot 2024-03-15 23:43 ` [Buildroot] [PATCH v2 " Brandon Maier via buildroot 1 sibling, 1 reply; 6+ messages in thread From: Arnout Vandecappelle via buildroot @ 2024-03-15 20:43 UTC (permalink / raw) To: Brandon Maier, buildroot; +Cc: Thomas Petazzoni On 12/03/2024 20:09, Brandon Maier via buildroot wrote: > GMP does not build if the host gcc is v4.9 due to the following error Oh boy, are you still using host GCC 4.9? Poor man... > > gen-sieve.c: In function 'setmask': > gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode > for (unsigned i = 0; i < 2 * a * b; ++i) > ^ > gen-sieve.c:99:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code > > The gen-sieve utility was added in GMP v6.3.0. It is built using > CC_FOR_BUILD (host compiler) during cross compilation as it generates > build files. Autoconf does not have a macro for add -std=c99 to > CC_FOR_BUILD, so it must be set manually. > > Signed-off-by: Brandon Maier <brandon.maier@collins.com> > --- > package/gmp/gmp.mk | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk > index bd401c6a80..85836a8c72 100644 > --- a/package/gmp/gmp.mk > +++ b/package/gmp/gmp.mk > @@ -14,6 +14,11 @@ GMP_CPE_ID_VENDOR = gmplib > GMP_DEPENDENCIES = host-m4 > HOST_GMP_DEPENDENCIES = host-m4 > > +# The compiler for build requires C99 but GCC 4.9 defaults to C89 I don't think the comment is really needed. > +ifeq ($(BR2_HOST_GCC_AT_LEAST_5),) In all the other places where we pass -std=c99, we do that unconditionally. So I'd do the same here. > +GMP_CONF_ENV += CC_FOR_BUILD="$(HOSTCC) -std=c99" Don't you need something similar for host-gmp as well? All the rest I could have fixed up while applying, but I don't have a host gcc 4.9 with which to test host-gmp :-) Regards, Arnout > +endif > + > # GMP doesn't support assembly for coldfire or mips r6 ISA yet > # Disable for ARM v7m since it has different asm constraints > ifeq ($(BR2_m68k_cf)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6)$(BR2_ARM_CPU_ARMV7M),y) _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [External] Re: [PATCH 1/1] package/gmp: fix target build with host gcc 4.9 2024-03-15 20:43 ` Arnout Vandecappelle via buildroot @ 2024-03-15 23:37 ` Maier, Brandon Collins via buildroot 0 siblings, 0 replies; 6+ messages in thread From: Maier, Brandon Collins via buildroot @ 2024-03-15 23:37 UTC (permalink / raw) To: Arnout Vandecappelle, buildroot@buildroot.org; +Cc: Thomas Petazzoni Hi Arnout, > -----Original Message----- > From: Arnout Vandecappelle <arnout@mind.be> > Sent: Friday, March 15, 2024 3:44 PM > To: Maier, Brandon Collins <Brandon.Maier@collins.com>; > buildroot@buildroot.org > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> > Subject: [External] Re: [Buildroot] [PATCH 1/1] package/gmp: fix target build with > host gcc 4.9 > > > > On 12/03/2024 20:09, Brandon Maier via buildroot wrote: > > GMP does not build if the host gcc is v4.9 due to the following error > > Oh boy, are you still using host GCC 4.9? Poor man... Yeah, it's not great > > > > > gen-sieve.c: In function 'setmask': > > gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 or > C11 mode > > for (unsigned i = 0; i < 2 * a * b; ++i) > > ^ > > gen-sieve.c:99:3: note: use option -std=c99, -std=gnu99, -std=c11 or - > std=gnu11 to compile your code > > > > The gen-sieve utility was added in GMP v6.3.0. It is built using > > CC_FOR_BUILD (host compiler) during cross compilation as it generates > > build files. Autoconf does not have a macro for add -std=c99 to > > CC_FOR_BUILD, so it must be set manually. > > > > Signed-off-by: Brandon Maier <brandon.maier@collins.com> > > --- > > package/gmp/gmp.mk | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk > > index bd401c6a80..85836a8c72 100644 > > --- a/package/gmp/gmp.mk > > +++ b/package/gmp/gmp.mk > > @@ -14,6 +14,11 @@ GMP_CPE_ID_VENDOR = gmplib > > GMP_DEPENDENCIES = host-m4 > > HOST_GMP_DEPENDENCIES = host-m4 > > > > +# The compiler for build requires C99 but GCC 4.9 defaults to C89 > > I don't think the comment is really needed. > > > +ifeq ($(BR2_HOST_GCC_AT_LEAST_5),) > > In all the other places where we pass -std=c99, we do that unconditionally. So > I'd do the same here. > > > +GMP_CONF_ENV += CC_FOR_BUILD="$(HOSTCC) -std=c99" > > Don't you need something similar for host-gmp as well? All the rest I could > have fixed up while applying, but I don't have a host gcc 4.9 with which to test > host-gmp :-) The issue only occurs when cross-compiling because Autoconf does not set -std=c99 for the host compiler. When host compiling, Autoconf uses the same compiler for target as host, and target it does correctly enable -std=c99 using AC_PROG_CC_C99. As far as I could find, there is no AC_PROG_CC_C99 equivalent for the host compiler. That's my understanding anyway, I have very little experience dealing with Autotools. Agree with the other comments, I can resend with those fixed. Thanks, Brandon _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v2 1/1] package/gmp: fix target build with host gcc 4.9 2024-03-12 19:09 [Buildroot] [PATCH 1/1] package/gmp: fix target build with host gcc 4.9 Brandon Maier via buildroot 2024-03-15 20:43 ` Arnout Vandecappelle via buildroot @ 2024-03-15 23:43 ` Brandon Maier via buildroot 2024-03-24 15:44 ` Arnout Vandecappelle via buildroot 2024-03-25 9:04 ` Peter Korsgaard 1 sibling, 2 replies; 6+ messages in thread From: Brandon Maier via buildroot @ 2024-03-15 23:43 UTC (permalink / raw) To: buildroot; +Cc: Brandon Maier GMP does not build if the host gcc is v4.9 due to the following error gen-sieve.c: In function 'setmask': gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode for (unsigned i = 0; i < 2 * a * b; ++i) ^ gen-sieve.c:99:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code The gen-sieve utility was added in GMP v6.3.0. It is built using CC_FOR_BUILD (host compiler) during cross compilation as it generates build files. Autoconf does not have a macro for add -std=c99 to CC_FOR_BUILD, so it must be set manually. Signed-off-by: Brandon Maier <brandon.maier@collins.com> --- v1: https://patchwork.ozlabs.org/project/buildroot/patch/20240312190954.71227-1-brandon.maier@collins.com/ v2: - remove unnecessary comment and ifdef check --- package/gmp/gmp.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk index bd401c6a80..7e8da9025c 100644 --- a/package/gmp/gmp.mk +++ b/package/gmp/gmp.mk @@ -14,6 +14,8 @@ GMP_CPE_ID_VENDOR = gmplib GMP_DEPENDENCIES = host-m4 HOST_GMP_DEPENDENCIES = host-m4 +GMP_CONF_ENV += CC_FOR_BUILD="$(HOSTCC) -std=c99" + # GMP doesn't support assembly for coldfire or mips r6 ISA yet # Disable for ARM v7m since it has different asm constraints ifeq ($(BR2_m68k_cf)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6)$(BR2_ARM_CPU_ARMV7M),y) -- 2.44.0 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v2 1/1] package/gmp: fix target build with host gcc 4.9 2024-03-15 23:43 ` [Buildroot] [PATCH v2 " Brandon Maier via buildroot @ 2024-03-24 15:44 ` Arnout Vandecappelle via buildroot 2024-03-25 9:04 ` Peter Korsgaard 1 sibling, 0 replies; 6+ messages in thread From: Arnout Vandecappelle via buildroot @ 2024-03-24 15:44 UTC (permalink / raw) To: Brandon Maier, buildroot Hi Brandon, On 16/03/2024 00:43, Brandon Maier wrote: > GMP does not build if the host gcc is v4.9 due to the following error > > gen-sieve.c: In function 'setmask': > gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode > for (unsigned i = 0; i < 2 * a * b; ++i) > ^ > gen-sieve.c:99:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code > > The gen-sieve utility was added in GMP v6.3.0. It is built using > CC_FOR_BUILD (host compiler) during cross compilation as it generates > build files. Autoconf does not have a macro for add -std=c99 to > CC_FOR_BUILD, so it must be set manually. I've added the explanation you gave why this is not needed for the target. Applied to master, thanks. Regards, Arnout > > Signed-off-by: Brandon Maier <brandon.maier@collins.com> > --- > v1: https://patchwork.ozlabs.org/project/buildroot/patch/20240312190954.71227-1-brandon.maier@collins.com/ > > v2: > - remove unnecessary comment and ifdef check > --- > package/gmp/gmp.mk | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk > index bd401c6a80..7e8da9025c 100644 > --- a/package/gmp/gmp.mk > +++ b/package/gmp/gmp.mk > @@ -14,6 +14,8 @@ GMP_CPE_ID_VENDOR = gmplib > GMP_DEPENDENCIES = host-m4 > HOST_GMP_DEPENDENCIES = host-m4 > > +GMP_CONF_ENV += CC_FOR_BUILD="$(HOSTCC) -std=c99" > + > # GMP doesn't support assembly for coldfire or mips r6 ISA yet > # Disable for ARM v7m since it has different asm constraints > ifeq ($(BR2_m68k_cf)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6)$(BR2_ARM_CPU_ARMV7M),y) _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH v2 1/1] package/gmp: fix target build with host gcc 4.9 2024-03-15 23:43 ` [Buildroot] [PATCH v2 " Brandon Maier via buildroot 2024-03-24 15:44 ` Arnout Vandecappelle via buildroot @ 2024-03-25 9:04 ` Peter Korsgaard 1 sibling, 0 replies; 6+ messages in thread From: Peter Korsgaard @ 2024-03-25 9:04 UTC (permalink / raw) To: Brandon Maier via buildroot; +Cc: Brandon Maier >>>>> "Brandon" == Brandon Maier via buildroot <buildroot@buildroot.org> writes: > GMP does not build if the host gcc is v4.9 due to the following error > gen-sieve.c: In function 'setmask': > gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode > for (unsigned i = 0; i < 2 * a * b; ++i) > ^ > gen-sieve.c:99:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code > The gen-sieve utility was added in GMP v6.3.0. It is built using > CC_FOR_BUILD (host compiler) during cross compilation as it generates > build files. Autoconf does not have a macro for add -std=c99 to > CC_FOR_BUILD, so it must be set manually. > Signed-off-by: Brandon Maier <brandon.maier@collins.com> > --- > v1: https://patchwork.ozlabs.org/project/buildroot/patch/20240312190954.71227-1-brandon.maier@collins.com/ > v2: > - remove unnecessary comment and ifdef check Committed to 2024.02.x and 2023.11.x, thanks. -- Bye, Peter Korsgaard _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-25 9:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-12 19:09 [Buildroot] [PATCH 1/1] package/gmp: fix target build with host gcc 4.9 Brandon Maier via buildroot 2024-03-15 20:43 ` Arnout Vandecappelle via buildroot 2024-03-15 23:37 ` [Buildroot] [External] " Maier, Brandon Collins via buildroot 2024-03-15 23:43 ` [Buildroot] [PATCH v2 " Brandon Maier via buildroot 2024-03-24 15:44 ` Arnout Vandecappelle via buildroot 2024-03-25 9:04 ` Peter Korsgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox