Errors with GLIBC2.27 while building current Yocto (QEMU and e2fsprogs) - Solution added, please check

Hi guys,

I’m having some problems which seem to be related to the 2.27 version of GLIBC while trying to build angstrom-lxde-image from Yocto in the latest version for a client, in a Xubuntu 18.04 (newest LTS, PRETTY_NAME=“Ubuntu 18.04 LTS”). I added the following lines to the local.conf file in order to add Japanese as a default locale:

IMAGE_LINGUAS ?= "ja-jp ja-jp.euc-jp"

This was tested for machines apalis-imx6 and colibri-imx7 and WITHOUT the changes in local.conf it also happens.

Error appeared in recipe qemu-native :

/home/alvaro/Toradex/client/oe-core/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/util/memfd.c:40:12: error: static declaration of ‘memfd_create’ follows non-static declaration
 static int memfd_create(const char *name, unsigned int flags)
In file included from /usr/include/x86_64-linux-gnu/bits/mman-linux.h:115:0,
                 from /usr/include/x86_64-linux-gnu/bits/mman.h:45,
                 from /usr/include/x86_64-linux-gnu/sys/mman.h:41,
                 from /home/alvaro/Toradex/client/oe-core/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/include/sysemu/os-posix.h:29,
                 from /home/alvaro/Toradex/client/oe-core/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/include/qemu/osdep.h:104,
                 from /home/alvaro/Toradex/client/oe-core/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/util/memfd.c:28:
/usr/include/x86_64-linux-gnu/bits/mman-shared.h:46:5: note: previous declaration of ‘memfd_create’ was here
 int memfd_create (const char *__name, unsigned int __flags) __THROW;
/home/alvaro/Toradex/client/oe-core/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/rules.mak:66: recipe for target 'util/memfd.o' failed

Looking a little bit, I found it was mostly a typo and a patch was issued already:;a=commitdiff;h=75e5b70e6b5dcc4f2219992d7cffa462aa406af0

I tried it already modifying the recipe and adding the patch by hand and it works :slight_smile: I’m adding the procedure I followed in case a customer reports the same issue.

I modified layers/openembedded-core /meta/recipes-devtools/qemu/ and added

           file://0004-Add-support-for-VM-suspend-resume-for-TPM-TIS-v2.9.patch \
	   +  file://0005-memfd.patch \
           file://apic-fixup-fallthrough-to-PIC.patch \

Then created a file with the same name I wrote, in this case 0005-memfd.patch, and copied the contents of the patch:

From 75e5b70e6b5dcc4f2219992d7cffa462aa406af0 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <>
Date: Tue, 28 Nov 2017 11:51:27 +0100
Subject: [PATCH] memfd: fix configure test
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Recent glibc added memfd_create in sys/mman.h.  This conflicts with
the definition in util/memfd.c:

    /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration

Fix the configure test, and remove the sys/memfd.h inclusion since the
file actually does not exist---it is a typo in the memfd_create(2) man

Cc: Marc-André Lureau <>
Signed-off-by: Paolo Bonzini <>
 configure    | 2 +-
 util/memfd.c | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 9c8aa5a..99ccc17 100755
--- a/configure
+++ b/configure
@@ -3923,7 +3923,7 @@ fi
 # check if memfd is supported
 cat > $TMPC << EOF
-#include <sys/memfd.h>
+#include <sys/mman.h>
 int main(void)
diff --git a/util/memfd.c b/util/memfd.c
index 4571d1a..412e94a 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -31,9 +31,7 @@
 #include "qemu/memfd.h"
-#include <sys/memfd.h>
-#elif defined CONFIG_LINUX
+#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
 #include <sys/syscall.h>
 #include <asm/unistd.h>

I’m also having a problem with e2fsprogs. It seems there is a conflict for 'copy_file_range_ in version 1.43.5. More info here: buildroot compile failure on Debian Buster (testing) · Issue #52 · sifive/freedom-u-sdk · GitHub. Fear not, the solution is published in the same post, a bit lower: it seems it was solved in version 1.43.8 :slight_smile:
E2fsprogs Release Notes

Programming notes
Fix compatibility problems with glibc 2.27 casued by a collision with copy_file_range().

However I haven’t tested this yet (First thing tomorrow tho). Some other good news is that they seem to be applied in the latest commit for rocko: e2fsprogs: fix compatibility with glibc 2.27 · openembedded/openembedded-core@0dbe43e · GitHub which adds the backport from 1.43.8 to 1.43.5

Anyway, I wanted to tell you guys, since it makes no harm in calling it out! Maybe more errors appear as the building progresses.


I tried witih Ubuntu 18.04 LTS too, but 2.7:

I confirm that applying the backport patch to current version solved the e2fsprogs issue:

That with the QEMU patch,;a=commitdiff;h=75e5b70e6b5dcc4f2219992d7cffa462aa406af0
the building completes in 18.04 LTS with Ubuntu GLIBC 2.27-3ubuntu1

Hi Alvaro, Thanks for the update.