From: "Egger, Christoph" <chegger@amazon.de>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Patrick Welche <prlw1@cam.ac.uk>,
joerg@netbsd.org, Jan Beulich <JBeulich@suse.com>,
xen-devel@lists.xen.org
Subject: Re: stdbool.h -nostdinc XSA-55 trouble
Date: Wed, 14 Aug 2013 11:36:55 +0200 [thread overview]
Message-ID: <520B4FB7.6090708@amazon.de> (raw)
In-Reply-To: <1375975437.14651.7.camel@kazak.uk.xensource.com>
On 08.08.13 17:23, Ian Campbell wrote:
> On Thu, 2013-08-08 at 16:18 +0100, Patrick Welche wrote:
>> On Thu, Aug 08, 2013 at 02:11:16PM +0100, Jan Beulich wrote:
>>>>>> On 08.08.13 at 13:49, Patrick Welche <prlw1@cam.ac.uk> wrote:
>>>> I hope that this is the right list for compilation issues.
>>>>
>>>> When building libelf-tools.c with gcc 4.5.4 on NetBSD-current/amd64:
>>>>
>>>> In file included from libelf-private.h:25:0,
>>>> from libelf-tools.c:19:
>>>> /usr/src/local/xen/xen/include/xen/libelf.h:32:21: fatal error: stdbool.h:
>>>> No such file or directory
>>>>
>>>> I ran into this problem when trying to apply XSA-55 to xen 4.2.2, but
>>>> just reproduced it in -head.
>>>>
>>>> I think this issue stems from a combination of commit 7a549a6aa
>>>> ...
>>>> libelf: use C99 bool for booleans
>>>> ...
>>>> In this patch we change all the booleans in libelf to C99 bool,
>>>> from <stdbool.h>.
>>>>
>>>> and
>>>>
>>>> xen/arch/x86/Rules.mk:
>>>> ifneq ($(XEN_OS),SunOS)
>>>> CFLAGS-$(gcc) += -nostdinc
>>>> endif
>>>>
>>>> If I comment out the -nostdinc in Rules.mk, I get a successful "make xen".
>>>
>>> So perhaps NetBSD then needs a similar override as Solaris. But
>>> suppressing -nostdinc is a bad idea in general, and I wonder why
>>> this sits in a arch specific makefile instead of in xen/Rules.mk, as
>>> this ought to always be in effect for the hypervisor builds.
>>
>> Indeed: I wondered whether you were all working on the arm port so didn't
>> see it ;-)
>>
>>>> (One mystery: why aren't you all seeing this?)
>>>
>>> No mystery, but also not immediately obvious: -iwithprefix adds
>>> the compiler's include directory to the end of the include search
>>> paths, thus allowing stdbool.h and stdarg.h to be found. For
>>> stdarg.h (which you ought to have the same problem with in
>>> libelf/) xen/stdarg.h already has special treatment for
>>> __OpenBSD__ and __NetBSD__ (i.e. avoiding similar problems
>>> for all the cases where xen/stdarg.h is used instead of plain
>>> stdarg.h).
>>>
>>> Whether that's not the case on NetBSD, or whether that directory
>>> simply doesn't exist or is empty you'd need to find out on your
>>> installation.
>>
>> So, in xen/arch/x86/Rules.mk, there is "-iwithprefix include",
>> which means add "include" to the end of the directory defined
>> by the "-iprefix DIR" option. I just looked on an ubuntu 10 box,
>> and gcc -v lists "--prefix=/usr" which seems to be used as the
>> default value of -iprefix. The gcc compiler on the NetBSD box
>> doesn't list --prefix as one of its configure options, so
>> I don't know what directory is used as the default prefix. ""?
>>
>> diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
>> index 0a9d68d..223aa1c 100644
>> --- a/xen/arch/x86/Rules.mk
>> +++ b/xen/arch/x86/Rules.mk
>> @@ -26,7 +26,7 @@ CFLAGS-$(gcc) += -nostdinc
>> endif
>>
>> CFLAGS += -fno-builtin -fno-common -Wredundant-decls
>> -CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
>> +CFLAGS += -iprefix /usr/ -iwithprefix include -Werror -Wno-pointer-arith -pipe
>> CFLAGS += -I$(BASEDIR)/include
>> CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
>> CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
>>
>> also got me a successful build.
>> (/usr/include/stdbool.h is what we are aiming for.)
>
> At least on Debian we are actually aiming
> for /usr/lib/gcc/x86_64-linux-gnu/X.Y/include/stdbool.h
>
> I don't have /usr/include/stdbool.h. This makes sense since stdbool is,
> AIUI, a compiler provided interface, not a libc one.
>
> Perhaps this is a difference between Linux and BSD?
NetBSD does not use the compiler provided interface
and this is why gcc -print-search-dirs | grep install
is empty and stubdom does not build.
Adding Joerg Sonnenberger to CC. He can explain the details
why NetBSD does not use compiler provided interfaces.
Christoph
next prev parent reply other threads:[~2013-08-14 9:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 11:49 stdbool.h -nostdinc XSA-55 trouble Patrick Welche
2013-08-08 13:11 ` Jan Beulich
2013-08-08 15:18 ` Patrick Welche
2013-08-08 15:23 ` Ian Campbell
2013-08-08 15:39 ` Patrick Welche
2013-08-14 9:36 ` Egger, Christoph [this message]
2013-08-08 15:30 ` Jan Beulich
2013-08-08 15:47 ` Patrick Welche
2013-08-08 16:12 ` Ian Campbell
2013-08-08 17:26 ` Patrick Welche
2013-08-08 19:05 ` Andrew Cooper
2013-08-08 19:24 ` Ian Campbell
2013-08-08 19:52 ` Andrew Cooper
2013-08-09 7:50 ` Jan Beulich
2013-08-09 8:11 ` Patrick Welche
2013-08-09 8:16 ` Jan Beulich
2013-08-09 8:32 ` Patrick Welche
2013-08-09 8:33 ` Patrick Welche
2013-08-09 8:40 ` Jan Beulich
2013-08-09 15:13 ` Tim Deegan
2013-08-11 15:21 ` Patrick Welche
2013-08-09 6:44 ` Jan Beulich
2013-08-09 7:55 ` Patrick Welche
2013-08-11 16:41 ` Patrick Welche
2013-08-12 7:31 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=520B4FB7.6090708@amazon.de \
--to=chegger@amazon.de \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=joerg@netbsd.org \
--cc=prlw1@cam.ac.uk \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).