Skip to main content
Charles Blanchard
Associate III
August 28, 2020
Solved

Timestamp in binaries

  • August 28, 2020
  • 5 replies
  • 5085 views

Hello,

I'm using IAR 6.21. I'm trying to build a static library but even if my sources didn't change, the binary file is different each time I build again the lib.

I tried to compare the lib.a, there is some UNIX timestamps in the file that depends on the build time.

Do you know a way to prevent that? I need to have the exact same binary for the exact same sources...

Thank you,

Charles

This topic has been closed for replies.
Best answer by Charles Blanchard

Thank for your help.

I obtained an answer from IAR support, the option to operate in deterministic mode is available from IAR 8.50.

5 replies

KnarfB
Super User
August 28, 2020

I'm not using IAR, but thats an ar archive. ar has a command line option -D "Operate in deterministic mode. When adding files and the archive index use zero for UIDs, GIDs, timestamps, and use consistent file modes for all files.". Don't know where you could enter that option.

Charles Blanchard
Charles BlanchardAuthorBest answer
Associate III
August 28, 2020

Thank for your help.

I obtained an answer from IAR support, the option to operate in deterministic mode is available from IAR 8.50.

KnarfB
Super User
August 28, 2020

Too bad.

Pavel A.
Super User
August 28, 2020

>  but even if my sources didn't change, the binary file is different each time I build again the lib.

If your sources don't change, you don't need to rebuild the lib, correct?

Then just build your app with a copy of the lib which you update manually when it changes.

-- pa

Charles Blanchard
Associate III
August 29, 2020

We want the build to be deterministic, and the binaries the same whoever builds one of the libs or the firmware

waclawek.jan
Super User
August 28, 2020

Also, using standard __DATE__ and __TIME__ macros is one way to achieve different binaries from invariable sources, regardless of ar mode...

JW

Charles Blanchard
Associate III
August 29, 2020

Yes, we are not using any __DATE__ or __TIME__ macros, but I've checked, thanks!

fred bar
Senior
August 29, 2020

Maybe someone else 's code is using it.

Best thing would be to remote compile (other physical machine or vm) and have your compilation script set same system date each time you run it? Looks convoluted, but it's friday. :)

Charles Blanchard
Associate III
August 31, 2020

It could be a solution, it's far-fetched but it works ahah

Thank you!