From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752285AbbDCLCr (ORCPT ); Fri, 3 Apr 2015 07:02:47 -0400 Received: from svenfoo.org ([82.94.215.22]:49547 "EHLO mail.zonque.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752696AbbDCLCj (ORCPT ); Fri, 3 Apr 2015 07:02:39 -0400 Message-ID: <551E734C.2020601@zonque.org> Date: Fri, 03 Apr 2015 13:02:36 +0200 From: Daniel Mack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andrew Morton , Greg KH CC: dh.herrmann@gmail.com, jslaby@suse.cz, tixxdz@opendz.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] samples: kdbus: build kdbus-workers conditionally References: <5511A0D6.5030606@suse.cz> <1427807494-29982-1-git-send-email-daniel@zonque.org> <20150401124720.GA22629@kroah.com> <20150401144121.c1ae57c1d6ab5562a1fca766@linux-foundation.org> In-Reply-To: <20150401144121.c1ae57c1d6ab5562a1fca766@linux-foundation.org> Content-Type: multipart/mixed; boundary="------------040108010502030809070406" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------040108010502030809070406 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Andrew, On 04/01/2015 11:41 PM, Andrew Morton wrote: > On Wed, 1 Apr 2015 14:47:20 +0200 Greg KH wrote: > >> On Tue, Mar 31, 2015 at 03:11:34PM +0200, Daniel Mack wrote: >>> Give the kdbus sample its own config switch and only build it if it's >>> explicitly switched on. >>> >>> Signed-off-by: Daniel Mack >>> Reviewed-by: David Herrmann >>> Reported-by: Jiri Slaby >>> --- >>> samples/Kconfig | 7 +++++++ >>> samples/kdbus/Makefile | 2 +- >>> 2 files changed, 8 insertions(+), 1 deletion(-) >> >> Now applied, thanks. > > Is this going to fix i386 allmodconfig, currently unhappy on my Fedora > Core 6 (lol) machine? As allmodconfig will select CONFIG_SAMPLE_KDBUS just as it selected CONFIG_SAMPLES, that won't help, no. > samples/kdbus/kdbus-workers.c:73:26: error: sys/signalfd.h: No such file or directory > samples/kdbus/kdbus-workers.c: In function 'master_new': > samples/kdbus/kdbus-workers.c:231: warning: implicit declaration of function 'signalfd' > samples/kdbus/kdbus-workers.c:231: error: 'SFD_CLOEXEC' undeclared (first use in this function) > samples/kdbus/kdbus-workers.c:231: error: (Each undeclared identifier is reported only once > samples/kdbus/kdbus-workers.c:231: error: for each function it appears in.) > samples/kdbus/kdbus-workers.c: In function 'master_handle_signal': > samples/kdbus/kdbus-workers.c:406: error: storage size of 'val' isn't known > samples/kdbus/kdbus-workers.c:406: warning: unused variable 'val' > samples/kdbus/kdbus-workers.c: In function 'child_run': > samples/kdbus/kdbus-workers.c:773: error: 'CLOCK_MONOTONIC_COARSE' undeclared (first use in this function) > samples/kdbus/kdbus-workers.c: In function 'bus_open_connection': > samples/kdbus/kdbus-workers.c:1038: error: 'O_CLOEXEC' undeclared (first use in this function) > samples/kdbus/kdbus-workers.c: In function 'bus_make': > samples/kdbus/kdbus-workers.c:1275: error: 'O_CLOEXEC' undeclared (first use in this function) Hmm, so your libc headers lack support for signalfds, which were introduced in kernel v2.6.22 (2007), one year after the release of your distribution. We can't probe for the existance of files in the local toolchain before compilation with kdbuild, so we have to stub out the code for glibc version that are known to lack features. This isn't particularly nice, but it should work. Does the attached patch work for you? Thanks, Daniel --------------040108010502030809070406 Content-Type: text/x-diff; name="0001-samples-kdbus-stub-out-code-for-glibc-2.7.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-samples-kdbus-stub-out-code-for-glibc-2.7.patch" =46rom 37871360c096b68928750903ac29968a7932e873 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 3 Apr 2015 12:41:52 +0200 Subject: [PATCH] samples: kdbus: stub out code for glibc < 2.7 Andrew Morton reports the following build error in samples/kdbus on Fedor= a Core 6: samples/kdbus/kdbus-workers.c:73:26: error: sys/signalfd.h: No such fil= e or directory samples/kdbus/kdbus-workers.c: In function 'master_new': samples/kdbus/kdbus-workers.c:231: warning: implicit declaration of fun= ction 'signalfd' samples/kdbus/kdbus-workers.c:231: error: 'SFD_CLOEXEC' undeclared (fir= st use in this function) samples/kdbus/kdbus-workers.c:231: error: (Each undeclared identifier i= s reported only once samples/kdbus/kdbus-workers.c:231: error: for each function it appears = in.) samples/kdbus/kdbus-workers.c: In function 'master_handle_signal': samples/kdbus/kdbus-workers.c:406: error: storage size of 'val' isn't k= nown samples/kdbus/kdbus-workers.c:406: warning: unused variable 'val' samples/kdbus/kdbus-workers.c: In function 'child_run': samples/kdbus/kdbus-workers.c:773: error: 'CLOCK_MONOTONIC_COARSE' unde= clared (first use in this function) samples/kdbus/kdbus-workers.c: In function 'bus_open_connection': samples/kdbus/kdbus-workers.c:1038: error: 'O_CLOEXEC' undeclared (firs= t use in this function) samples/kdbus/kdbus-workers.c: In function 'bus_make': samples/kdbus/kdbus-workers.c:1275: error: 'O_CLOEXEC' undeclared (firs= t use in this function) Fedora Core 6 was released in 2006, which predates the introduction of signalfds in the kernel (v2.6.22, 2007). The example cannot be built without signalfds, and kbuild cannot depend o= n specific features of the local libc when building userspace executables, = so we have to work around the issue by checking for specific glibc versions = at compile time and stub the entire thing if it can't be compiled. Signed-off-by: Daniel Mack Reported-by: Andrew Morton --- samples/kdbus/kdbus-workers.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/samples/kdbus/kdbus-workers.c b/samples/kdbus/kdbus-workers.= c index d1d8f7a..e9ecec8 100644 --- a/samples/kdbus/kdbus-workers.c +++ b/samples/kdbus/kdbus-workers.c @@ -57,6 +57,12 @@ * top-down, but requires some forward-declarations. Just ignore those. */ =20 +#include +#include + +/* glibc < 2.7 does not ship sys/signalfd.h */ +#if __GLIBC__ >=3D 2 && __GLIBC_MINOR__ >=3D 7 + #include #include #include @@ -65,8 +71,6 @@ #include #include #include -#include -#include #include #include #include @@ -1324,3 +1328,18 @@ static int bus_make(uid_t uid, const char *name) =20 return fd; } + +#else + +#warning "Skipping compilation due to unsupported libc version" + +int main(int argc, char **argv) +{ + fprintf(stderr, + "Compilation of %s was skipped due to unsupported libc.\n", + argv[0]); + + return EXIT_FAILURE; +} + +#endif /* libc sanity check */ --=20 2.3.4 --------------040108010502030809070406--