public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm via groups.io" <leif.lindholm=oss.qualcomm.com@groups.io>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "discuss@edk2.groups.io" <discuss@edk2.groups.io>,
	"rithrama@amd.com" <rithrama@amd.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>,
	edk2-devel-groups-io <devel@edk2.groups.io>
Subject: Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
Date: Tue, 1 Jul 2025 13:01:17 +0100	[thread overview]
Message-ID: <CAD=n3R2BGf+viHEPX2PP_WuP=FtfeVTPDs2GCxC+YOUacwHwhA@mail.gmail.com> (raw)
In-Reply-To: <CO1PR11MB4929FCFAB665E62E1D34DD32D246A@CO1PR11MB4929.namprd11.prod.outlook.com>

Hi Mike,

So, I've spent some time second-guessing myself about the set BUILD_DATE_EPOCH
by default if not set bit.

And I think I've come out happy with it in the end.

But ... maybe we'd want to print the EPOCH we set as well - to
simplify if someone _did_
want to reproduce that exact build. Something like:

SOURCE_DATE_EPOCH not set - defaulting to 1751371108.

I don't think any tools set SOURCE_DATE_EPOCH.

/
    Leif

On Mon, 30 Jun 2025 at 18:24, Kinney, Michael D
<michael.d.kinney@intel.com> wrote:
>
> Hi Leif,
>
> For the env var, I was following the pattern in the EDK II Build Specification
> for all environment variables that are required by the EDK II build.
>
> However, since SOURCE_DATE_EPOCH appears to be standard in both Windows and
> Linux development environments, we could just use that one and avoid the
> build spec addition of a new env var.
>
> I like the idea of the build system checking to see of SOURCE_DATE_EPOCH
> Is already defined and use that existing value and only set it if it is
> not already defined.
>
> Do any other tools we use also set SOURCE_DATE_EPOCH?
>
> Mike
>
> > -----Original Message-----
> > From: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
> > Sent: Monday, June 30, 2025 3:09 AM
> > To: Kinney, Michael D <michael.d.kinney@intel.com>
> > Cc: discuss@edk2.groups.io; rithrama@amd.com; Michael Kubacki
> > <mikuback@linux.microsoft.com>; edk2-devel-groups-io <devel@edk2.groups.io>
> > Subject: Re: [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib
> > fails to build.
> >
> > On Thu, 26 Jun 2025 at 22:25, Kinney, Michael D
> > <michael.d.kinney@intel.com> wrote:
> > > EmbeddedPkg/VirtualRealTimeClockLib change:
> > >
> > https://github.com/mdkinney/edk2/commit/51430285377e4d6298ec2b3ea9243d1c8ef
> > 9fb2a
> >
> > Yes, this approach is defnitely what we want for the module.
> >
> > > BaseTools change:
> > >
> > https://github.com/mdkinney/edk2/commit/a596ddc61d649e52db861e0fb6613c0a473
> > 36b6e
> >
> > A few thoughs about this one:
> > - Clearly the naming builds on SOURCE_DATE_EPOCH. Is there value in
> > adding our own prefix?
> >   - If we do add our own prefix, is there a corresponding change in
> > semantics?
> >   - Alternatively, could we do an "if not defined SOURCE_DATE_EPOCH,
> > ..., set SOURCE_DATE_EPOCH
> >     to current time"?
> >
> > /
> >     Leif
> >
> > > Mike
> > >
> > > > -----Original Message-----
> > > > From: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
> > > > Sent: Thursday, June 26, 2025 1:03 PM
> > > > To: Kinney, Michael D <michael.d.kinney@intel.com>
> > > > Cc: discuss@edk2.groups.io; rithrama@amd.com; Michael Kubacki
> > > > <mikuback@linux.microsoft.com>; edk2-devel-groups-io
> > <devel@edk2.groups.io>
> > > > Subject: Re: [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib
> > > > fails to build.
> > > >
> > > > Hi Mike,
> > > >
> > > > I like that idea. Sounds like something that could be useful in other
> > > > places as well.
> > > >
> > > > Regards,
> > > >
> > > > Leif
> > > >
> > > > On Thu, 26 Jun 2025 at 20:02, Kinney, Michael D
> > > > <michael.d.kinney@intel.com> wrote:
> > > > >
> > > > > Hi Leif,
> > > > >
> > > > > I have looked at this and suggest we add a new env var to the edk2
> > build
> > > > > that captures the EPOCH value in python code and sets the env var and
> > > > > that env var can be used in INF files removing the use of OS specific
> > > > > commands.
> > > > >
> > > > > Will require change to EDK II Build Spec and BaseTools.
> > > > >
> > > > > Also need to support override of EPOCH value to a constant value to
> > > > > support reproducible builds.
> > > > >
> > > > > I have a POC of this that I can share.
> > > > >
> > > > > Mike
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: discuss@edk2.groups.io <discuss@edk2.groups.io> On Behalf Of
> > Leif
> > > > > > Lindholm via groups.io
> > > > > > Sent: Thursday, June 26, 2025 2:59 AM
> > > > > > To: rithrama@amd.com
> > > > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Michael Kubacki
> > > > > > <mikuback@linux.microsoft.com>; discuss@edk2.groups.io; edk2-devel-
> > > > groups-
> > > > > > io <devel@edk2.groups.io>
> > > > > > Subject: Re: [edk2-discuss] [Bug]:
> > EmbeddedPkg/VirtualRealTimeClockLib
> > > > > > fails to build.
> > > > > >
> > > > > > On Wed, 25 Jun 2025 at 23:14, Rithvik Rama via groups.io
> > > > > > <rithrama=amd.com@groups.io> wrote:
> > > > > > > The EmulatorPkg throws below error when running a build:
> > > > > > >
> > > > > >
> > > >
> > edk2\EmbeddedPkg\Library\VirtualRealTimeClockLib\VirtualRealTimeClockLib.c(
> > > > > > 89): error C2065: 'BUILD_EPOCH': undeclared identifier
> > > > > >
> > > > > > I don't see EmbeddedPkg referenced in EmulatorPkg. Is EmulatorPkg a
> > > > typo
> > > > > > above?
> > > > > >
> > > > > > > The reason I raised this discussion is because the source file
> > > > comments
> > > > > > asks me to bring this up with the mailing list:
> > > > > > > //
> > > > > > >     // The following is intended to produce a compilation error
> > on
> > > > build
> > > > > > >     // environments where BUILD_EPOCH can not be set from inline
> > > > shell.
> > > > > > >     // If you are attempting to use this library on such an
> > > > environment,
> > > > > > please
> > > > > > >     // contact the edk2 mailing list, so we can try to add
> > support
> > > > for
> > > > > > it.
> > > > > > >     //
> > > > > > >
> > > > > > > The toolchain I used:
> > > > > > > VS2022
> > > > > > > Windows 11.
> > > > > > >
> > > > > > > May I know the root cause of this issue and how do I continue to
> > > > build
> > > > > > the EmbeddedPkg successfully?
> > > > > >
> > > > > > The answer is simple. A lot of EmbeddedPkg has only been tested
> > > > > > with/developed for GCC family of
> > > > > > toolchains.
> > > > > >
> > > > > > For those, we generate the BUILD_EPOCH here:
> > > > > >
> > > >
> > https://github.com/tianocore/edk2/blob/master/EmbeddedPkg/Library/VirtualRe
> > > > > > alTimeClockLib/VirtualRealTimeClockLib.inf#L37
> > > > > >   GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`printenv SOURCE_DATE_EPOCH ||
> > > > date
> > > > > > +%s`
> > > > > > only sets BUILD_EPOCH for GCC family of toolchains.
> > > > > >
> > > > > > I don't know how to best wrangle this together for a Visual Studio
> > > > > > environment.
> > > > > > Maybe a better way there would be to do something with __DATE__ and
> > > > > > __TIME__ macros,
> > > > > > but I don't think the formats of those are portable between
> > toolchains.
> > > > > > Mike, Michael - thoughts?
> > > > > >
> > > > > > A hack that would let you build this would be to add a line like
> > such:
> > > > > >   MSFT:*_*_*_CC_FLAGS = -DBUILD_EPOCH=1750931236
> > > > > > (timestamp generated by me in a linux shell with "git log -1
> > > > > > --pretty=%ct | date +%s")
> > > > > >
> > > > > > /
> > > > > >     Leif
> > > > > >
> > > > > >
> > > > > > 
> > > > > >
> > > > >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121442): https://edk2.groups.io/g/devel/message/121442
Mute This Topic: https://groups.io/mt/113840675/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2025-07-01 12:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CyL3.1750381754189969284.gEVT@groups.io>
2025-06-26  9:58 ` [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build Leif Lindholm via groups.io
2025-06-26 19:02   ` Michael D Kinney via groups.io
2025-06-26 20:02     ` Leif Lindholm via groups.io
2025-06-26 21:24       ` Michael D Kinney via groups.io
2025-06-30 10:08         ` Leif Lindholm via groups.io
2025-06-30 17:24           ` Michael D Kinney via groups.io
2025-07-01 12:01             ` Leif Lindholm via groups.io [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD=n3R2BGf+viHEPX2PP_WuP=FtfeVTPDs2GCxC+YOUacwHwhA@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox