Tim, the issue was not DEBUG calls in the serial port library (these would be 
fine since it is self-dependent), the issue is that DebugLib uses PrintLib for 
AsciiSPrint and that PrintLIb uses DebugLib for ASSERT.

Liming, if we use BasePrintLib then we won't get the code size benefits from 
the DxePrintLibPrint2Protocol which was the whole reason we are trying this.  
Basically every module uses DebugLib so if every DebugLib pulls in another copy 
of BasePrintLib then we've lost any benefit from trying to use the 
DxePrintLibPrint2Protocol.  It seems like there should be some solution where 
we can get the benefit of DxePrintLibPrint2Protocol while resolving the 
circular dependency.

As an experiment I hacked out DebugLib from the DxePrintLibPrint2Protocol inf 
file which eliminated the circular dependency error and the build succeeded 
(because we got lucky in that all components that used PrintLib happened to use 
DebugLib too).  It would be ideal if there was a hack-free to get these working 
together.

Eugene

From: Gao, Liming [mailto:liming....@intel.com]
Sent: Monday, August 25, 2014 10:44 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Circular Dependency Between DxePrintLibPrint2Protocol and 
BaseDebugLibSerialPort

Hi,
  You can use MdePkg\Library\BasePrintLib\BasePrintLib.inf when you use 
BaseDebugLibSerialPort library.

Thanks
Liming
From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Tuesday, August 26, 2014 12:09 PM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: Re: [edk2] Circular Dependency Between DxePrintLibPrint2Protocol and 
BaseDebugLibSerialPort

Eugene -

We found this also when because there are DEBUG macros in the serial port 
library. Is this the root cause of what you found? We finally had to hack the 
library constructors, but it was messy.

Tim

From: Cohen, Eugene [mailto:eug...@hp.com]
Sent: Tuesday, August 26, 2014 7:49 AM
To: edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
Subject: [edk2] Circular Dependency Between DxePrintLibPrint2Protocol and 
BaseDebugLibSerialPort

Dear maintainers of DebugLib and PrintLib,

It looks like we have a circular dependency between the 
DxePrintLibPrint2Protocol library (which uses ASSERT) and 
BaseDebugLibSerialPort library (which uses AsciiSPrint):

1><myplatform>.dsc(...) : error F002: Library 
[c:\edk2\MdeModulePkg\Library\DxePrintLibPrint2Protocol\DxePrintLibPrint2Protocol.inf]
 with constructors has a cycle
1>            consumed by 
c:\edk2\MdePkg\Library\BaseDebugLibSerialPort\BaseDebugLibSerialPort.inf

so it seems that this library combination is incompatible.  Is there a 
preferred way to resolve this?

I see some platforms use the status code variant of DebugLib 
(PeiDxeDebugLibReportStatusCode) but I'd prefer a solution that allows us to 
keep using the simple BaseDebugLibSerialPort.

Thanks,

Eugene
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to