[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#890679: libxshmfence: FTBFS with glibc 2.27: error: implicit declaration of function 'memfd_create'



Source: libxshmfence
Version: 1.2-1
Severity: important
Tags: upstream patch
User: debian-glibc@lists.debian.org
Usertags: 2.27

libxshmfence 1.2-1 fails to build with glibc 2.27 (2.27-0experimental0 from
experimental):

| libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../src -I.. -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fvisibility=hidden -c ../../src/xshmfence_alloc.c  -fPIC -DPIC -o .libs/xshmfence_alloc.o
| ../../src/xshmfence_alloc.c: In function 'xshmfence_alloc_shm':
| ../../src/xshmfence_alloc.c:73:7: error: implicit declaration of function 'memfd_create'; did you mean 'SYS_memfd_create'? [-Werror=implicit-function-declaration]
|   fd = memfd_create("xshmfence", MFD_CLOEXEC|MFD_ALLOW_SEALING);
|        ^~~~~~~~~~~~
|        SYS_memfd_create
| ../../src/xshmfence_alloc.c:73:7: warning: nested extern declaration of 'memfd_create' [-Wnested-externs]
| cc1: some warnings being treated as errors
| Makefile:474: recipe for target 'xshmfence_alloc.lo' faile

A full build logs is available there:
http://aws-logs.debian.net/2018/02/07/glibc-exp/libxshmfence_1.2-1_unstable_glibc-exp.log

glibc 2.27 added support for memfd_create. libxshmfence correctly
detects in its configure script the availability of this function and
consequently disables its own syscall wrapper. Unfortunately this is 
not enough as memfd_create as a GNU extension and thus needs to be built
with _GNU_SOURCE.

The problem has been fixed in upstream commit 0b550a4e. I have also
attached it as a patch to this mail.
--- libxshmfence-1.2.orig/debian/patches/memfd_create.patch
+++ libxshmfence-1.2/debian/patches/memfd_create.patch
@@ -0,0 +1,29 @@
+From 0b550a4e7acf02d3478602848f6afbfcbfb0d4b2 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Mon, 29 Jan 2018 16:24:36 +0000
+Subject: configure.ac: call AC_USE_SYSTEM_EXTENSIONS
+
+With glibc 2.27 memfd_create() is inside a _GNU_SOURCE guard, so call
+AC_USE_SYSTEM_EXTENSIONS to get this defined.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 55772d0..ed77e6d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -28,6 +28,8 @@ AC_INIT([libxshmfence], [1.2],
+ AC_CONFIG_SRCDIR([Makefile.am])
+ AC_CONFIG_HEADERS([config.h])
+ 
++AC_USE_SYSTEM_EXTENSIONS
++
+ # Initialize Automake
+ AM_INIT_AUTOMAKE([foreign dist-bzip2])
+ 
+-- 
+cgit v1.1
+
--- libxshmfence-1.2.orig/debian/patches/series
+++ libxshmfence-1.2/debian/patches/series
@@ -0,0 +1 @@
+memfd_create.patch

Reply to: