[FS#196] SOURCE_DATE_EPOCH unset while calling the Makefile from the outside

LEDE Bugs lede-bugs at lists.infradead.org
Thu Sep 29 19:11:05 PDT 2016


A new Flyspray task has been opened.  Details are below. 

User who did this - Stanislas Bach (sbach) 

Attached to Project - LEDE Project
Summary - SOURCE_DATE_EPOCH unset while calling the Makefile from the outside
Task Type - Bug Report
Category - Base system
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - High
Priority - Very Low
Reported Version - Trunk
Due in Version - Undecided
Due Date - Undecided
Details - The following issue is present since the integration of 695d68c07de840d904af5cd9dac6cb4984814e72, introducing the SOURCE_DATE_EPOCH variable.

The first build error that can be seen while compiling:

mkyaffs2image.c:470:6: error: environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799
make[5]: *** [mkyaffs2image.o] Error 1


In order to reproduce the issue, one should try to call the Makefile from outside the sources of LEDE (i.e.: make -C ).


This variable is defined in include/toplevel.mk by calling 'scripts/get_source_date_epoch.sh' using $(shell ) but note that the environment will not be propagated as Make (tested on v4.1) spawns a new shell (confirmed by printing 'env' in the script).

As such the following line from the script is never executed since TOPDIR is not defined:

[ -n "$TOPDIR" ] && cd $TOPDIR'


The execution of the commands to retrieve the timestamp (Git, HG, ...) will fail since the current directory isn't the one from the LEDE sources.


A quick/dirty fix would be to add TOPDIR=$(TOPDIR) to the shell call.

More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=196



More information about the lede-bugs mailing list