From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 30 15:23:36 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 1CEC0106566B; Wed, 30 Mar 2011 15:23:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id D46A68FC1C; Wed, 30 Mar 2011 15:23:35 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:b89e:221f:6736:25e3] (unknown [IPv6:2001:7b8:3a7:0:b89e:221f:6736:25e3]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E87265C59; Wed, 30 Mar 2011 17:23:34 +0200 (CEST) Message-ID: <4D934AF4.9080503@FreeBSD.org> Date: Wed, 30 Mar 2011 17:23:32 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16pre) Gecko/20110319 Lanikai/3.1.10pre MIME-Version: 1.0 To: mdf@FreeBSD.org References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers 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:23:36 -0000 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.