Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upMake hashes less dependent on source and build paths #207
Comments
This comment has been minimized.
This comment has been minimized.
|
Forget everything I've said about compiler flags and paths. I did some debugging of Same thing for the environment flags, where only However, the preprocessor output contains lots of paths, at least for gcc. These are typically of the form: # 1 "/home/alice/git/coolproject/modules/foo/src/cool_source.cpp"
# 1 "/home/alice/git/coolproject-build/Release//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "/home/alice/git/coolproject/modules/foo/src/cool_source.cpp"
...A relatively simple solution (that hopefully works) would be to strip the preprocessor output of all lines starting with Edit: Or simply pass |
This comment has been minimized.
This comment has been minimized.
|
PR #208 addresses this issue for GCC (and hopefully Clang). I'm not sure if the corresponding problem exists for MSVC. |
This comment has been minimized.
This comment has been minimized.
mqudsi
commented
Feb 18, 2018
|
Does this issue affect other languages like rust? |
This comment has been minimized.
This comment has been minimized.
It does! #196 has some discussion. There's a PR with a potential fix for Rust, but it'll have the same problem as C compilations (paths in debug info will be wrong), and I'm not sure it'll work properly even with that fix, since it looks like the build directory winds up in one of the internal rlib hashes, which might make rustc unhappy. |
This comment has been minimized.
This comment has been minimized.
mqudsi
commented
Feb 27, 2018
|
Thank you for that kind reply. I think cargo could structure things differently on its end to remove some unnecessary duplication and simultaneously make sccache's life easier; I had originally proposed some sort of fs-local cache on cargo's end in a github issue and that's when I was first informed about sccache and the difficult problems it was trying to solve :) |
mbitsnbites commentedDec 5, 2017
•
edited
Currently I was not able to properly use a shared cache between two machines without them using the exact same source and build folders, which seems quite unnecessary.
Apparently (according to #4 ), there are already some thoughts for how to fix this?
My gut feeling is that since the preprocessed result is what's being hashed (together with the command line flags that affect how the compilation is performed), things like file names (input, output) and include paths should not be important at all, so you should be able to remove them from the hash completely, right? (this includes-I,-o,-MT,-MF,-includeetc, plus the source file name)