grub-efi: fix build failure

grub-efi build fails with the following error on Fedora 26:

| ../grub-2.00/util/raid.c: In function 'grub_util_raid_getmembers':
| ../grub-2.00/util/raid.c:91:13: error: In the GNU C Library, "makedev"
is defined
|  by <sys/sysmacros.h>. For historical compatibility, it is
|  currently defined by <sys/types.h> as well, but we plan to
|  remove this soon. To use "makedev", include <sys/sysmacros.h>
|  directly. If you did not intend to use a system-defined macro
|  "makedev", you should undefine it after including <sys/types.h>.
[-Werror]
|         makedev (disk.major, disk.minor));
|              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Resolve the build error by backporting the fix from upstream.

[YOCTO #12595]

(From OE-Core rev: a57e3e387a962a253e8f4f1519141eb7f8ce5e41)

Signed-off-by: Maxin B. John <maxin.john@intel.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Maxin B. John 2018-03-22 10:53:07 +02:00 committed by Richard Purdie
parent e782da1fbd
commit b85ff208bc
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From 07662af7aed55bcec448bc2a6610de1f0cb62100 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Thu, 22 Dec 2016 22:48:25 +0300
Subject: [PATCH] configure: fix check for sys/sysmacros.h under glibc 2.25+
glibc 2.25 still includes sys/sysmacros.h in sys/types.h but also emits
deprecation warning. So test for sys/types.h succeeds in configure but later
compilation fails because we use -Werror by default.
While this is fixed in current autoconf GIT, we really cannot force everyone
to use bleeding edge (that is not even released right now). So run test under
-Werror as well to force proper detection.
This should have no impact on autoconf 2.70+ as AC_HEADER_MAJOR in this version
simply checks for header existence.
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/grub.git/commit/?id=07662af7aed55bcec448bc2a6610de1f0cb62100]
Reported and tested by Khem Raj <raj.khem@gmail.com>
Signed-off-by: Andrei Borzenkov <arvidjaar@gmail.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
configure.ac | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/configure.ac b/configure.ac
index dc56564..4e980c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -389,7 +389,14 @@ fi
# Check for functions and headers.
AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
+
+# glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation
+# warning which causes compilation failure later with -Werror. So use -Werror here
+# as well to force proper sys/sysmacros.h detection.
+SAVED_CFLAGS="$CFLAGS"
+CFLAGS="$HOST_CFLAGS -Werror"
AC_HEADER_MAJOR
+CFLAGS="$SAVED_CFLAGS"
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
#include <sys/param.h>
--
2.4.0

View File

@ -6,6 +6,7 @@ PR = "r3"
SRC_URI += " \
file://cfg \
file://0001-configure-fix-check-for-sys-sysmacros.h-under-glibc-.patch \
"
S = "${WORKDIR}/grub-${PV}"