From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 30 15:05:26 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAE46106566B for ; Wed, 30 Mar 2011 15:05:25 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7F61B8FC0A for ; Wed, 30 Mar 2011 15:05:25 +0000 (UTC) Received: by gyg13 with SMTP id 13so633679gyg.13 for ; Wed, 30 Mar 2011 08:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ceYKLIj6vNJzPygtuN7h4QWAOZ+QhCbRAuyku3loCHU=; b=ozdMWsNzT+/mALG8btKGrPCQqZw7y0OSN6EbL3TA47lwzvMJizysUXZtWWxP9kJrGg 8CsQzWkWX+QNTkzJvRBqrcyf7n0bCSDVtWKX0xxgcJltSmo2gN2WiwfGVRjficWdeOS1 cqX94RfZmeDjcE8k9/GLFkI1jI+vnKMNZduCU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=lTqRvBgCBoV1Q5VFAxQUHkP97gRgix7pmB52nCtUXjdujdjM7pMmVWN2RqM1Hx+3wZ 00ktop/8OWl2dngMQPcNNSNmt4AkSk00DF+Pk4GAP6/Nlc9EnD8yYuKV6KM0IZxU6vBG rkN8BPlARBTZglAMLQFxpzjppK8C9QJAKVHOI= MIME-Version: 1.0 Received: by 10.231.197.27 with SMTP id ei27mr1260235ibb.198.1301497524592; Wed, 30 Mar 2011 08:05:24 -0700 (PDT) Received: by 10.42.146.72 with HTTP; Wed, 30 Mar 2011 08:05:24 -0700 (PDT) In-Reply-To: <201103300800.11548.jhb@freebsd.org> References: <201103300800.11548.jhb@freebsd.org> Date: Wed, 30 Mar 2011 11:05:24 -0400 Message-ID: From: Arnaud Lacombe To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, mdf@freebsd.org Subject: Re: Include file search path X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2011 15:05:26 -0000 Hi, On Wed, Mar 30, 2011 at 8:00 AM, John Baldwin 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= " >