Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [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

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