Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@shesek
Created September 22, 2020 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shesek/ebb8616fb132ccd82ae8b574aeaf54cb to your computer and use it in GitHub Desktop.
Save shesek/ebb8616fb132ccd82ae8b574aeaf54cb to your computer and use it in GitHub Desktop.
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