cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp in binaries

Charles Blanchard
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
Charles Blanchard
Associate III

Thank for your help.

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

View solution in original post

11 REPLIES 11
KnarfB
Principal III

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
Associate III

Thank for your help.

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

Too bad.

Pavel A.
Evangelist III

>  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

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

JW

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

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

fred bar
Senior

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. 🙂

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

Thank you!