Comments (4)
Interesting. We already included langauge
in the hash calculation:
Lines 717 to 750 in 7074753
from sccache.
Isn't language
the input language? Both input files are C++ code. The different is in the output format.
According to my experiments, it's the parameter -x c++-header
that makes GCC generate GCH file.
from sccache.
GCC's logic that determines the output format is a bit complicated, and depends on the extension of the main input file and on the -x
option. According to GCC docs:
-x language
Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on the file name suffix). This option applies to all following input files until the next -x option.
After experimenting, here is GCC's behaviour, without sccache involved:
gcc -o blah -c cmake_pch.hxx.cxx
generates object codegcc -o blah -c cmake_pch.hxx.hxx
generates precompiled header filegcc -x c++-header -o blah -c whatever_filename_and_extension_you_like
generates precompiled header file
I guess Sccache doesn't take -x
into consideration?
EDIT: scratch that, apparently it does:
Lines 609 to 620 in 7074753
from sccache.
Another thing to note is that all the .cpp
files that get mis-compiled are empty i.e. contain only comments (class documentation). And the cmake_pch.hxx.cxx file is also empty, contains only a single comment line.
So here my current theory:
- Sccache, for all command lines, does pre-compilation (
-E
) first, with output tostdout
- GCC, for all the offending files, when fed the
-E
parameter, outputs the same preprocessed source regardless of the-x
argument it has on the command line - Sccache follows with a "local compile" step, which is kind of opaque. All I can see in the (local) server logs, for both the PCH generation and the object code generation steps, is:
[2023-08-01T16:20:57Z TRACE sccache::compiler::gcc] compile [2023-08-01T16:20:57Z DEBUG sccache::compiler::compiler] [cmake_pch.hxx.gch]: Compiling locally
- The result of "compile" is different based on the
-x
argument. But sccache stores them under the same hash key.- Indeed for each case I cleared the cache and re-run the compilation. The result file was correct. Running the same command with populated cache resulted to a possibly wrong output file, because of the hash collision.
from sccache.
Related Issues (20)
- Redis no longer support TLS HOT 2
- C++ ClangCL on Windows - `/wd4668` flag results in error HOT 9
- MSVC /Fo parameter not handled correctly HOT 3
- Enable server side encryption with s3
- c++ projects compile without caching
- OAuth to keycloak failing HOT 2
- Sccache can not connect to redis server ip client / server are ipv6 only HOT 2
- Allow local cache to be made read-only
- Cache check result doesn't influence mode of operation
- Server is non responsive during GCS token initialization
- sccache keeps lock on .vcpkg-root HOT 2
- 0.5.4 crate doesn't build on stable HOT 2
- Rust distributed compilations always fail
- Using sccache for objective-c (xcodebuild)
- Invalid Credentials only when SCCACHE_GCS_RW_MODE is READ_ONLY HOT 1
- Add enable_virtual_host_style support for S3
- feature `dist-client` superfluously depend on `trust-dns-resolver`
- Seeing reason "multiple input files" although only a single file is given HOT 1
- Source folder name impact on cache HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sccache.