public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* 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; 4+ 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] 4+ 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; 4+ 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] 4+ 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; 4+ 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] 4+ 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
  0 siblings, 0 replies; 4+ 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] 4+ messages in thread

end of thread, other threads:[~2025-06-26 21:25 UTC | newest]

Thread overview: 4+ 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox