Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2011 11:05:24 -0400
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-hackers@freebsd.org, mdf@freebsd.org
Subject:   Re: Include file search path
Message-ID:  <AANLkTik8o5BwOj-a%2BFDMMMRD69CP0f6_07==ayCzt4vf@mail.gmail.com>
In-Reply-To: <201103300800.11548.jhb@freebsd.org>
References:  <AANLkTi=BiUVnzsGg83wwWPHjnTDR=XukhJ3UK6Bd5hvF@mail.gmail.com> <201103300800.11548.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Wed, Mar 30, 2011 at 8:00 AM, John Baldwin <jhb@freebsd.org> wrote:
> On Tuesday, March 29, 2011 5:20:30 pm mdf@freebsd.org wrote:
>> I thought I knew something about how the compiler looks for include
>> files, but now I think maybe I don't know much. :-)
>>
>> So here's what I'm pondering. =A0When I build a library, like e.g. libc,
>> where do the include files get pulled from? =A0They can't (shouldn't) be
>> the ones in /usr/include, but I don't see a -nostdinc like for the
>> kernel. =A0There are -I directives in the Makefile for
>> -I${.CURDIR}/include -I${.CURDIR}/../../include, etc., but that won't
>> remove /usr/include from the search path.
>>
>> I see in the gcc documentation that -I paths are searched before the
>> standards paths. =A0But isn't the lack of -nostdinc a bug (not just for
>> libc, but for any library in /usr/src/lib)? =A0It somewhat feels to me
>> that all of the libraries and binaries in the source distribution
>> should use -nostdinc and include only from the source distribution
>> itself. =A0This isn't always an issue, but for source upgrades it seems
>> crucial, and for a hacker it saves difficulties with having to install
>> headers before re-building.
>>
>> Is that the intent, and it's not fully implemented? =A0How badly would
>> things break if -nostdinc was included in e.g. bsd.lib.mk? (This would
>> break non-base libraries, yes? =A0But as a thought experiment for the
>> base, how far off are we?)
>
> If you are building a library by hand you do want to use the includes fro=
m
> /usr/include. =A0I am not sure how we accomplish during buildworld (but w=
e do).
> I think we actually build the compiler in the cross-tools stage such that
> it uses the /usr/include directory under {WORLDTMP} in place of /usr/incl=
ude
> in the default search path.
>
> Some other folks might be able to verify that (perhaps ru@?).
>
FWIW (I've been hacking around `buildworld' lately), yes, and the
`_includes' stage is responsible to populate ${WORLDTMP}/usr/include.
The same goes for ${WORLDTMP}/usr/lib and `_libraries'. That was with
a 7-stable tree, I'm not sure how clang integrates in all this. The
same way I suppose.

 - Arnaud

> --
> John Baldwin
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org=
"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik8o5BwOj-a%2BFDMMMRD69CP0f6_07==ayCzt4vf>