* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
[not found] <CyL3.1750381754189969284.gEVT@groups.io>
@ 2025-06-26 9:58 ` Leif Lindholm via groups.io
2025-06-26 19:02 ` Michael D Kinney via groups.io
0 siblings, 1 reply; 7+ messages in thread
From: Leif Lindholm via groups.io @ 2025-06-26 9:58 UTC (permalink / raw)
To: rithrama
Cc: Kinney, Michael D, Michael Kubacki, discuss, edk2-devel-groups-io
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/VirtualRealTimeClockLib/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 (#121432): https://edk2.groups.io/g/devel/message/121432
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
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
0 siblings, 1 reply; 7+ messages in thread
From: Michael D Kinney via groups.io @ 2025-06-26 19:02 UTC (permalink / raw)
To: discuss@edk2.groups.io, leif.lindholm@oss.qualcomm.com,
rithrama@amd.com
Cc: Michael Kubacki, edk2-devel-groups-io, Kinney, Michael D
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 (#121433): https://edk2.groups.io/g/devel/message/121433
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
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
0 siblings, 1 reply; 7+ messages in thread
From: Leif Lindholm via groups.io @ 2025-06-26 20:02 UTC (permalink / raw)
To: Kinney, Michael D
Cc: discuss@edk2.groups.io, rithrama@amd.com, Michael Kubacki,
edk2-devel-groups-io
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 (#121434): https://edk2.groups.io/g/devel/message/121434
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
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
0 siblings, 1 reply; 7+ messages in thread
From: Michael D Kinney via groups.io @ 2025-06-26 21:24 UTC (permalink / raw)
To: Leif Lindholm
Cc: discuss@edk2.groups.io, rithrama@amd.com, Michael Kubacki,
edk2-devel-groups-io, Kinney, Michael D
BaseTools change:
https://github.com/mdkinney/edk2/commit/a596ddc61d649e52db861e0fb6613c0a47336b6e
EmbeddedPkg/VirtualRealTimeClockLib change:
https://github.com/mdkinney/edk2/commit/51430285377e4d6298ec2b3ea9243d1c8ef9fb2a
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 (#121435): https://edk2.groups.io/g/devel/message/121435
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
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
0 siblings, 1 reply; 7+ messages in thread
From: Leif Lindholm via groups.io @ 2025-06-30 10:08 UTC (permalink / raw)
To: Kinney, Michael D
Cc: discuss@edk2.groups.io, rithrama@amd.com, Michael Kubacki,
edk2-devel-groups-io
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/51430285377e4d6298ec2b3ea9243d1c8ef9fb2a
Yes, this approach is defnitely what we want for the module.
> BaseTools change:
> https://github.com/mdkinney/edk2/commit/a596ddc61d649e52db861e0fb6613c0a47336b6e
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 (#121437): https://edk2.groups.io/g/devel/message/121437
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
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
0 siblings, 1 reply; 7+ messages in thread
From: Michael D Kinney via groups.io @ 2025-06-30 17:24 UTC (permalink / raw)
To: Leif Lindholm
Cc: discuss@edk2.groups.io, rithrama@amd.com, Michael Kubacki,
edk2-devel-groups-io, Kinney, Michael D
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 (#121438): https://edk2.groups.io/g/devel/message/121438
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [edk2-discuss] [Bug]: EmbeddedPkg/VirtualRealTimeClockLib fails to build.
2025-06-30 17:24 ` Michael D Kinney via groups.io
@ 2025-07-01 12:01 ` Leif Lindholm via groups.io
0 siblings, 0 replies; 7+ messages in thread
From: Leif Lindholm via groups.io @ 2025-07-01 12:01 UTC (permalink / raw)
To: Kinney, Michael D
Cc: discuss@edk2.groups.io, rithrama@amd.com, Michael Kubacki,
edk2-devel-groups-io
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-01 12:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox