Date: Tue, 17 Aug 2010 19:47:35 +0200 From: Dimitry Andric <dimitry@andric.com> To: Eitan Adler <lists@eitanadler.com> Cc: Daniel Nebdal <dnebdal@gmail.com>, current@freebsd.org Subject: Re: Building world with clang Message-ID: <4C6ACB37.8010602@andric.com> In-Reply-To: <AANLkTinugt9jH3NDGKq02iojvmtwqZsYpsVcgBbXdGoi@mail.gmail.com> References: <4C6A7357.8000606@andric.com> <19F5467B-6432-4531-BF04-62D8EB4F3093@gid.co.uk> <AANLkTi=wAhVDKX7vVd0Cds9zTSDQJ6vR%2BoyAbC-H_SK=@mail.gmail.com> <4C6A92E0.4050104@andric.com> <AANLkTi=%2BMntj2KPSUXZj=1qCPCOMq9YORB2JhR6k9ztK@mail.gmail.com> <AANLkTinugt9jH3NDGKq02iojvmtwqZsYpsVcgBbXdGoi@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C6ACB37.8010602>