Repository navigation
feat: Support auto depend mode for MSVC without /showIncludes - #1158
Conversation
|
Depends on #992. |
8e83d0c to
3602982
Compare
3602982 to
d9d5586
Compare
|
It seems like the "Including file" output is being elided during the initial compilation, as intended. |
d9d5586 to
99edb7b
Compare
|
Good catch, thanks! Should be Ok now, not sure if the code is well positioned though. What do you say? |
|
On Tue, Sep 13, 2022 at 01:03:51PM -0700, Orgad Shaneh wrote:
Should be Ok now, not sure if the code is well positioned though. What do you say?
I didn't check the code much, but it seems to do what I wanted. Thanks.
|
|
I still get "Note: including file:" if using ccache from within VS. On cache hits or when compiling from command line the includes are suppressed. |
|
On Thu, Sep 15, 2022 at 08:00:14AM -0700, vvainola wrote:
I still get "Note: including file:" if using ccache from within VS. On cache hits or when compiling from command line the includes are suppressed.
Could you check if VS is calling CL.EXE with "/showIncludes" ?
If so, that's what's expected.
|
|
No, /showIncludes is not in compile flags so includes are not printed with CCACHE_DISABLE=1 |
|
@vvainola How do you use it in VS? |
|
I made small VS solution for reproducing that you can try. In the zip there is a path in Directory.Build.Props file to cl.exe which should be a symlink to ccache.exe. If CCACHE_DEPEND=1, includes are printed on cache miss and if CCACHE_DEPEND is not set they are never printed. I narrowed the issue down to the actual execute call Line 717 in a39ed58 |
Based on -showIncludes, which prints included files on stdout with a certain text prefix. Otherwise pretty similar to depend mode handling for GCC. This makes MSVC building way faster.
99edb7b to
bf8ae9d
Compare
I can reproduce. It is really strange. Looks like MSVC has a side-channel to capture the output. I also noticed that although Any idea how to proceed with it? |
If MSVC is executed *without* /showIncludes, and ccache is configured with depend mode, add /showIncludes, and strip the extra output from stdout.
bf8ae9d to
bf0ac16
Compare
|
I don't have an MSVC to test with.
Did you check if this is related to the confusion about stdout vs stderr?
They updated the documentation to match the apparent behavior, but is it
possible that CL writes its includes to a different stream when run from
MSVC ?
…On Fri, Sep 30, 2022 at 02:08:17AM -0700, Orgad Shaneh wrote:
> I narrowed the issue down to the actual execute call
>
> https://github.com/ccache/ccache/blob/a39ed5824d8f4343e33b80575a9ba0bf0c73e89f/src/ccache.cpp#L717
>
> so it seems to have nothing to do with changes in this PR except that with depend mode the showIncludes is added automatically. For some reason the output "leaks" if compiling from Visual Studio but not if compiling with MSBuild from command line. I tried adding std::abort() right before the execute call and then there is no output in Visual Studio but if I add the std::abort() right after then the includes are printed.
I can reproduce. It is really strange. Looks like MSVC has a side-channel to capture the output. I also noticed that although `capture_output` is set, nothing is captured in the temp file.
Any idea how to proceed with it?
--
Justin Pryzby
System Administrator
Telsasoft
+1-952-707-8581
|
Nah, both files (stdout and stderr) are empty. The output goes to stdout when running from command-line. |
|
Maybe the behavior you observed is related to the "file tracker" which
is used to support incremental rebuilds ?
MSVC could be "spying" on data written to stdout/stderr (in addition to
other files).
|
|
Wild guess: Could this be related to https://stackoverflow.com/a/7402354/331771? |
It is indeed. The includes are no longer printed in VS after removing it from the environment given to CreateProcess edit: |
|
LGTM. postgresql compiles fine with depend mode, which (in the case of no cache hits) is about 2x faster than without depend mode. |
|
I merged this by mistake. Will revert. I missed that it depended on #992. |
|
Why? Do you have rejections on #992? |
…#1158)" This reverts commit 8b65880. See <#1158 (comment)>.
Yes, documentation needs an update and unit tests would be appreciated. |
|
Unit tests can be enabled with the other PR that enables them on Windows. |
Sorry, what do you mean? |
|
Those are integration tests, not unit tests. I'm talking about something similar to unittest/test_Depfile.cpp which does not depend on a Windows runtime environment. |
If MSVC is executed without /showIncludes, and ccache is configured with depend mode, add /showIncludes, and strip the extra output from stdout.