Date
1 - 9 of 9
Trouble building EmulatorPkg
Eugene Khoruzhenko
As described in Readme.md, building 64bit emulator in Windows:
build -p EmulatorPkg\EmulatorPkg.dsc -t VS2013 -a X64 But getting an error linking WinHost: d:/src/edk2/Build/EmulatorX64/DEBUG_VS2013/X64/EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib/OUTPUT/SecPeiServicesLib.lib d:/src/edk2/Build/EmulatorX64/DEBUG_VS2013/X64/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib/OUTPUT/FrameBufferBltLib.lib LINK : warning LNK4108: /ALIGN specified without /DRIVER; image may not run LINK : warning LNK4001: no object files specified; libraries used LINK : warning LNK4068: /MACHINE not specified; defaulting to X86 LINK : error LNK2001: unresolved external symbol _ModuleEntryPoint d:\src\edk2\Build\EmulatorX64\DEBUG_VS2013\X64\WinHost.lib : fatal error LNK1120: 1 unresolved externals NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Vc\bin\x86_amd64\link.exe"' : return code '0x460' Stop. Tried building IA32 - getting the following errors (also linking WinHost): WinHost.lib(WinHost.obj) : error LNK2001: unresolved external symbol __imp__OpenProcessToken@12 WinHost.lib(WinHost.obj) : error LNK2001: unresolved external symbol __imp__AdjustTokenPrivileges@24 WinHost.lib(WinHost.obj) : error LNK2001: unresolved external symbol __imp__LookupPrivilegeValueW@12 WinHost.lib(WinThunk.obj) : error LNK2001: unresolved external symbol __imp__timeSetEvent@20 WinHost.lib(WinThunk.obj) : error LNK2001: unresolved external symbol __imp__timeKillEvent@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__SetDIBitsToDevice@48 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__GetMessageW@16 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__TranslateMessage@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__DispatchMessageW@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__SendMessageW@16 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__DefWindowProcW@16 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__PostQuitMessage@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__UnregisterClassW@8 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__RegisterClassExW@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExW@48 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__DestroyWindow@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__ShowWindow@8 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__MoveWindow@24 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__UpdateWindow@4 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__BeginPaint@8 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__EndPaint@8 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__InvalidateRect@12 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__GetWindowRect@8 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__AdjustWindowRect@12 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__LoadCursorW@8 WinHost.lib(WinGopScreen.obj) : error LNK2001: unresolved external symbol __imp__LoadIconW@8 d:\src\edk2\Build\EmulatorIA32\DEBUG_VS2013\IA32\WinHost.exe : fatal error LNK1120: 26 unresolved externals Building ... d:\src\edk2\MdeModulePkg\Universal\PCD\Dxe\Pcd.inf [IA32] Building ... d:\src\edk2\MdeModulePkg\Universal\Console\TerminalDxe\TerminalDxe.inf [IA32] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Vc\bin\link.exe"' : return code '0x460' I tried to checkout different stable edk2 tags like tags/edk2-stable202002 - same issues. I tried building on 3 different machines with different Visual Studios - same problems. Is there any trick building EmulatorPkg? |
|
Eugene Khoruzhenko
Found the problem - the build seems to be hardcoded for VS2017. The Winhost makefile in VS2013 build has DLINK_FLAGS that's missing all the necessary libraries. The EmulatorPkg documentation, such as Readme.md, should specify that only specific Visual Studio is supported.
|
|
Sean
I have been building this recently for a POC showing how we (tianocore) can do Platform CI. As part of that I have enabled the emulatorpkg to use PyTools platform building. This works for VS2017 and VS2019 IA32 and X64. PyTools does all the environment and path management to setup the correct libs, includes, etc.
Help here. https://github.com/spbrogan/edk2/blob/master/EmulatorPkg/README-pytools.md Server build and execution of emulator shown here. https://dev.azure.com/tianocore/edk2-ci-play/_build/results?buildId=5200&view=results If that is helpful or you have feedback let me know. Thanks Sean |
|
Eugene Khoruzhenko
Sean, thanks for the quick reply. Which branch/tag are you referring to? I am trying to build from "master" and building with VS2019 is not working. Looking at WinHost.inf, it only mentions VS2015 and VS2017, so VS2019 cannot be supported as checked-in in the master branch.
Also, I really need to use VS2013 as the rest of my environment, including debugger, work in VS2013... |
|
Sean
Master of github.com/spbrogan/edk2 should have everything needed.
It is based on master of edk2 from 2 days ago plus changes i have been making to enable platform ci. I can't help with VS2013. We have focused PyTool efforts on N, and N-1 of VS. So that VS2019 and 2017. Also these two versions are in the new model of having multiple instances of VS so our scheme takes advantage of VSWhere and a more dynamic VS configuration. See here: https://github.com/spbrogan/edk2/commit/c6d4cda2561a0ec688ac3047611af48f137ec9df or https://github.com/spbrogan/edk2/blob/master/EmulatorPkg/Win/Host/WinHost.inf#L90 to see the addition for VS2019 Thanks Sean |
|
Eugene Khoruzhenko
Thanks Sean, this was very helpful!
|
|
Eugene Khoruzhenko
To build under VS2013 I had to add these two lines in \EmulatorPkg\Win\Host\WinHost.inf, for IA32 and X64 respectfully:
MSFT:*_VS2013_IA32_DLINK_FLAGS = /LIBPATH:"%VS2013_PREFIX%Lib" /LIBPATH:"%VS2013_PREFIX%VC\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib MSFT:*_VS2013_X64_DLINK_FLAGS = /LIBPATH:"%VS2013_PREFIX%VC\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib With VS2013 and probably below, it turned out to be very important that an X64 build must start from either "VS2013 x64 Native Tools Command Prompt" or "VS2013 x64 Cross Tools Command Prompt"; an IA32 build would have to start in either "VS2013 x86 Native Tools Command Prompt" or "Developer Command Prompt for VS2013". My build was by default choosing "Developer Command Prompt" and I got build errors. |
|
Eugene Khoruzhenko
Hi Sean, does EmulatorPkg support Authenticated UEFI variables? For some reason after initialization mVariableModuleGlobal->VariableGlobal.AuthFormat = FALSE and VariableServiceQueryVariableInfo() returns EFI_UNSUPPORTED. Nt32Pkg used to work well with Authenticated variables, maybe I do not configure EmulatorPkg properly? Thanks!
|
|
Sean
Eugene,
I actually haven't played with EmulatorPkg until 3 days ago when trying to stand up Platform Ci. I too used the old NT32 environment from time to time but am not well versed in the features of the EmulatorPkg. I found the readme lacking and was able to understand more from looking at the build.sh, buildVs.bat scripts, and DSC/FDF file. Hopefully someone on the mailing list can help. Thanks |
|