[Buildroot] [PATCH 2/2] host-m4: fix build when -std=gnu99 and inline functions are used

Lada Trimasova Lada.Trimasova at synopsys.com
Thu Feb 25 12:58:05 UTC 2016


Hi Thomas,

I used CentOS 5.7, gcc 4.9.2, glibc 2.5.

Regards,
Lada
On Thu, 2016-02-25 at 13:54 +0100, Thomas Petazzoni wrote:

Dear Lada Trimasova,

On Thu, 25 Feb 2016 14:37:10 +0300, Lada Trimasova wrote:


A lot of the glibc header files use extern inline, which causes
GCC to emit a symbol for each extern inline functions and it causes
functions multiple definition error when "-std=gnu99" is used.
To fix this problem it's necessary to use "-fgnu89-inline" option which
tells GCC to use the traditional GNU semantics for inline functions when
in C99 mode.



I'm using gcc 5.x on my laptop, which I believe defaults to -std=gnu99,
and host-m4 builds fine for me. Could you describe more precisely in
which cases host-m4 doesn't build for you?



diff --git a/package/m4/m4.mk b/package/m4/m4.mk
index 9b5d2d1..2644bb1 100644
--- a/package/m4/m4.mk
+++ b/package/m4/m4.mk
@@ -10,5 +10,6 @@ M4_SITE = $(BR2_GNU_MIRROR)/m4
 M4_LICENSE = GPLv3+
 M4_LICENSE_FILES = COPYING
 HOST_M4_CONF_OPTS = --disable-static
+HOST_M4_MAKE_OPTS = CFLAGS="-fgnu89-inline"



I think it's cleaner to pass this in the configure script environment,
i.e:

HOST_M4_CONF_ENV = \
        CFLAGS="$(HOST_CFLAGS) -fgnu89-inline"

(Same comments for the host-tar patch).

Thanks,

Thomas



More information about the buildroot mailing list