From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 29 21:20:32 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 3CCCF1065673 for ; Tue, 29 Mar 2011 21:20:32 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id C832F8FC27 for ; Tue, 29 Mar 2011 21:20:31 +0000 (UTC) Received: by wyf23 with SMTP id 23so667049wyf.13 for ; Tue, 29 Mar 2011 14:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=8P6lPskZ1ZVwPYSzu4CYHmoixIQM078iMJnkferwslU=; b=bfWruG74uzsoyNP0CFzn3jlBmBRhO2Ufu9TjD/Q+vrlhsPu04Sso763NN201bsVKw5 XfL6iufNQ63hl+ti4dcQWuXYlehjWZ5SEzApJYcY5cDc9CP0xcuVEnOP8nwem8JnSAsB 5gi05YxPaNi8jfrlPpx9XTsgar0cu82vtjXvc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=nmYRrfEq7Tl5w3WIevvSPxNS3tBdB4V+ZyFWoQoSabj13cxZOfBHtzkfJvpnd9F4Eq hyxOD2LcqAnLkqWTSIrM80nTl4bcX5UXgXRhGBu0OSfm9IUz1AJb0MUi2+LizoCET9QG oX8vc4v2jJh4Q+c+iV0BuFr4RB8CYwQ8WCIfA= MIME-Version: 1.0 Received: by 10.216.69.3 with SMTP id m3mr443977wed.9.1301433630558; Tue, 29 Mar 2011 14:20:30 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.52.209 with HTTP; Tue, 29 Mar 2011 14:20:30 -0700 (PDT) Date: Tue, 29 Mar 2011 14:20:30 -0700 X-Google-Sender-Auth: 29m166qov-lwXD6PWNx-Sqok7PA Message-ID: From: mdf@FreeBSD.org To: freebsd-hackers Content-Type: text/plain; charset=ISO-8859-1 Subject: 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: Tue, 29 Mar 2011 21:20:32 -0000 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. 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. I see in the gcc documentation that -I paths are searched before the standards paths. But isn't the lack of -nostdinc a bug (not just for libc, but for any library in /usr/src/lib)? It 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. This 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? How badly would things break if -nostdinc was included in e.g. bsd.lib.mk? (This would break non-base libraries, yes? But as a thought experiment for the base, how far off are we?) Thanks, matthew