Patchwork PATCH: pass sysroot to cc1plus

login
register
mail settings
Submitter Etienne Le Sueur
Date Dec. 3, 2012, 8:06 p.m.
Message ID <50BD0632.9030808@vmware.com>
Download mbox | patch
Permalink /patch/203435/
State New
Headers show

Comments

Etienne Le Sueur - Dec. 3, 2012, 8:06 p.m.
Hi,

With a sysroot of /dev/null, passing a .i file to cc1plus causes it to attempt to open /dev/null/usr/include, which fails. This causes problems 
for ccache and distcc. There is an open bugzilla ticket at [1].

The patch below applies on to 4.6.3, but it appears the bug is still present in 4.7.2.

If this is not the correct way to solve this problem, please suggest a better approach.

Regards,
Etienne Le Sueur

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54560

Patch

diff --git a/gcc-4.6.3/gcc/cp/lang-specs.h b/gcc-4.6.3/gcc/cp/lang-specs.h
index a73aba3..873609a 100644
--- a/gcc-4.6.3/gcc/cp/lang-specs.h
+++ b/gcc-4.6.3/gcc/cp/lang-specs.h
@@ -64,5 +64,5 @@  along with GCC; see the file COPYING3. If not see
    {".ii", "@c++-cpp-output", 0, 0, 0},
    {"@c++-cpp-output",
     "%{!M:%{!MM:%{!E:\
-    cc1plus -fpreprocessed %i %(cc1_options) %2\
+    cc1plus -fpreprocessed %i %I %(cc1_options) %2\
      %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/gcc-4.6.3/gcc/gcc.c b/gcc-4.6.3/gcc/gcc.c
index 75f522e..214ef29 100644
--- a/gcc-4.6.3/gcc/gcc.c
+++ b/gcc-4.6.3/gcc/gcc.c
@@ -950,7 +950,7 @@  static const struct compiler default_compilers[] =
                      %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0},
    {".i", "@cpp-output", 0, 0, 0},
    {"@cpp-output",
-   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
    {".s", "@assembler", 0, 0, 0},
    {"@assembler",
     "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},