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

Make ar outputs deterministic #225

Closed
wants to merge 1 commit into from

Conversation

metajack
Copy link

@metajack metajack commented Aug 4, 2017

ar entry headers include timestamps and uid/gid which are not deterministic outputs. While binutils added command line flags to zero these fields out to make deterministic builds possible, macOS ar does not have these. This PR makes all invocations of ar deterministic by rewriting the archive and zeroing out the appropriate fields.

The immediate benefit of doing this is that sccache (and potentially other future Rust compiler caches) will be able to cache crates that include static C libraries are part of their build process.

@alexcrichton
Copy link
Member

Thanks for the PR! According to the documentation though I think that the ar crate only supports writing BSD archives (those on OSX), so I wonder if that's related to the test failures?

@metajack
Copy link
Author

metajack commented Aug 5, 2017

I think that the testing of the fake compiler means ar doesn't output a file. And I don't handle that case: https://travis-ci.org/alexcrichton/gcc-rs/jobs/261141868#L401

I'll put in a thing that skips if there's no archive and repush.

@metajack
Copy link
Author

metajack commented Aug 5, 2017

Well, that fixed half of them :(

@alexcrichton
Copy link
Member

I'm going to close this due to inactivity, but I'm more than willing to merge when tests pass!

@metajack
Copy link
Author

I decided to make sccache hash ar files better instead. I probably won't reopen this unless that path hits a roadblock.

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