swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
490 stars 31 forks source link

error: macro "__DATE__" might prevent reproducible builds #29

Closed MarkusVolk closed 2 years ago

MarkusVolk commented 3 years ago

i maintain a meta layer for the yocto/open-embedded cross buildsystem to provide wayland/wlroots based recipes. While switching to yocto master branch to prepare for the upcoming release and thereby also switching to gcc 11.2 , i encounter the following error:

| ../git/main.c:474:59: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
|   474 |                         fprintf(stdout, "swaybg version " SWAYBG_VERSION "\n");
|       |                                                           ^~~~~~~~~~~~~~
| cc1: all warnings being treated as errors

This can be bypassed by adding:

CFLAGS:append = " -Wno-error=date-time"

EDIT: I see the same issue if building sway

ammgws commented 2 years ago

Maybe it could be changed to use the date of the last commit instead?

Using git log --pretty=format:'%ad' -n1 --date=short

emersion commented 2 years ago

I don't think __DATE__ is an issue: https://reproducible-builds.org/docs/source-date-epoch/

ammgws commented 2 years ago

Maybe I'm misunderstanding but __DATE__ resolves to the whatever the time is when the build is started, where as the page you linked to is saying to set SOURCE_DATE_EPOCH so that it will override __DATE__ with a fixed value that doesn't change at build time.

EDIT: ah I see, the var would be set by the packager/builder. Anyway I think that gives more reason to change the date shown from build date to something more useful like the latest commit date as in the PR

emersion commented 2 years ago

Closing, this isn't an issue as explained above and I don't think this is worth changing.