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

[C++] PCG breaks compilation caching #35596

Closed
pitrou opened this issue May 15, 2023 · 1 comment · Fixed by #35597
Closed

[C++] PCG breaks compilation caching #35596

pitrou opened this issue May 15, 2023 · 1 comment · Fixed by #35597
Assignees
Milestone

Comments

@pitrou
Copy link
Member

pitrou commented May 15, 2023

Describe the bug, including details regarding any error messages, version, and platform.

Noticing that I sometimes got unexpected slow rebuilds, I tried to dive a bit into ccache debug output and found out that by default the PCG headers use the __DATE__ and __TIME__ macros, which makes builds non-deterministic:
imneme/pcg-cpp#59

We should perhaps simply remove PCG's struct static_arbitrary_seed, which would make compilation caching more efficient. @benibus @bkietz @assignUser

Component(s)

C++

pitrou added a commit to pitrou/arrow that referenced this issue May 15, 2023
Also warn/error out if non-deterministic compilation macros such as `__TIME__` are used (with gcc and clang at least).
@pitrou pitrou self-assigned this May 15, 2023
@assignUser
Copy link
Member

Interesting, I also have #34715 open which could be a big improvement for our caching situation.

@pitrou pitrou added this to the 13.0.0 milestone May 16, 2023
pitrou added a commit that referenced this issue May 16, 2023
### Rationale for this change

The PCG headers use the `__DATE__` and `__TIME__` macros, which makes builds non-deterministic:
imneme/pcg-cpp#59

Deterministic builds are useful for a number of reasons. One is security audits of binary artifacts, another (that directly affects us) is making compilation caching as efficient as possible. Preprocessor-based compilation caching breaks when time-dependent macros are used.

### What changes are included in this PR?

Remove the `struct static_arbitrary_seed` construct from PCG.
Also, enable a gcc/clang warning that detects the use of non-deterministic preprocessor macros.

### Are these changes tested?

Yes, by the additional warning (which is turned into an error in "checkin" warnings mode).

### Are there any user-facing changes?

No.

* Closes: #35596

Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
rtpsw pushed a commit to rtpsw/arrow that referenced this issue May 16, 2023
…e#35597)

### Rationale for this change

The PCG headers use the `__DATE__` and `__TIME__` macros, which makes builds non-deterministic:
imneme/pcg-cpp#59

Deterministic builds are useful for a number of reasons. One is security audits of binary artifacts, another (that directly affects us) is making compilation caching as efficient as possible. Preprocessor-based compilation caching breaks when time-dependent macros are used.

### What changes are included in this PR?

Remove the `struct static_arbitrary_seed` construct from PCG.
Also, enable a gcc/clang warning that detects the use of non-deterministic preprocessor macros.

### Are these changes tested?

Yes, by the additional warning (which is turned into an error in "checkin" warnings mode).

### Are there any user-facing changes?

No.

* Closes: apache#35596

Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants