From owner-freebsd-current@FreeBSD.ORG Tue Aug 17 17:47:27 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A914D1065693 for ; Tue, 17 Aug 2010 17:47:27 +0000 (UTC) (envelope-from dimitry@andric.com) 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 2A1008FC23 for ; Tue, 17 Aug 2010 17:47:27 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:2911:19d3:9b0d:9343] (unknown [IPv6:2001:7b8:3a7:0:2911:19d3:9b0d:9343]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 6520D5C59; Tue, 17 Aug 2010 19:47:26 +0200 (CEST) Message-ID: <4C6ACB37.8010602@andric.com> Date: Tue, 17 Aug 2010 19:47:35 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.9pre) Gecko/20100814 Lanikai/3.1.3pre MIME-Version: 1.0 To: Eitan Adler References: <4C6A7357.8000606@andric.com> <19F5467B-6432-4531-BF04-62D8EB4F3093@gid.co.uk> <4C6A92E0.4050104@andric.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Daniel Nebdal , current@freebsd.org Subject: Re: Building world with clang X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2010 17:47:27 -0000 On 2010-08-17 17:04, Eitan Adler wrote: > what about -nostdinc ? > Do not search the standard system directories for header files. > > Or will this also disable the command line equivalents ? It seems that -isysroot doesn't work with that: $ gcc -nostdinc -isysroot ${WORLDTMP} -S -v test.c [...] #include "..." search starts here: #include <...> search starts here: End of search list. So you have to cumbersomely specify all needed include directories by hand instead: $ gcc -nostdinc -isystem ${WORLDTMP}/usr/include/gcc/4.2 -isystem ${WORLDTMP}/usr/include -S -v testc [...] #include "..." search starts here: #include <...> search starts here: ${WORLDTMP}/usr/include/gcc/4.2 ${WORLDTMP}/usr/include End of search list. An alternative that almost works properly, is when you use multiple -B options: - The first pointing to ${WORLDTMP}/usr/bin, where as and ld live - The second pointing to ${WORLDTMP}/usr/libexec, where cc1, cc1obj and cc1plus live - The third pointing to ${WORLDTMP}/usr/lib, where the startup objects and the libraries live This results in: $ gcc -B${WORLDTMP}/usr/bin -B${WORLDTMP}/usr/libexec -B${WORLDTMP}/usr/lib -v test.c -o test Using built-in specs. Target: i386-undermydesk-freebsd Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD] ${WORLDTMP}/usr/libexec/cc1 -quiet -v -D_LONGLONG test.c -quiet -dumpbase test.c -auxbase test -version -o /tmp/cceCBnL1.s #include "..." search starts here: #include <...> search starts here: ${WORLDTMP}/usr/include/gcc/4.2 ${WORLDTMP}/usr/include End of search list. GNU C version 4.2.1 20070719 [FreeBSD] (i386-undermydesk-freebsd) compiled by GNU C version 4.2.1 20070719 [FreeBSD]. GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128948 Compiler executable checksum: c9b7cdb24796993b910f114335b27daf ${WORLDTMP}/usr/bin/as -o /tmp/ccTZPpZn.o /tmp/cceCBnL1.s ${WORLDTMP}/usr/bin/ld --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o test ${WORLDTMP}/usr/lib/crt1.o ${WORLDTMP}/usr/lib/crti.o ${WORLDTMP}/usr/lib/crtbegin.o -L${WORLDTMP}/usr/bin -L${WORLDTMP}/usr/bin -L${WORLDTMP}/usr/libexec -L${WORLDTMP}/usr/libexec -L${WORLDTMP}/usr/lib -L${WORLDTMP}/usr/lib -L/usr/lib -L/usr/lib /tmp/ccTZPpZn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ${WORLDTMP}/usr/lib/crtend.o ${WORLDTMP}/usr/lib/crtn.o GNU ld version 2.15 [FreeBSD] 2004-05-23 Supported emulations: elf_i386_fbsd The include directories have been completely reset, but unfortunately you can still see the default library directory /usr/lib in there. Yet another alternative is to use the COMPILER_PATH and LIBRARY_PATH environment variables, which can contain colon-separated directories: $ COMPILER_PATH=${WORLDTMP}/usr/bin:${WORLDTMP}/usr/libexec LIBRARY_PATH=${WORLDTMP}/usr/lib gcc -v hello.c -o hello Using built-in specs. Target: i386-undermydesk-freebsd Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD] ${WORLDTMP}/usr/libexec/cc1 -quiet -v -D_LONGLONG test.c -quiet -dumpbase test.c -auxbase test -version -o /tmp/cciXQvhb.s #include "..." search starts here: #include <...> search starts here: ${WORLDTMP}/usr/include/gcc/4.2 ${WORLDTMP}/usr/include End of search list. GNU C version 4.2.1 20070719 [FreeBSD] (i386-undermydesk-freebsd) compiled by GNU C version 4.2.1 20070719 [FreeBSD]. GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128948 Compiler executable checksum: c9b7cdb24796993b910f114335b27daf ${WORLDTMP}/usr/bin/as -o /tmp/ccKJZI5V.o /tmp/cciXQvhb.s ${WORLDTMP}/usr/bin/ld --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o test ${WORLDTMP}/usr/lib/crt1.o ${WORLDTMP}/usr/lib/crti.o ${WORLDTMP}/usr/lib/crtbegin.o -L${WORLDTMP}/usr/lib -L${WORLDTMP}/usr/lib -L/usr/lib -L/usr/lib /tmp/ccKJZI5V.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ${WORLDTMP}/usr/lib/crtend.o ${WORLDTMP}/usr/lib/crtn.o GNU ld version 2.15 [FreeBSD] 2004-05-23 Supported emulations: elf_i386_fbsd Conclusion: it looks like there is no working option to disable the built-in library directory /usr/lib.