mirror of https://github.com/acidanthera/audk.git
BaseTools: Incorrect error message for library instance not found
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2099 This is a regression issue introduced by commit e8449e. This patch is to fix this issue. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
5f7bb39117
commit
abc0155b03
|
@ -89,7 +89,7 @@ class MemoryDataPipe(DataPipe):
|
|||
libModules = {}
|
||||
for m in PlatformInfo.Platform.Modules:
|
||||
module_obj = BuildDB.BuildObject[m,PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain]
|
||||
Libs = GetModuleLibInstances(module_obj, PlatformInfo.Platform, BuildDB.BuildObject, PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain)
|
||||
Libs = GetModuleLibInstances(module_obj, PlatformInfo.Platform, BuildDB.BuildObject, PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain,PlatformInfo.MetaFile,EdkLogger)
|
||||
for lib in Libs:
|
||||
try:
|
||||
libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.Arch,lib.MetaFile.Path)].append((m.File,m.Root,module_obj.Arch,m.Path))
|
||||
|
|
|
@ -1089,7 +1089,7 @@ class PlatformAutoGen(AutoGen):
|
|||
for m in self.Platform.Modules:
|
||||
module_obj = self.BuildDatabase[m,self.Arch,self.BuildTarget,self.ToolChain]
|
||||
if not bool(module_obj.LibraryClass):
|
||||
Libs = GetModuleLibInstances(module_obj, self.Platform, self.BuildDatabase, self.Arch,self.BuildTarget,self.ToolChain)
|
||||
Libs = GetModuleLibInstances(module_obj, self.Platform, self.BuildDatabase, self.Arch,self.BuildTarget,self.ToolChain,self.MetaFile,EdkLogger)
|
||||
else:
|
||||
Libs = []
|
||||
ModuleLibs.update( set([(l.MetaFile.File,l.MetaFile.Root,l.MetaFile.Path,l.MetaFile.BaseName,l.MetaFile.OriginalPath,l.Arch,True) for l in Libs]))
|
||||
|
|
|
@ -248,7 +248,9 @@ class WorkspaceAutoGen(AutoGen):
|
|||
self.BuildDatabase,
|
||||
Arch,
|
||||
self.BuildTarget,
|
||||
self.ToolChain
|
||||
self.ToolChain,
|
||||
self.Platform.MetaFile,
|
||||
EdkLogger
|
||||
))
|
||||
for BuildData in list(self.BuildDatabase._CACHE_.values()):
|
||||
if BuildData.Arch != Arch:
|
||||
|
|
|
@ -15,6 +15,7 @@ from Workspace.BuildClassObject import StructurePcd
|
|||
from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
|
||||
from Common.BuildToolError import OPTION_MISSING
|
||||
from Common.BuildToolError import BUILD_ERROR
|
||||
import Common.EdkLogger as EdkLogger
|
||||
|
||||
class OrderedListDict(OrderedDict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -85,7 +86,7 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain, additionalP
|
|||
# @retval: List of dependent libraries which are InfBuildData instances
|
||||
#
|
||||
def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain):
|
||||
return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain)
|
||||
return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain,Platform.MetaFile,EdkLogger)
|
||||
|
||||
def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolchain, FileName = '', EdkLogger = None):
|
||||
if Module.LibInstances:
|
||||
|
@ -113,7 +114,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||
ConsumedByList = OrderedListDict()
|
||||
LibraryInstance = OrderedDict()
|
||||
|
||||
if FileName:
|
||||
if not Module.LibraryClass:
|
||||
EdkLogger.verbose("")
|
||||
EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch))
|
||||
|
||||
|
@ -126,7 +127,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||
if LibraryPath is None:
|
||||
LibraryPath = M.LibraryClasses.get(LibraryClassName)
|
||||
if LibraryPath is None:
|
||||
if FileName:
|
||||
if not Module.LibraryClass:
|
||||
EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,
|
||||
"Instance of library class [%s] is not found" % LibraryClassName,
|
||||
File=FileName,
|
||||
|
@ -143,7 +144,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||
or (ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION
|
||||
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
|
||||
# only USER_DEFINED can link against any library instance despite of its SupModList
|
||||
if FileName:
|
||||
if not Module.LibraryClass:
|
||||
EdkLogger.error("build", OPTION_MISSING,
|
||||
"Module type [%s] is not supported by library instance [%s]" \
|
||||
% (ModuleType, LibraryPath), File=FileName,
|
||||
|
@ -153,7 +154,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||
|
||||
LibraryInstance[LibraryClassName] = LibraryModule
|
||||
LibraryConsumerList.append(LibraryModule)
|
||||
if FileName:
|
||||
if not Module.LibraryClass:
|
||||
EdkLogger.verbose("\t" + str(LibraryClassName) + " : " + str(LibraryModule))
|
||||
else:
|
||||
LibraryModule = LibraryInstance[LibraryClassName]
|
||||
|
@ -234,7 +235,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
|
|||
#
|
||||
for Item in LibraryList:
|
||||
if ConsumedByList[Item] and Item in Constructor and len(Constructor) > 1:
|
||||
if FileName:
|
||||
if not Module.LibraryClass:
|
||||
ErrorMessage = "\tconsumed by " + "\n\tconsumed by ".join(str(L) for L in ConsumedByList[Item])
|
||||
EdkLogger.error("build", BUILD_ERROR, 'Library [%s] with constructors has a cycle' % str(Item),
|
||||
ExtraData=ErrorMessage, File=FileName)
|
||||
|
|
Loading…
Reference in New Issue