Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: write a gcc-style depfile when using clang-cl on windows #1525

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

piscisaureus
Copy link
Member

Because clang-cl doesn't support msvc-style /showIncludes header dep detection, at least not in such way that it works properly with sccache.

@ry
Copy link
Member

ry commented Jan 15, 2019

I can't say I really understand what's happening here. So I'm mostly concerned from a long term maintenance perspective: Should this patch be undone when mozilla/sccache#246 is fixed? Or is this something that could be sent upstream to Chrome?

I think you should describe the symptoms that this is fixing in the commit message - i.e. that libdeno doesn't get rebuilt properly on windows

@ry
Copy link
Member

ry commented Jan 15, 2019

Does this fix #1424 ?

@piscisaureus piscisaureus requested a review from ry January 15, 2019 03:31
@piscisaureus
Copy link
Member Author

I can't say I really understand what's happening here. So I'm mostly concerned from a long term maintenance perspective: Should this patch be undone when mozilla/sccache#246 is fixed? Or is this something that could be sent upstream to Chrome?

It could probably go upstream; there's no disadvantages to it.
The underlying issue can't be fixed in sccache; it should be (and has been) fixed in in clang (https://reviews.llvm.org/D46394) but that hasn't made it into a stable release yet.

@piscisaureus
Copy link
Member Author

Does this fix #1424 ?

It fixes the rebuild issues I was experiencing locally, so I expect it solves #1424 also.
But who knows... the only way to find out is to try.

@ry
Copy link
Member

ry commented Jan 15, 2019

So maybe add a comment that lets the future maintainer know when they can safely undo that patch. I guess it's when https://reviews.llvm.org/D46394 gets into stable?

@piscisaureus
Copy link
Member Author

I can't say I really understand what's happening here.

MSVC (cl.exe) can't write a depfile, but it has the /showIncludes flag that prints included headers to stdout, and ninja parses that output.

sccache adds the /E flag that writes preprocessor output to stdout. It uses that compute the hash.

Now what happens if you pass both flags?
cl -> writes preprocessor output to stdout and headers to stderr
clang-cl -> writes preprocessor output to stdout, and does not write headers at all.

So dependency tracking was broken.

With some effort clang-cl can however write a gcc-style depfile, so that's what I'm making it do here.

@piscisaureus
Copy link
Member Author

So maybe add a comment that lets the future maintainer know when they can safely undo that patch. I guess it's when https://reviews.llvm.org/D46394 gets into stable?

Did you see this denoland/chromium_build@75a7f82...1e3840b#diff-215e0f644aef180fe353893e8703f3f2R186 ?

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the explanation.

Consider mentioning in the commit message what this fixes from a Deno user’s perspective.

This ensures deno gets rebuild properly when .c/.cc source files are
modified.

Fixes: denoland#1424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants