tandasat / MiniVisorPkg

The research UEFI hypervisor that supports booting an operating system.
https://standa-note.blogspot.com/2020/03/introduction-and-design-considerations.html
MIT License
556 stars 88 forks source link

Building with DEBUG_ON_SERIAL_PORT option gives Library Class not found error #16

Closed subvert0r closed 3 months ago

subvert0r commented 4 months ago

Building with DEBUG_ON_SERIAL_PORT gives the following error:

> C:\edk2>build -w -a X64 -t VS2019 -b NOOPT -p MiniVisorPkg\Builds\Platform\EFI\MiniVisorPkg.dsc -D DEBUG_ON_SERIAL_PORT
> Build environment: Windows-7-6.1.7601-SP1
> Build start time: 17:48:01, Jul.16 2024
> 
> WORKSPACE        = c:\edk2
> EDK_TOOLS_PATH   = c:\edk2\basetools
> EDK_TOOLS_BIN    = c:\edk2\basetools\bin\win32
> CONF_PATH        = c:\edk2\conf
> PYTHON_COMMAND   = py -3
> 
> 
> 
> Processing meta-data .Architecture(s)  = X64
> Build target     = NOOPT
> Toolchain        = VS2019
> 
> Active Platform          = c:\edk2\MiniVisorPkg\Builds\Platform\EFI\MiniVisorPkg.dsc
> 
> 
> build.py...
> c:\edk2\MiniVisorPkg\Builds\Platform\EFI\MiniVisorPkg.dsc(...): error 4000: Instance of library class [CcProbeLib] is not foun
>         in [c:\edk2\MdePkg\Library\BaseIoLibIntrinsic\BaseIoLibIntrinsicSev.inf] [X64]
>         consumed by module [c:\edk2\MiniVisorPkg\Builds\Platform\EFI\MiniVisorDxe.inf]
> 
> 
> - Failed -
> Build end time: 17:48:01, Jul.16 2024
> Build total time: 00:00:00

I fixed it by adding these two to the inf file

    CcProbeLib|OvmfPkg/Library/CcProbeLib/DxeCcProbeLib.inf
    TdxLib|MdePkg/Library/TdxLib/TdxLib.inf

So now it's like:

  !ifdef $(DEBUG_ON_SERIAL_PORT)
    CcProbeLib|OvmfPkg/Library/CcProbeLib/DxeCcProbeLib.inf
    TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
    IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
    SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
    DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
  !else

But I'm not sure if I had to do this or not? did I make a mistake when trying to build it before this change?

Note that I can build the project without the DEBUG_ON_SERIAL_PORT option without any problem.

tandasat commented 4 months ago

Did you check out the specified revision of EDK2?

git clone -b edk2-stable202111 --recurse-submodules https://github.com/tianocore/edk2

https://github.com/tandasat/MiniVisorPkg/blob/master/Docs/Building_and_Debugging.md

The error could happen if you use different (newer) version of EDK2. And as long as it compiles, and seems to be working fine, you are 99.9% fine, so sounds like you are good.

subvert0r commented 3 months ago

Did you check out the specified revision of EDK2?

git clone -b edk2-stable202111 --recurse-submodules https://github.com/tianocore/edk2

https://github.com/tandasat/MiniVisorPkg/blob/master/Docs/Building_and_Debugging.md

The error could happen if you use different (newer) version of EDK2. And as long as it compiles, and seems to be working fine, you are 99.9% fine, so sounds like you are good.

Yeah that fixed the issue, thanks.