[PATCH V2] Makefile: Add build time and compiler info string.

Alistair alistair at alistair23.me
Wed Sep 29 17:35:16 PDT 2021


On Thu, Sep 30, 2021, at 10:23 AM, Fu Wei wrote:
> Hi Dimitri,
> 
> Great thanks for your info,  so would you mind to provide more info
> about these macro for gcc and clang ?
> 
> Dimitri John Ledkov <dimitri.ledkov at canonical.com> 于2021年9月30日周四 上午6:21写道:
> >
> > Surely one can make this reproducible.
> >
> > If using compiler builtin macro, they respect environment variable of build time.
> > Or in the make file one can use the reproducible builds timestamp environment variable (if available) and only otherwise call out date.
> >
> > Lots of other software do that already. Meaning they both encode build time, but also remain reproducible.
> 
> I guess you have seen one of them if there are lots, would you mind to
> provide a example, I am curious about "encode build time" and "remain
> reproducible" at the same time.

Yes, it is possible to include a build time in a binary and
still be reproducible. The build system can override the time
and use a constant time.

This leads to confusion though, as the build time is then
incorrect and makes packager jobs harder. The reproducible
builds group has some more information on this:
https://reproducible-builds.org/docs/timestamps/

They recommend that software doesn't include the time in the
build output. I agree with their argument that it provides
little insight for released builds while adding an overhead.

That is why this approach of allowing developers to include
it in their debug builds is a good compromise. It allows
developers to see the build time if they want, while not
complicating reproducible builds or confusing users with
strange timestamps.

Alistair



More information about the opensbi mailing list