From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 30 15:26:50 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 94EC2106566C for ; Wed, 30 Mar 2011 15:26:50 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from agogare.doit.wisc.edu (agogare.doit.wisc.edu [144.92.197.211]) by mx1.freebsd.org (Postfix) with ESMTP id 68AC08FC1B for ; Wed, 30 Mar 2011 15:26:50 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LIV00300MWPRT00@smtpauth2.wiscmail.wisc.edu> for freebsd-hackers@freebsd.org; Wed, 30 Mar 2011 10:26:49 -0500 (CDT) Received: from comporellon.tachypleus.net ([unknown] [76.210.65.155]) by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LIV00HF4MWN2C30@smtpauth2.wiscmail.wisc.edu> for freebsd-hackers@freebsd.org; Wed, 30 Mar 2011 10:26:48 -0500 (CDT) Date: Wed, 30 Mar 2011 10:26:47 -0500 From: Nathan Whitehorn In-reply-to: <4D934AF4.9080503@FreeBSD.org> To: freebsd-hackers@freebsd.org Message-id: <4D934BB7.9080201@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.65.155 X-Spam-PmxInfo: Server=avs-14, Version=5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.3.30.151816, SenderIP=76.210.65.155 References: <4D934AF4.9080503@FreeBSD.org> User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110305 Thunderbird/3.1.9 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:26:50 -0000 On 03/30/11 10:23, Dimitry Andric wrote: > On 2011-03-29 23:20, mdf@FreeBSD.org wrote: >> So here's what I'm pondering. When I build a library, like e.g. libc, >> where do the include files get pulled from? They can't (shouldn't) be >> the ones in /usr/include, but I don't see a -nostdinc like for the >> kernel. There 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. > > During the bootstrap stage, a copy of gcc (or clang) is built, that has > all default search paths for headers, libraries, etc, set relative to > ${WORLDTMP}, usually /usr/obj/usr/src/tmp. > > E.g: > > $ /usr/obj/usr/src/tmp/usr/bin/gcc -v -E -x c /dev/null -o /dev/null > Using built-in specs. > Target: amd64-undermydesk-freebsd > Configured with: FreeBSD/amd64 system compiler > Thread model: posix > gcc version 4.2.1 20070719 [FreeBSD] > /usr/obj/usr/src/tmp/usr/libexec/cc1 -E -quiet -v -D_LONGLONG > /dev/null -o /dev/null > #include "..." search starts here: > #include <...> search starts here: > /usr/obj/usr/src/tmp/usr/include/gcc/4.2 > /usr/obj/usr/src/tmp/usr/include > End of search list. > > and: > > $ /usr/obj/usr/src/tmp/usr/bin/gcc -print-search-dirs > install: /usr/obj/usr/src/tmp/usr/libexec/ > programs: > =/usr/obj/usr/src/tmp/usr/bin/:/usr/obj/usr/src/tmp/usr/bin/:/usr/obj/usr/src/tmp/usr/libexec/:/usr/obj/usr/src/tmp/usr/libexec/:/usr/obj/usr/src/tmp/usr/libexec/ > libraries: =/usr/obj/usr/src/tmp/usr/lib/:/usr/obj/usr/src/tmp/usr/lib/ > > This is a rather nasty hack, though. If we can make it work, we should > probably try using --sysroot instead, or alternatively, -nostdinc and > adding include dirs by hand. The same for executable and library search > paths, although I am not sure if there is a way to completely reset > those with the current options. Since you need to build two compilers anyway (one for the current system, to build the new one, and one to live in the new one, linked against new libraries), I don't see that it's such a nasty hack. -Nathan