Skip to content

Instantly share code, notes, and snippets.

@shesek
Created September 22, 2020 04:05
Embed
What would you like to do?
Rust - reproduible Windows exe builds - removing PE timestamps

For improved reproduciblity, you can build windows executables without the PE timestamps via mingw-w64 by setting:

RUSTFLAGS='-Clink-arg=-Wl,--no-insert-timestamp'

You may use something like this to conditionally set these flags for Windows builds only:

RUSTFLAGS="$RUSTFLAGS $([[ $platform != *"-windows-"* ]] || echo '-Clink-arg=-Wl,--no-insert-timestamp')" \
  cargo build --target $platform

See: https://wiki.debian.org/ReproducibleBuilds/TimestampsInPEBinaries#building_with_mingw-w64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment