-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
CacheDir duplicates cache entry for identical target outputs #4335
Comments
I encountered this behavior at one point as well, and considered whether it was worth fixing. There are, however, some critical wrinkles. For this to work the build environment must guarantee that no path information ends up in the object files. If you have, for instance, debug info that records something like .dwo paths or split dwarf info or any other information like that, then what would otherwise be equivalent object files will end up with different content. If you allow those files to be considered equivalent via the cache by stripping the variant directory from consideration then you can end up retrieving the "wrong" file. Is it a problem in practice? Maybe or maybe not. But think if this behavior is desired it needs to be opt-in. |
As I understood it (and I might not have) .. wouldn't preprocessor stuff like "Current file" or "Line number" be rendered before hashing and checking the cache? If so, that would make two different sources, which yields two different outputs. |
If duplicate=False, then the sources and preprocessor stuff would all be the same..so no. |
Setting aside embedding, I wonder if fiddling the relevant
|
Describe the Feature
Originally discussed at platformio/platformio-core#4574
PlatformIO 'environments' are separated as VariantDirs, and often include similar target outputs SDK and library files. Every time environment is built, cache is populated exclusively for that environment alone; it is not possible to share cache entries between environments, thus increasing total compilation time of otherwise exact same project files.
With the following test construct taken from the issue
Empty
build_cache
and clean build directory,build1
variant is compiled from scratch as expected.Immediately trying to build
build2
generates files from scratch as well, but since it is identical to thebuild1
one would expect the output files would be taken frombuild1
cache.Currently, this does not work like that because of hard-coded path included for the CacheDir entry key, in the FS Node code method
scons/SCons/Node/FS.py
Lines 3705 to 3717 in c80cbb0
Main question is - what is the best approach to handle such case?
Naive solution would be to simply allow to modify this path, as mentioned in the original issue
master...mcspr:scons:pio4574v2
FS node now has
set_cachedir_bsig_path()
method, which can be used to substitute that path; either set to some common prefix + filename, or simply removed.But, I am not sure how that would apply to the
env.Program()
case, since it does not allow target factory (or, for anything in-between like.o
files). Or, whether modifying FS Node code is the best place for this change to happen.Required information
Remove environment name from
build_cache_dir
cache keys platformio/platformio-core#4574v4.5.2
3.11.2
The text was updated successfully, but these errors were encountered: