public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 1/1] BaseTools: Fix build failure when multiple build targets given
@ 2019-12-11 15:25 Bob Feng
  2019-12-17  2:24 ` Liming Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Feng @ 2019-12-11 15:25 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Steven Shi, Ard Biesheuvel

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2371

This patch is to fix a regression issue that build fails
if multiple build targets given.

Two changes cause this regression issue.
One is AutoGen object __hash__ function only
hash file path and arch, missing ToolChain and build target.

The other is changing the multiple-thread-genfds function as default
build behavior. To generate the genffs command to Makefile, there
is a global data set is used, GenFdsGlobalVariable, which cause build
tool use the data of first build-target build in
the second build-target build.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
---
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py   | 2 +-
 BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-
 BaseTools/Source/Python/build/build.py             | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index 74662d1b52bc..aad591de65f0 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -268,11 +268,11 @@ class ModuleAutoGen(AutoGen):
     #
     #   @retval   int Hash value of the module file path and arch
     #
     @cached_class_function
     def __hash__(self):
-        return hash((self.MetaFile, self.Arch))
+        return hash((self.MetaFile, self.Arch, self.ToolChain,self.BuildTarget))
     def __repr__(self):
         return "%s [%s]" % (self.MetaFile, self.Arch)
 
     # Get FixedAtBuild Pcds of this Module
     @cached_property
diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index 4c3cdf82d57f..7bd24dad42f8 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -146,11 +146,11 @@ class PlatformAutoGen(AutoGen):
     #
     #   @retval   int Hash value of the platform file path and arch
     #
     @cached_class_function
     def __hash__(self):
-        return hash((self.MetaFile, self.Arch))
+        return hash((self.MetaFile, self.Arch,self.ToolChain,self.BuildTarget))
     @cached_class_function
     def __repr__(self):
         return "%s [%s]" % (self.MetaFile, self.Arch)
 
     ## Create autogen code for platform and modules
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 8a8e32e496f8..77b46341b5ad 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -56,10 +56,11 @@ import multiprocessing as mp
 from multiprocessing import Manager
 from AutoGen.DataPipe import MemoryDataPipe
 from AutoGen.ModuleAutoGenHelper import WorkSpaceInfo, PlatformInfo
 from GenFds.FdfParser import FdfParser
 from AutoGen.IncludesAutoGen import IncludesAutoGen
+from GenFds.GenFds import resetFdsGlobalVariable
 
 ## standard targets of build command
 gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run']
 
 ## build configuration file
@@ -2205,10 +2206,11 @@ class Build():
         SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)
         for BuildTarget in self.BuildTargetList:
             GlobalData.gGlobalDefines['TARGET'] = BuildTarget
             index = 0
             for ToolChain in self.ToolChainList:
+                resetFdsGlobalVariable()
                 GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
                 GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
                 GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]
                 index += 1
                 ExitFlag = threading.Event()
-- 
2.20.1.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch 1/1] BaseTools: Fix build failure when multiple build targets given
  2019-12-11 15:25 [Patch 1/1] BaseTools: Fix build failure when multiple build targets given Bob Feng
@ 2019-12-17  2:24 ` Liming Gao
  0 siblings, 0 replies; 2+ messages in thread
From: Liming Gao @ 2019-12-17  2:24 UTC (permalink / raw)
  To: Feng, Bob C, devel@edk2.groups.io; +Cc: Shi, Steven, Ard Biesheuvel

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Wednesday, December 11, 2019 11:25 PM
>To: devel@edk2.groups.io
>Cc: Gao, Liming <liming.gao@intel.com>; Shi, Steven <steven.shi@intel.com>;
>Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Subject: [Patch 1/1] BaseTools: Fix build failure when multiple build targets
>given
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2371
>
>This patch is to fix a regression issue that build fails
>if multiple build targets given.
>
>Two changes cause this regression issue.
>One is AutoGen object __hash__ function only
>hash file path and arch, missing ToolChain and build target.
>
>The other is changing the multiple-thread-genfds function as default
>build behavior. To generate the genffs command to Makefile, there
>is a global data set is used, GenFdsGlobalVariable, which cause build
>tool use the data of first build-target build in
>the second build-target build.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Steven Shi <steven.shi@intel.com>
>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>---
> BaseTools/Source/Python/AutoGen/ModuleAutoGen.py   | 2 +-
> BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +-
> BaseTools/Source/Python/build/build.py             | 2 ++
> 3 files changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>index 74662d1b52bc..aad591de65f0 100755
>--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>@@ -268,11 +268,11 @@ class ModuleAutoGen(AutoGen):
>     #
>     #   @retval   int Hash value of the module file path and arch
>     #
>     @cached_class_function
>     def __hash__(self):
>-        return hash((self.MetaFile, self.Arch))
>+        return hash((self.MetaFile, self.Arch, self.ToolChain,self.BuildTarget))
>     def __repr__(self):
>         return "%s [%s]" % (self.MetaFile, self.Arch)
>
>     # Get FixedAtBuild Pcds of this Module
>     @cached_property
>diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
>b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
>index 4c3cdf82d57f..7bd24dad42f8 100644
>--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
>@@ -146,11 +146,11 @@ class PlatformAutoGen(AutoGen):
>     #
>     #   @retval   int Hash value of the platform file path and arch
>     #
>     @cached_class_function
>     def __hash__(self):
>-        return hash((self.MetaFile, self.Arch))
>+        return hash((self.MetaFile, self.Arch,self.ToolChain,self.BuildTarget))
>     @cached_class_function
>     def __repr__(self):
>         return "%s [%s]" % (self.MetaFile, self.Arch)
>
>     ## Create autogen code for platform and modules
>diff --git a/BaseTools/Source/Python/build/build.py
>b/BaseTools/Source/Python/build/build.py
>index 8a8e32e496f8..77b46341b5ad 100755
>--- a/BaseTools/Source/Python/build/build.py
>+++ b/BaseTools/Source/Python/build/build.py
>@@ -56,10 +56,11 @@ import multiprocessing as mp
> from multiprocessing import Manager
> from AutoGen.DataPipe import MemoryDataPipe
> from AutoGen.ModuleAutoGenHelper import WorkSpaceInfo, PlatformInfo
> from GenFds.FdfParser import FdfParser
> from AutoGen.IncludesAutoGen import IncludesAutoGen
>+from GenFds.GenFds import resetFdsGlobalVariable
>
> ## standard targets of build command
> gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean',
>'cleanall', 'cleanlib', 'run']
>
> ## build configuration file
>@@ -2205,10 +2206,11 @@ class Build():
>         SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-
>generated\n', False)
>         for BuildTarget in self.BuildTargetList:
>             GlobalData.gGlobalDefines['TARGET'] = BuildTarget
>             index = 0
>             for ToolChain in self.ToolChainList:
>+                resetFdsGlobalVariable()
>                 GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
>                 GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
>                 GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]
>                 index += 1
>                 ExitFlag = threading.Event()
>--
>2.20.1.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-17  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-11 15:25 [Patch 1/1] BaseTools: Fix build failure when multiple build targets given Bob Feng
2019-12-17  2:24 ` Liming Gao

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