Ccache dup2s the stderr FD and publishes the resulting FD number in
$UNCACHED_ERR_FD for usage by e.g. distcc. This is done any executed
child process.
As noted by Sam Varshavchik on the ccache mailing list, this leads to an
unfortunate and complex problem in combination with GNU Make, LTO
linking and the Linux PTY driver:
https://www.mail-archive.com/ccache@lists.samba.org/msg01516.html
Since UNCACHED_ERR_FD is only relevant when running the preprocessor or
compiler, let’s only dup2 stderr when executing those, i.e. not when
falling back to just running the wrapped command such as the linker.
throw Failure(Statistic::cache_miss);
}
- MTR_BEGIN("main", "set_up_uncached_err");
- set_up_uncached_err();
- MTR_END("main", "set_up_uncached_err");
-
LOG("Command line: {}", Util::format_argv_for_logging(argv));
LOG("Hostname: {}", Util::get_hostname());
LOG("Working directory: {}", ctx.actual_cwd);
throw Failure(*processed.error);
}
+ set_up_uncached_err();
+
if (ctx.config.depend_mode()
&& (!ctx.args_info.generating_dependencies
|| ctx.args_info.output_dep == "/dev/null"
# -------------------------------------------------------------------------
if ! $HOST_OS_WINDOWS; then
- TEST "UNCACHED_ERR_FD"
+ TEST "UNCACHED_ERR_FD set when executing preprocessor and compiler"
cat >compiler.sh <<'EOF'
#!/bin/sh
fi
fi
+if ! $HOST_OS_WINDOWS; then
+ TEST "UNCACHED_ERR_FD not set when falling back to the original command"
+ # -------------------------------------------------------------------------
+
+ $CCACHE bash -c 'echo $UNCACHED_ERR_FD' >uncached_err_fd.txt
+ expect_content uncached_err_fd.txt ""
+fi
+
# -------------------------------------------------------------------------
TEST "Invalid boolean environment configuration options"