http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54560
Bug #: 54560 Summary: g++ with --sysroot and -save-temps don't play nicely Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: i...@vmware.com We have a compiler built with a sysroot of "/dev/null", thus it always requires a --sysroot argument. A developer noticed that g++'s -save-temps option doesn't work with this toolchain setup. What happens is it gets to the stage of turning the .ii file in to the asm file and cc1plus fails --- /usr/bin/../libexec/gcc/x86_64-vmk-linux-gnu/4.6.3/cc1plus -fpreprocessed foo.ii -quiet -dumpbase foo.cpp -m32 -march=i686 -auxbase-strip foo.o -g -O1 -Wall -Werror -Wno-unused-but-set-variable -Wno-conversion-null -Wno-non-virtual-dtor -version -fwrapv -fno-working-directory -funwind-tables -fasynchronous-unwind-tables -fstack-protector -fPIC -fno-strict-aliasing -o foo.s GNU C++ (GCC) version 4.6.3 (x86_64-vmk-linux-gnu) compiled by GNU C version 4.4.3, GMP version 5.0.4, MPFR version 2.4.2, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 cc1plus: error: /dev/null/usr/local/include: Not a directory cc1plus: error: /dev/null/usr/include: Not a directory GNU C++ (GCC) version 4.6.3 (x86_64-vmk-linux-gnu) compiled by GNU C version 4.4.3, GMP version 5.0.4, MPFR version 2.4.2, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 --- It's using the pre-processed source, so my feeling is that it doesn't require the sysroot argument here. Manually adding a -isysroot argument to *any* valid directory (doesn't have to be a directory with the correct sysroot hierarchy in it, e.g. /tmp) makes it work; so presumably the problem here is that "/dev/null/usr/include" doesn't exist. A quick search has not revealed to me where cc1plus is trying to access this directory... Another option might be to add a %I to the spec where this gets emitted [1] so that a valid -isysroot value gets passed? [1] http://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/cp/lang-specs.h;h=a73aba3cdc0dd970b068ce9172acdfeb20fbe7f5;hb=HEAD