UDK2018 来了----常见编译问题

UDK2018 前一段时间正式 release 了:

https://github.com/tianocore/tianocore.github.io/wiki/UDK2018

编译方法可以在下面的页面找到

https://github.com/tianocore/tianocore.github.io/wiki/UDK2018-How-to-Build

要求 VS2015(我实验用VS2013编译没问题,但是为了避免后续碰到奇怪的问题,建议老老实实用 VS2015)、NASM 2.12.01、Python2.7.x、Openssl (这个应该是第一次正式提出来作为要求,但是实验表明如果只使用 Nt32那么是完全无需安装的)
1. 需要安装 VS2015(特别注意要勾选安装 VC 编译器和 WDK)
2. 安装 Python2.7.14(特别注意在安装界面选择将 Python 加入 Path)
3. 安装 Nasm(特别注意他默认的安装路径不是 c:\Nasm, 需要安装之后手工拷贝到这个目录下)
4. 解压edk2-vUDK2018.tar到 c:\UDK2018
5. 在 edksetup.bat 中加入下面的语句
a. Path c:\nasm;%path%
b. Set PYTHON_HOME=c:\python27
6. 解压edk2-BaseTools-win32-master到 BaseTools\Win32下面
7. 打开“VS2015 x64 Native Tools Command Prompt”。运行一次 edksetup.bat 之后运行 build。这样的编译会导致错误,但是能够在 conf\下面生成我们需要的 Target.bat 在这个文件中找到 TOOL_CHAIN_TAG = MYTOOLS ,修改为TOOL_CHAIN_TAG = VS2018x86,接下来就可使用下面的方法开始编译
a. 输入 edksetup.bat - -nt32
b. Build –a X64 或者 build –a IA32
c. Build run 即可运行 NT32 模拟环境

如果你的运气好,那么上述配置完成之后就可以正常使用 UDK2018 了。如果你的运气不好,还可能像我这样碰到下面的错误:
GenFds...
: error C0DE: Tools code failure
Please send email to edk2-devel@lists.01.org for help, attaching following call stack trace!

Traceback (most recent call last):
File "GenFds\GenFds.py", line 228, in main
File "c:\Users\Public\Documents\BuildPool\BaseTools\build\Source\Python\Workspace\WorkspaceDatabase.py", line 164, in __init__
File "c:\Users\Public\Documents\BuildPool\BaseTools\build\Source\Python\Common\LongFilePathOs.py", line 25, in remove
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: '\\\\?\\c:\\edk2-vudk2018\\conf\\.cache\\build.db'

Exception AttributeError: "'WorkspaceDatabase' object has no attribute 'Conn'" in > ignored
build...
: error 7000: Failed to execute command
GenFds -f c:\edk2-vudk2018\Nt32Pkg\Nt32Pkg.fdf --conf=c:\edk2-vudk2018\conf -o c:\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86 -t VS2015x86 -b DEBUG -p c:\edk2-vudk2018\Nt32Pkg\Nt32Pkg.dsc -a IA32 -D "EFI_SOURCE=c:\\edk2-vudk2018\\edkcompatibilitypkg" -D "EDK_SOURCE=c:\\edk2-vudk2018\\edkcompatibilitypkg" -D "TOOL_CHAIN_TAG=VS2015x86" -D "TOOLCHAIN=VS2015x86" -D "TARGET=DEBUG" -D "FAMILY=MSFT" -D "WORKSPACE=c:\\edk2-vudk2018" -D "EDK_TOOLS_PATH=c:\\edk2-vudk2018\\basetools" -D "ARCH=IA32" -D "ECP_SOURCE=c:\\edk2-vudk2018\\edkcompatibilitypkg" [C:\edk2-vUDK2018]

直接执行最后那一段出现问题的批处理是没问题的。就是说,在编译过程中 GenFds在访问 build.db 的时候会出现问题。顺便多说一句,很多年前我碰到过UEFI编译环境中的这支文件和公司杀毒软件冲突的情况。编译过程需要访问的这个文件被杀毒软件锁定导致编译无法继续。最诡异的是这个错误是随机出现的。最终只能更换到未安装杀毒软件的机器上编译,最终和杀毒软件厂商沟通,前后花了6个月才解决。因此,出现这样的问题非常令人头痛。
仔细观察得知执行的 GenFds 是位于\BaseTools\Bin\Win32下面的GenFds.exe,这是Python编译生成的 EXE。此外在\BaseTools\BinWrappers\WindowsLike 下面还存在GenFds.bat。它内容如下:

@setlocal
@set ToolName=%~n0%
@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

意思就是说,直接调用 Python去执行 GenFds.py。因此,可以将\BaseTools\Bin\Win32\GenFds.exe改名为GenFds.LABZ。然后把\BaseTools\BinWrappers\WindowsLike加入Path路径。编译过程中调用 GenFds指令实际执行的是 GenFds.bat。具体修改方法是在 Edksetup.bat 中加入下面的语句

path c:\nasm;BaseTools\BinWrappers\WindowsLike;%path%
set PYTHON_HOME=c:\python27;

最终可以保证编译正常。如果你在使用过程中碰到了 UDK2018 的问题,不妨在下面给我留言。

=============================================================

2018年6月11日

前面提到的“需要安装 VS2015(特别注意要勾选安装 VC 编译器和 WDK)” 其中应该是 SDK

2019年1月24日

最近在编译 AppPkg 的时候(Build NTPkg 无问题)遇到如下错误

c:\buildbs\UDK\StdLib\Include\sys/EfiCdefs.h(342): error C2220: warning treated as error - no 'object' file generated
c:\buildbs\UDK \StdLib\Include\sys/EfiCdefs.h(342): warning C4117: macro name 'STDC_HOSTED' is reserved, '#define' ignored

检查代码 \StdLib\Include\sys\EfiCdefs.h 有如下定义

// Keep compiler quiet about casting from smaller to larger types
#pragma warning ( disable : 4306 )

#define STDC 1
#define STDC_VERSION 199409L
#define STDC_HOSTED 1 //这个定义导致问题

删除 STDC_HOSTED 定义,或者添加如下编译指令都可以修复这个问题

// Keep compiler quiet about casting from smaller to larger types
#pragma warning ( disable : 4306 )
#pragma warning ( disable : 4117 )

#define STDC 1
#define STDC_VERSION 199409L
#define STDC_HOSTED 1

《UDK2018 来了----常见编译问题》有82个想法

  1. 特别注意要勾选安装 VC 编译器和 WDK
    这两个在安装中,我选择自定义安装,都没找到您说这两个?可惜不能放图片

  2. 在进行build AppPkg中的Main时出现STDC_HOSTED 的问题,将其屏蔽后,出现了如下问题:
    c:\myworkspace\edk2-vudk2018\Build\AouyyxPkg\DEBUG_VS2017\IA32\AouyyxPkg\Main\main\OUTPUT\static_library_files.lst
    LibGdtoa.lib(ldtoa.obj) : error LNK2001: 无法解析的外部符号 ___fpclassifyd
    c:\myworkspace\edk2-vudk2018\Build\AouyyxPkg\DEBUG_VS2017\IA32\AouyyxPkg\Main\main\DEBUG\main.dll : fatal error LNK1120: 1 个无法解析的外部命令
    NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\link.exe"”: 返回代码“0x460”
    Stop.

    希望能帮忙解下惑

          1. 我根据UEFI原理与编程,编译最开始的UEFI MAIN 和Shell Main都没有问题,目前就编译StdLib出现问题。
            您说的201903是最新出的EDK2吗

          2. 我上午装了一下 VS2017 有点问题,没法编译,回头还得重新下。那个 201903 是最新的 EDK2 推荐你用,我感觉比 2018 的两个版本都好用。

  3. 請問再Build MdeModulePkg 的時候有遇過下面的問題嗎?? RamDisk 少了東西 但是其他的pKG 是可以BUILD 成功的 可否分享您的經驗? 謝謝
    Building ... d:\udk2018\udk2018\MdeModulePkg\Universal\SmmCommunicationBufferDxe\SmmCommunicationBufferDxe.inf [X64]
    Building ... d:\udk2018\udk2018\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe.inf [X64]
    Trim --asl-file -o d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.i -i d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\inc.lst d:\udk2018\udk2018\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDisk.asl
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\x86_amd64\cl.exe" /nologo /E /C /FIAutoGen.h /Id:\udk2018\udk2018\MdeModulePkg\Universal\Disk\RamDiskDxe /Id:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\DEBUG /Id:\udk2018\udk2018\MdePkg /Id:\udk2018\udk2018\MdePkg\Include /Id:\udk2018\udk2018\MdePkg\Include\X64 /Id:\udk2018\udk2018\MdeModulePkg /Id:\udk2018\udk2018\MdeModulePkg\Include /Id:\udk2018\udk2018\MdeModulePkg\Universal\Disk\RamDiskDxe d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.i > d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.iii
    RamDisk.i
    Trim --source-code -l -o d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.iiii d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.iii
    "C:\ASL\iasl.exe" -pd:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.aml d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe\OUTPUT\.\RamDisk.iiii
    系統找不到指定的路徑。
    NMAKE : fatal error U1077: '"C:\ASL\iasl.exe' : 傳回碼 '0x1'
    Stop.

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\nmake.exe /nologo tbuild [d:\udk2018\udk2018\Build\MdeModule\DEBUG_VS2015x86\X64\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe]

    build.py...
    : error F002: Failed to build module
    d:\udk2018\udk2018\MdeModulePkg\Universal\Disk\RamDiskDxe\RamDiskDxe.inf [X64, VS2015x86, DEBUG]

  4. 請問您有遇過以下問題嗎?
    Architecture(s) = IA32
    Build target = DEBUG
    Toolchain = VS2015x86

    Active Platform = d:\udk2018\udk2018\Nt32Pkg\Nt32Pkg.dsc
    Flash Image Definition = d:\udk2018\udk2018\Nt32Pkg\Nt32Pkg.fdf

    Processing meta-data ........ done!
    Building ... d:\udk2018\udk2018\MdePkg\Library\PeiMemoryAllocationLib\PeiMemoryAllocationLib.inf [IA32]
    Building ... d:\udk2018\udk2018\MdePkg\Library\PeiServicesLib\PeiServicesLib.inf [IA32]
    系統找不到指定的路徑。

    build.py...
    : error 7000: Failed to execute command
    Vc\bin\nmake.exe /nologo tbuild [d:\udk2018\udk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdePkg\Library\PeiMemoryAllocationLib\PeiMemoryAllocationLib]

    build.py...
    : error 7000: Failed to execute command
    Vc\bin\nmake.exe /nologo tbuild [d:\udk2018\udk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdePkg\Library\PeiServicesLib\PeiServicesLib]

    build.py...
    : error F002: Failed to build module
    d:\udk2018\udk2018\MdePkg\Library\PeiMemoryAllocationLib\PeiMemoryAllocationLib.inf [IA32, VS2015x86, DEBUG]

    - Failed -
    Build end time: 15:41:39, Apr.08 2020
    Build total time: 00:00:09

  5. Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in
    exec(code, m.__dict__)
    File "GenFds\GenFds.py", line 24, in
    ValueError: Attempted relative import in non-package

      1. 你用的是这篇文章提到的版本吗?在虚拟机上试试文章提到的方法也会碰到同样的问题吗?
        后来的 EDK Release 和本文差别比较大。

    1. 刚刚我尝试下edksetup.bat rebuild,重新生成win32工具后,再次build,居然成功了。可能是解压缩的win32工具包和自己的电脑不匹配。
      之后,我多做了几次尝试,发现单纯edksetup.bat --nt32、build,又会报同样的错误,但是再次重新edksetup.bat rebuild后,又能build过了,有点一次性的意味,具体原因尚不明确,希望有懂的人讲解一下。

      1. 理论上,win32\bin 下面的东西是不能在不同项目之前共享的,我也遇到过因为项目依赖的原因,必须重新编译工具的情况。

  6. Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in
    exec(code, m.__dict__)
    File "GenFds\GenFds.py", line 24, in
    ValueError: Attempted relative import in non-package

    build...
    : error 7000: Failed to execute command
    GenFds -f c:\edk2\Nt32Pkg\Nt32Pkg.fdf --conf=c:\edk2\conf -o c:\edk2\Build\NT32IA32\DEBUG_VS2017 -t VS2017 -b DEBUG -p c:\edk2\Nt32Pkg\Nt32Pkg.dsc -a IA32 -D "EFI_SOURCE=c:\\edk2\\edkcompatibilitypkg" -D "EDK_SOURCE=c:\\edk2\\edkcompatibilitypkg" -D "TOOL_CHAIN_TAG=VS2017" -D "TOOLCHAIN=VS2017" -D "TARGET=DEBUG" -D "FAMILY=MSFT" -D "WORKSPACE=c:\\edk2" -D "EDK_TOOLS_PATH=c:\\edk2\\basetools" -D "ARCH=IA32" -D "ECP_SOURCE=c:\\edk2\\edkcompatibilitypkg" [C:\edk2]

  7. 请问为啥会出这种问题啊

    Building ... c:\edk2\MdeModulePkg\Universal\ReportStatusCodeRouter\Pei\ReportStatusCodeRouterPei.inf [IA32]
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\link.exe" /out:"c:\edk2\Build\NT32IA32\DEBUG_VS2015x86\IA32\SecMain.exe" /base:0x10000000 /pdb:"c:\edk2\Build\NT32IA32\DEBUG_VS2015x86\IA32\SecMain.pdb" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\Lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\PlatformSdk\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 vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib /EXPORT:InitializeDriver=_ModuleEntryPoint /BASE:0x10000 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE @c:\edk2\Build\NT32IA32\DEBUG_VS2015x86\IA32\Nt32Pkg\Sec\SecMain\OUTPUT\static_library_files.lst
    Building ... c:\edk2\MdeModulePkg\Universal\StatusCodeHandler\Pei\StatusCodeHandlerPei.inf [IA32]
    Building ... c:\edk2\Nt32Pkg\WinNtOemHookStatusCodeHandlerPei\WinNtOemHookStatusCodeHandlerPei.inf [IA32]
    Building ... c:\edk2\Nt32Pkg\BootModePei\BootModePei.inf [IA32]
    Building ... c:\edk2\Nt32Pkg\StallPei\StallPei.inf [IA32]
    LINK : warning LNK4108: 已指定 /ALIGN 而没有指定 /DRIVER;映像可能不能运行
    LINK : fatal error LNK1181: 无法打开输入文件“ucrtd.lib”
    Building ... c:\edk2\Nt32Pkg\WinNtFlashMapPei\WinNtFlashMapPei.inf [IA32]
    NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\link.exe"”: 返回代码“0x49d”
    Stop.

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\nmake.exe /nologo tbuild [c:\edk2\Build\NT32IA32\DEBUG_VS2015x86\IA32\Nt32Pkg\Sec\SecMain]
    Building ... c:\edk2\MdeModulePkg\Universal\FaultTolerantWritePei\FaultTolerantWritePei.inf [IA32]

    build.py...
    : error F002: Failed to build module
    c:\edk2\Nt32Pkg\Sec\SecMain.inf [IA32, VS2015x86, DEBUG]

    - Failed -
    Build end time: 14:43:38, Apr.13 2020
    Build total time: 00:00:26

  8. 请问这是真么原因啊

    Building ... c:\edk2\Nt32Pkg\StallPei\StallPei.inf [IA32]
    LINK : warning LNK4108: 已指定 /ALIGN 而没有指定 /DRIVER;映像可能不能运行
    LINK : fatal error LNK1181: 无法打开输入文件“ucrtd.lib”
    Building ... c:\edk2\Nt32Pkg\WinNtFlashMapPei\WinNtFlashMapPei.inf [IA32]
    NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\link.exe"”: 返回代码“0x49d”
    Stop.

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\nmake.exe /nologo tbuild [c:\edk2\Build\NT32IA32\DEBUG_VS2015x86\IA32\Nt32Pkg\Sec\SecMain]
    Building ... c:\edk2\MdeModulePkg\Universal\FaultTolerantWritePei\FaultTolerantWritePei.inf [IA32]

    build.py...
    : error F002: Failed to build module
    c:\edk2\Nt32Pkg\Sec\SecMain.inf [IA32, VS2015x86, DEBUG]

    - Failed -
    Build end time: 14:43:38, Apr.13 2020
    Build total time: 00:00:26

    1. 根据提示是没有找到对应的连接 Lib 导致的。看起来有可能是没有指定 SDK 的路径。建议在虚拟机中试验看看。

  9. 虽然能够构建成功并且进入模拟器,但是构建过程中中间有两段警告,大神知道是什么原因吗??

    LBINK : warning LNK4108: 已指定 /ALIGN 而没有指定 /DRIVER;映像可能不能运行
    uilding ... c:\edk2\Nt32Pkg\BootModePei\BootModePei.inf [IA32]
    LINK : warning LNK4001: 未指定对象文件;已使用库
    正在创建库 c:\edk2\Build\NT32IA32\DEBUG_VS2010x86\IA32\SecMain.lib 和对象 c:\edk2\Build\NT32IA32\DEBUG_VS2010x86\IA32\SecMain.exp

  10. 为啥会提示 ‘GenFw'找不到错误 !有什么可能的原因呢

    Generating code
    'GenFw' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    "GenFw" -e PEIM -o c:\edk2\Build\Emulator\RELEASE_VS2015\X64\EmulatorPkg\BootModePei\BootModePei\DEBUG\BootModePei.efi c:\edk2\Build\Emulator\RELEASE_VS2015\X64\EmulatorPkg\BootModePei\BootModePei\DEBUG\BootModePei.dll
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\x86_amd64\link.exe" /OUT:c:\edk2\Build\Emulator\RELEASE_VS2015\X64\EmulatorPkg\Sec\Sec\DEBUG\EmuSec.dll /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data @c:\edk2\Build\Emulator\RELEASE_VS2015\X64\EmulatorPkg\Sec\Sec\OUTPUT\static_library_files.lst
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\x86_amd64\cl.exe" /Foc:\edk2\Build\Emulator\RELEASE_VS2015\X64\MdeModulePkg\Core\Dxe\DxeMain\OUTPUT\Misc\Stall.obj /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Ic:\edk2\MdeModulePkg\Core\Dxe\DxeMain /Ic:\edk2\MdeModulePkg\Core\Dxe\Dispatcher /Ic:\edk2\MdeModulePkg\Core\Dxe\Event /Ic:\edk2\MdeModulePkg\Core\Dxe\FwVol /Ic:\edk2\MdeModulePkg\Core\Dxe\FwVolBlock /Ic:\edk2\MdeModulePkg\Core\Dxe\Mem /Ic:\edk2\MdeModulePkg\Core\Dxe\Gcd /Ic:\edk2\MdeModulePkg\Core\Dxe\Hand /Ic:\edk2\MdeModulePkg\Core\Dxe\Library /Ic:\edk2\MdeModulePkg\Core\Dxe\Misc /Ic:\edk2\MdeModulePkg\Core\Dxe\Image /Ic:\edk2\MdeModulePkg\Core\Dxe\SectionExtraction /Ic:\edk2\MdeModulePkg\Core\Dxe /Ic:\edk2\Build\Emulator\RELEASE_VS2015\X64\MdeModulePkg\Core\Dxe\DxeMain\DEBUG /Ic:\edk2\MdePkg /Ic:\edk2\MdePkg\Include /Ic:\edk2\MdePkg\Include\X64 /Ic:\edk2\MdeModulePkg /Ic:\edk2\MdeModulePkg\Include c:\edk2\MdeModulePkg\Core\Dxe\Misc\Stall.c
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\x86_amd64\link.exe" /OUT:c:\edk2\Build\Emulator\RELEASE_VS2015\X64\IntelFrameworkModulePkg\Universal\StatusCode\Pei\StatusCodePei\DEBUG\StatusCodePei.dll /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data @c:\edk2\Build\Emulator\RELEASE_VS2015\X64\IntelFrameworkModulePkg\Universal\StatusCode\Pei\StatusCodePei\OUTPUT\static_library_files.lst
    Generating code
    Generating code
    NMAKE : fatal error U1077: '"GenFw' : return code '0x1'
    Stop.
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\x86_amd64\cl.exe" /Foc:\edk2\Build\Emulator\RELEASE_VS2015\X64\MdeModulePkg\Core\Pei\PeiMain\OUTPUT\Image\Image.obj /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Ic:\edk2\MdeModulePkg\Core\Pei\PciCfg2 /Ic:\edk2\MdeModulePkg\Core\Pei\CpuIo /Ic:\edk2\MdeModulePkg\Core\Pei\BootMode /Ic:\edk2\MdeModulePkg\Core\Pei\Dependency /Ic:\edk2\MdeModulePkg\Core\Pei\Dispatcher /Ic:\edk2\MdeModulePkg\Core\Pei\FwVol /Ic:\edk2\MdeModulePkg\Core\Pei\Hob /Ic:\edk2\MdeModulePkg\Core\Pei\Image /Ic:\edk2\MdeModulePkg\Core\Pei\Memory /Ic:\edk2\MdeModulePkg\Core\Pei\PeiMain /Ic:\edk2\MdeModulePkg\Core\Pei\Ppi /Ic:\edk2\MdeModulePkg\Core\Pei\Reset /Ic:\edk2\MdeModulePkg\Core\Pei\Security /Ic:\edk2\MdeModulePkg\Core\Pei\StatusCode /Ic:\edk2\MdeModulePkg\Core\Pei /Ic:\edk2\Build\Emulator\RELEASE_VS2015\X64\MdeModulePkg\Core\Pei\PeiMain\DEBUG /Ic:\edk2\MdePkg /Ic:\edk2\MdePkg\Include /Ic:\edk2\MdePkg\Include\X64 /Ic:\edk2\MdeModulePkg /Ic:\edk2\MdeModulePkg\Include c:\edk2\MdeModulePkg\Core\Pei\Image\Image.c
    Finished generating code
    Finished generating code
    Finished generating code

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\nmake.exe /nologo tbuild [c:\edk2\Build\Emulator\RELEASE_VS2015\X64\MdeModulePkg\Universal\ReportStatusCodeRouter\Pei\ReportStatusCodeRouterPei]

  11. ļ
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\IndustryStandard/AcpiAml.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Uefi/UefiGpt.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Uefi/UefiInternalFormRepresentation.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/GraphicsOutput.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Uefi/UefiSpec.h
    "D:\UEFIWorkspace\NASMnasm" -Id:\uefiworkspace\edk2\MdePkg\Library\BaseMemoryLibRepStr\X64\ -Id:\uefiworkspace\edk2\MdePkg\Library\BaseMemoryLibRepStr\X64\ -Id:\uefiworkspace\edk2\MdePkg\Library\BaseMemoryLibRepStr\ -Id:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseMemoryLibRepStr\BaseMemoryLibRepStr\DEBUG\ -Id:\uefiworkspace\edk2\MdePkg\ -Id:\uefiworkspace\edk2\MdePkg\Include\ -Id:\uefiworkspace\edk2\MdePkg\Test\UnitTest\Include\ -Id:\uefiworkspace\edk2\MdePkg\Include\X64\ -Ox -f win64 -o d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseMemoryLibRepStr\BaseMemoryLibRepStr\OUTPUT\X64\CompareMem.obj d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseMemoryLibRepStr\BaseMemoryLibRepStr\OUTPUT\X64\CompareMem.iii
    "D:\UEFIWorkspace\NASMnasm" -Id:\uefiworkspace\edk2\MdePkg\Library\BaseLib\X64\ -Id:\uefiworkspace\edk2\MdePkg\Library\BaseLib\X64\ -Id:\uefiworkspace\edk2\MdePkg\Library\BaseLib\ -Id:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\DEBUG\ -Id:\uefiworkspace\edk2\MdePkg\ -Id:\uefiworkspace\edk2\MdePkg\Include\ -Id:\uefiworkspace\edk2\MdePkg\Test\UnitTest\Include\ -Id:\uefiworkspace\edk2\MdePkg\Include\X64\ -Ox -f win64 -o d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuId.obj d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuId.iii
    NMAKE : fatal error U1077: "D:\UEFIWorkspace\NASMnasm: ش롰0x1
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/SimpleTextIn.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Uefi/UefiInternalFormRepresentation.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Guid/HiiFormMapMethodGuid.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/EdidDiscovered.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Uefi/UefiMultiPhase.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Guid/WinCertificate.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/SimpleTextInEx.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Guid/HiiFormMapMethodGuid.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Pi/PiDxeCis.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/EdidActive.h
    Stop.
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/DevicePath.h

    build.py...
    : error 7000: Failed to execute command
    D:\IDE\VS2019\VC\Tools\MSVC\14.28.29910\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseIoLibIntrinsic\BaseIoLibIntrinsicSev]
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/SimpleTextOut.h
    ע: ļ: d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\ShellPkg\Library\UefiShellBcfgCommandLib\UefiShellBcfgCommandLib\DEBUG\UefiShellBcfgCommandLibStrDefs.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Pi/PiMultiPhase.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Protocol/EdidOverride.h
    ע: ļ: d:\uefiworkspace\edk2\MdePkg\Include\Guid/PcAnsi.h

    build.py...
    : error 7000: Failed to execute command
    D:\IDE\VS2019\VC\Tools\MSVC\14.28.29910\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseLib\BaseLib]

    build.py...
    : error 7000: Failed to execute command
    D:\IDE\VS2019\VC\Tools\MSVC\14.28.29910\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\uefiworkspace\edk2\Build\OvmfX64\RELEASE_VS2019\X64\MdePkg\Library\BaseMemoryLibRepStr\BaseMemoryLibRepStr]

    build.py...
    : error F002: Failed to build module
    d:\uefiworkspace\edk2\MdePkg\Library\BaseIoLibIntrinsic\BaseIoLibIntrinsicSev.inf [X64, VS2019, RELEASE]

    - Failed -
    Build end time: 21:38:08, Apr.04 2021
    Build total time: 00:00:12
    可以请问这是什么问题吗,搞了一星期没搞出来,心态逐渐爆炸

      1. 添加NASM的环境变量时,要确保NASM_PREFIX的变量值路径最后有一个斜杠(例如:C:\NASM\)。我是这么解决的,可以试一下

  12. "c:\Program Files\Windows Kits\8.1\bin\x86\\rc.exe" /Foc:\uefi\edk2\Build\NT32IA32\DEBUG_VS2015\IA32\MdeModulePkg\Application\HelloWorld\HelloWorld\OUTPUT\HelloWorldhii.lib c:\uefi\edk2\Build\NT32IA32\DEBUG_VS2015\IA32\MdeModulePkg\Application\HelloWorld\HelloWorld\OUTPUT\HelloWorldhii.rc
    c:\uefi\edk2\Build\NT32IA32\DEBUG_VS2015\IA32\FatPkg\EnhancedFatDxe\Fat\DEBUG\Fat.pdb
    複製了 1 個檔案。
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\lib.exe" /NOLOGO /LTCG /OUT:c:\uefi\edk2\Build\NT32IA32\DEBUG_VS2015\IA32\MdeModulePkg\Universal\Network\DpcDxe\DpcDxe\OUTPUT\DpcDxe.lib @c:\uefi\edk2\Build\NT32IA32\DEBUG_VS2015\IA32\MdeModulePkg\Universal\Network\DpcDxe\DpcDxe\OUTPUT\object_files.lst
    'c:\Program' 不是內部或外部命令、可執行的程式或批次檔。
    NMAKE : fatal error U1077: '"c:\Program Files\Windows Kits\8.1\bin\x86\\rc.exe' : 傳回碼 '0x1'
    Stop.
    Building ... c:\uefi\edk2\MdeModulePkg\Universal\Network\Dhcp4Dxe\Dhcp4Dxe.inf [IA32]

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Vc\bin\nmake.exe /nologo tbuild [c:\uefi\edk2\Build\NT32IA32\DEBUG_VS2015\IA32\MdeModulePkg\Application\HelloWorld\HelloWorld]

    build.py...
    : error F002: Failed to build module
    c:\uefi\edk2\MdeModulePkg\Application\HelloWorld\HelloWorld.inf [IA32, VS2015, DEBUG]

    - Failed -
    Build end time: 16:45:01, Jun.17 2021
    Build total time: 00:02:00
    这个地方卡了很久, 请问是哪边出了错

    1. 不好意思,今天刚看到你这个问题。这个问题是命令没有引号导致的。比如: 执行 “c:\program file\vc\rc.exe”,没有引号会导致把c:\program 当成一个文件来执行。

      如果所有的程序都会有这个问题,那就是你安装编译环境的问题。如果只是你程序的问题,那就要检查编译路径之类的了。

    2. 有大神说过了:
      该过程可能会出现脚本去C:\Program Files\ 下找Windows Kits的情况, 但一般Windows Kits在C:\Program Files(x86)\下, 而C:\Program Files\中并无此文件夹, 故而导致报错. 此时可以以管理员身份v执行 mklink /j "C:\Program Files\Windows Kits""C:\Program Files (x86)\Windows Kits" 创建一个软链接.
      我自己的方法是从C:\Program Files (x86)\Windows Kits\ copy 到C:\Program Files\Windows Kits 可以解决。

  13. "C:\NASMnasm" -Id:\edk2\edk2-master-2019\MdePkg\Library\BaseLib\Ia32\ -Id:\edk2\edk2-master-2019\MdePkg\Library\BaseLib\Ia32\ -Id:\edk2\edk2-master-2019\MdePkg\Library\BaseLib\ -Id:\edk2\edk2-master-2019\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdePkg\Library\BaseLib\BaseLib\DEBUG\ -Id:\edk2\edk2-master-2019\MdePkg\ -Id:\edk2\edk2-master-2019\MdePkg\Include\ -Id:\edk2\edk2-master-2019\MdePkg\Test\UnitTest\Include\ -Id:\edk2\edk2-master-2019\MdePkg\Include\Ia32\ -Ox -f win32 -g -o d:\edk2\edk2-master-2019\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdePkg\Library\BaseLib\BaseLib\OUTPUT\Ia32\DivU64x64Remainder.obj d:\edk2\edk2-master-2019\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdePkg\Library\BaseLib\BaseLib\OUTPUT\Ia32\DivU64x64Remainder.iii
    'C:\NASMnasm' ڲⲿҲǿеij
    ļ
    NMAKE : fatal error U1077: "C:\NASMnasm: ش롰0x1
    Stop.
    Building ... d:\edk2\edk2-master-2019\MdeModulePkg\Library\AuthVariableLibNull\AuthVariableLibNull.inf [IA32]

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\edk2\edk2-master-2019\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdePkg\Library\BaseLib\BaseLib]

    build.py...
    : error F002: Failed to build module
    d:\edk2\edk2-master-2019\MdePkg\Library\BaseLib\BaseLib.inf [IA32, VS2017, DEBUG]

    1. 我记得是 nasm 路径的问题,你设定的 nasm 路径是 C:\NASM,然后nmake 调用的是 C:\NASMnasm,而实际上应该是 C:\NASM\nasm

      1. 好的,谢谢,但是我解决了那个问题之后遇上了新的问题
        GenFfs -t EFI_FV_FILETYPE_DRIVER -g C6760651-A38D-5F4F-AEAF-F6661549DF75 -o d:\edk2\edk2-master-2019\Build\EmulatorX64\DEBUG_VS2017\FV\Ffs\C6760651-A38D-5F4F-AEAF-F6661549DF75EmuBlockIo\C6760651-A38D-5F4F-AEAF-F6661549DF75.ffs -oi d:\edk2\edk2-master-2019\Build\EmulatorX64\DEBUG_VS2017\FV\Ffs\C6760651-A38D-5F4F-AEAF-F6661549DF75EmuBlockIo\C6760651-A38D-5F4F-AEAF-F6661549DF75SEC2.com
        GenFfs: ERROR 1000: Unknown option
        -oi
        NMAKE : fatal error U1077: D:\edk2\edk2-master-2019\BaseTools\Bin\Win32\GenFfs.EXE: ش롰0x2
        Stop.
        Building ... d:\edk2\edk2-master-2019\MdeModulePkg\Universal\LoadFileOnFv2\LoadFileOnFv2.inf [X64]
        请问一下这个问题是什么原因呢?我怀疑是basetools-win32编译不了新版本的edk2的问题,但是我对win32进行了重编译,他报了以下的错误
        BasePeCoff.c
        BasePeCoff.c(129): error C2220: 警告被视为错误 - 没有生成“object”文件
        BasePeCoff.c(129): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(129): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_OPTIONAL_HEADER_UNION *”
        BasePeCoff.c(561): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“UINT8 *”
        BasePeCoff.c(629): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_OPTIONAL_HEADER_UNION *”
        BasePeCoff.c(703): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_TE_IMAGE_HEADER *”
        BasePeCoff.c(717): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_BASE_RELOCATION *”
        BasePeCoff.c(718): warning C4311: “类型强制转换”: 从“EFI_IMAGE_BASE_RELOCATION *”到“UINTN”的指针截断
        BasePeCoff.c(718): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_BASE_RELOCATION *”
        BasePeCoff.c(740): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“CHAR8 *”
        BasePeCoff.c(743): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“CHAR8 *”
        BasePeCoff.c(745): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“CHAR8 *”
        BasePeCoff.c(782): warning C4311: “类型强制转换”: 从“CHAR8 *”到“UINTN”的指针截断
        BasePeCoff.c(792): warning C4311: “类型强制转换”: 从“CHAR8 *”到“UINTN”的指针截断
        BasePeCoff.c(954): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        BasePeCoff.c(957): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_OPTIONAL_HEADER_UNION *”
        BasePeCoff.c(975): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        BasePeCoff.c(977): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_TE_IMAGE_HEADER *”
        BasePeCoff.c(1017): warning C4311: “类型强制转换”: 从“CHAR8 *”到“UINTN”的指针截断
        BasePeCoff.c(1018): warning C4311: “类型强制转换”: 从“CHAR8 *”到“UINTN”的指针截断
        BasePeCoff.c(1077): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1135): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *”
        BasePeCoff.c(1158): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        BasePeCoff.c(1273): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1273): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_NT_HEADERS32 *”
        BasePeCoff.c(1294): warning C4311: “类型强制转换”: 从“EFI_TE_IMAGE_HEADER *”到“UINTN”的指针截断
        BasePeCoff.c(1298): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *”
        BasePeCoff.c(1363): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1366): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *”
        BasePeCoff.c(1393): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1397): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        BasePeCoff.c(1441): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1441): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“EFI_IMAGE_NT_HEADERS32 *”
        BasePeCoff.c(1454): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        BasePeCoff.c(1455): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1458): warning C4312: “类型强制转换”: 从“UINT32”转换到更大的“void *”
        BasePeCoff.c(1460): warning C4312: “类型强制转换”: 从“UINT32”转换到更大的“void *”
        BasePeCoff.c(1462): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        BasePeCoff.c(1464): warning C4311: “类型强制转换”: 从“void *”到“UINTN”的指针截断
        BasePeCoff.c(1464): warning C4312: “类型强制转换”: 从“UINTN”转换到更大的“void *”
        NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe"”: 返回代码“0x2”
        Stop.
        NMAKE : fatal error U1077: “if”: 返回代码“0x1”
        Stop.

        1. 这个问题应该是因为你打开 VS201X X64 CMD 窗口进行编译导致的。这个窗口编译代码没问题,但是编译 Basetool 有问题。解决方法是:用 VS201X X86 窗口编译。

          1. 好的,谢谢,我之前是用x64和x86兼容的命令窗口打开的,后面换了X86的命令窗口果然就行了,感谢

          2. 你好,我使用的VS2017 X86 窗口编译还是出现了类似的报错,请问有什么解决方法吗?

            GenFfs -t EFI_FV_FILETYPE_PEIM -g C9FAF091-57F8-A64C-A07A-445B124F0D93 -o c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93.ffs -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC1.1.dpx -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC2.1.pe32 -n 0 -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC3.ui -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC4.ver
            GenFfs: ERROR 1000: Unknown option
            -oi
            NMAKE : fatal error U1077: c:\try1\edk2\BaseTools\Bin\Win32\GenFfs.EXE: ش롰0x2
            Stop.
            Building ... c:\try1\edk2\MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDiskDxe.inf [IA32]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\EmulatorPkg\FlashMapPei\FlashMapPei]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdeModulePkg\Universal\SetupBrowserDxe\SetupBrowserDxe]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\NetworkPkg\Ip4Dxe\Ip4Dxe]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDiskDxe]

            build.py...
            : error F002: Failed to build module
            c:\try1\edk2\EmulatorPkg\FlashMapPei\FlashMapPei.inf [IA32, VS2017, DEBUG]

            - Failed -

          3. GenFfs -t EFI_FV_FILETYPE_PEIM -g C9FAF091-57F8-A64C-A07A-445B124F0D93 -o c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93.ffs -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC1.1.dpx -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC2.1.pe32 -n 0 -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC3.ui -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC4.ver
            GenFfs: ERROR 1000: Unknown option

            你手工运行一下,看看是那个参数有问题导致的这个错误

          4. 你好,我使用VS2011 X86 CMD 窗口进行编译,但还是出现了上面类似的GenFfs报错,请问有什么解决方法吗?

            GenFfs -t EFI_FV_FILETYPE_PEIM -g C9FAF091-57F8-A64C-A07A-445B124F0D93 -o c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93.ffs -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC1.1.dpx -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC2.1.pe32 -n 0 -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC3.ui -oi c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\FV\Ffs\C9FAF091-57F8-A64C-A07A-445B124F0D93FlashMapPei\C9FAF091-57F8-A64C-A07A-445B124F0D93SEC4.ver
            GenFfs: ERROR 1000: Unknown option
            -oi
            NMAKE : fatal error U1077: c:\try1\edk2\BaseTools\Bin\Win32\GenFfs.EXE: ش롰0x2
            Stop.
            Building ... c:\try1\edk2\MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDiskDxe.inf [IA32]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\EmulatorPkg\FlashMapPei\FlashMapPei]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdeModulePkg\Universal\SetupBrowserDxe\SetupBrowserDxe]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\NetworkPkg\Ip4Dxe\Ip4Dxe]

            build.py...
            : error 7000: Failed to execute command
            C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\try1\edk2\Build\EmulatorIA32\DEBUG_VS2017\IA32\MdeModulePkg\Bus\Scsi\ScsiDiskDxe\ScsiDiskDxe]

            build.py...
            : error F002: Failed to build module
            c:\try1\edk2\EmulatorPkg\FlashMapPei\FlashMapPei.inf [IA32, VS2017, DEBUG]

            - Failed -

  14. vs2015 build 后 secmain 可以执行, Shell 却不能输入文字、画面卡住了,这个有解决方法吗。重装过几次vs2015都不行

    1. 建议你在虚拟机中试试,如果别人没有看到现象或者碰到过同样的问题,很难给你解答。推荐英文系统安装一下试试。

      1. 我也遇到这种情况了,使用的是VS2015+UDK2018,不管是build run,还是直接运行secmain.exe,都能进入shell环境,但是输入不了字符,画面卡住了。我的同学的情况也是能进shell,但是不能输入字符。
        后来,我又下载了stable/202011版本,编译了EmulatorPkg,使用winhost同样会卡住,输入不了字符。
        使用QEMU+OVMF,能进入shell,可以输入字符,但是没法找到fs0。

        1. 已经向别人问到解决办法,使用win10自带的输入法在运行secmian.exe时会卡主,重新下载了个搜狗输入法,切换英文模式,运行secmain.exe后,可以正常敲命令了。

  15. Processing meta-data .................... done!
    Building ... c:\edk2\MdePkg\Library\BasePcdLibNull\BasePcdLibNull.inf [X64]
    Building ... c:\edk2\MdePkg\Library\BaseLib\BaseLib.inf [X64]
    B uilding ... c:\edk2\MdePkg\Library\BaseMemoryLib\BaseMemoryLib.inf [X64]
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\cl.exe" /nologo /E /TC /FIAutoGen.h /Ic:\edk2\MdePkg\Library\BaseLib\X64 /Ic:\edk2\MdePkg\Library\BaseLib /Ic:\edk2\Build\Emulator\DEBUG_VS2015\X64\MdePkg\Library\BaseLib\BaseLib\DEBUG /Ic:\edk2\MdePkg /Ic:\edk2\MdePkg\Include /Ic:\edk2\MdePkg\Include\X64 c:\edk2\MdePkg\Library\BaseLib\X64\Thunk16.nasm > c:\edk2\Build\Emulator\DEBUG_VS2015\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\Thunk16.i
    Thunk16.nasm
    Building ... c:\edk2\EmulatorPkg\Library\SecPpiListLib\SecPpiListLib.inf [X64]
    BTrim --trim-long --source-code -o c:\edk2\Build\Emulator\DEBUG_VS2015\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\Thunk16.iii c:\edk2\Build\Emulator\DEBUG_VS2015\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\Thunk16.i
    uilding ... c:\edk2\EmulatorPkg\Library\SecPeiServicesLib\SecPeiServicesLib.inf [X64]
    'Trim' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    NMAKE : fatal error U1077: “Trim”: 返回代码“0x1”
    Stop.

      1. cl: error D8021 :效值/Wv:18
        NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\cl.exe": 卮搿?x2
        Traceback (most recent call last):
        File "C:\python27\lib\logging\__init__.py", line 891, in emit
        stream.write(fs % msg.encode("UTF-8"))
        IOError: [Errno 0] Error
        Logged from file AutoGenWorker.py, line 91
        Stop.

        有遇到过这个问题吗?

  16. For.c
    UefiShellDriver1CommandsLib.c
    Trim --trim-long --source-code -o c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuId.iii c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuId.ii
    AutoGen.c
    EfiCompress.c
    MpFuncs.nasm
    IsZeroBuffer.nasm
    Trim --trim-long --source-code -o c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseMemoryLibRepStr\BaseMemoryLibRepStr\OUTPUT\X64\IsZeroBuffer.iii c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseMemoryLibRepStr\BaseMemoryLibRepStr\OUTPUT\X64\IsZeroBuffer.ii
    Trim --trim-long --source-code -o c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\UefiCpuPkg\Library\MpInitLib\DxeMpInitLib\OUTPUT\X64\MpFuncs.iii c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\UefiCpuPkg\Library\MpInitLib\DxeMpInitLib\OUTPUT\X64\MpFuncs.ii
    AutoGen.c
    Help.c
    GenFfs -t EFI_FV_FILETYPE_RAW -g 1BA0062E-C779-4582-8566-336AE8F78F09 -o c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\FV\Ffs\1BA0062E-C779-4582-8566-336AE8F78F09ResetVector\1BA0062E-C779-4582-8566-336AE8F78F09.ffs -oi c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\FV\Ffs\1BA0062E-C779-4582-8566-336AE8F78F09ResetVector\1BA0062E-C779-4582-8566-336AE8F78F09SEC1.1.raw -n 16
    AutoGen.c
    Goto.c
    SerMode.c
    UefiShellLevel3CommandsLib.c
    Unload.c
    "C:\NASM\nasm" -Ic:\uefiproject\edk2\MdePkg\Library\BaseLib\X64\ -Ic:\uefiproject\edk2\MdePkg\Library\BaseLib\X64\ -Ic:\uefiproject\edk2\MdePkg\Library\BaseLib\ -Ic:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\DEBUG\ -Ic:\uefiproject\edk2\MdePkg\ -Ic:\uefiproject\edk2\MdePkg\Include\ -Ic:\uefiproject\edk2\MdePkg\Test\UnitTest\Include\ -Ic:\uefiproject\edk2\MdePkg\Include\X64\ -Ox -f win64 -g -o c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuId.obj c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuId.iii
    Exit.c
    Echo.c
    Comp.c
    Trim --asm-file -o c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\X64\CpuIdEx.i -i c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib\OUTPUT\inc.lst c:\uefiproject\edk2\MdePkg\Library\BaseLib\X64\CpuIdEx.nasm
    GenFfs: ERROR 1000: Unknown option
    -oi
    NMAKE : fatal error U1077: 'C:\uefiproject\Edk2\BaseTools\Bin\Win32\GenFfs.EXE' : return code '0x2'
    Stop.

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\OvmfPkg\ResetVector\ResetVector]

    build.py...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x86\nmake.exe /nologo tbuild [c:\uefiproject\edk2\Build\OvmfX64\DEBUG_VS2019\X64\MdePkg\Library\BaseLib\BaseLib]

    build.py...
    : error F002: Failed to build module
    c:\uefiproject\edk2\OvmfPkg\ResetVector\ResetVector.inf [X64, VS2019, DEBUG]

    - Failed -
    Build end time: 10:52:50, Mar.09 2022
    Build total time: 00:00:38

    请问一下您遇到过这样的问题吗?出现这样的问题的原因是什么呢?

    1. 报错是在 C:\uefiproject\Edk2\BaseTools\Bin\Win32\GenFfs.EXE 有无法识别的参数

      不知道你的BaseTools是哪里来的?看看能不能更新到最新?

  17. Architecture(s) = IA32
    Build target = DEBUG
    Toolchain = VS2015x86

    Active Platform = c:\edk2-vudk2018\Nt32Pkg\Nt32Pkg.dsc
    Flash Image Definition = c:\edk2-vudk2018\Nt32Pkg\Nt32Pkg.fdf

    Processing meta-data ................ done!
    Building ... c:\edk2-vudk2018\MdePkg\Library\PeiMemoryAllocationLib\PeiMemoryAllocationLib.inf [IA32]
    Building ... c:\edk2-vudk2018\MdePkg\Library\PeiServicesLib\PeiServicesLib.inf [IA32]
    Building ... c:\edk2-vudk2018\Nt32Pkg\Library\PeiNt32OemHookStatusCodeLib\PeiNt32OemHookStatusCodeLib.inf [IA32]
    系统找不到指定的路径。

    build...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0Vc\bin\nmake.exe /nologo tbuild [c:\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdePkg\Library\PeiMemoryAllocationLib\PeiMemoryAllocationLib]

    build...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0Vc\bin\nmake.exe /nologo tbuild [c:\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdePkg\Library\PeiServicesLib\PeiServicesLib]

    build...
    : error 7000: Failed to execute command
    C:\Program Files (x86)\Microsoft Visual Studio 14.0Vc\bin\nmake.exe /nologo tbuild [c:\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\Nt32Pkg\Library\PeiNt32OemHookStatusCodeLib\PeiNt32OemHookStatusCodeLib]

    build...
    : error F002: Failed to build module
    c:\edk2-vudk2018\MdePkg\Library\PeiMemoryAllocationLib\PeiMemoryAllocationLib.inf [IA32, VS2015x86, DEBUG]

    - Failed -
    Build end time: 10:31:24, Apr.14 2022
    Build total time: 00:00:17

    请问这个系统路径问题怎么解决

    1. C:\Program Files (x86)\Microsoft Visual Studio 14.0Vc\bin\nmake.exe 这个无法执行,有可能是 VC 安装的问题,另外,你要从 VC X86那个窗口打开然后去编译。

  18. "VfrCompile" -l -n --string-db e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdeModulePkg\Universal\Network\VlanConfigDxe\VlanConfigDxe\OUTPUT\VlanConfigDxeStrDefs.hpk --output-directory e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdeModulePkg\Universal\Network\VlanConfigDxe\VlanConfigDxe\DEBUG\. e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdeModulePkg\Universal\Network\VlanConfigDxe\VlanConfigDxe\OUTPUT\VlanConfig.i
    已复制 1 个文件。
    copy /y e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdeModulePkg\Universal\Network\ArpDxe\ArpDxe\DEBUG\ArpDxe.efi e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\ArpDxe.efi
    'VfrCompile' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    NMAKE : fatal error U1077: '"VfrCompile' : return code '0x1'
    Stop.

    build...
    : error 7000: Failed to execute command
    D:\VS2015\Vc\bin\nmake.exe /nologo tbuild [e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdeModulePkg\Universal\Network\VlanConfigDxe\VlanConfigDxe]
    已复制 1 个文件。

    build...
    : error 7000: Failed to execute command
    D:\VS2015\Vc\bin\nmake.exe /nologo tbuild [e:\uefiworkspace\edk2-vudk2018\Build\NT32IA32\DEBUG_VS2015x86\IA32\MdeModulePkg\Universal\Network\Ip4Dxe\Ip4Dxe]

    build...
    : error F002: Failed to build module
    e:\uefiworkspace\edk2-vudk2018\MdeModulePkg\Universal\Network\VlanConfigDxe\VlanConfigDxe.inf [IA32, VS2015x86, DEBUG]

    请问有遇到过这个问题吗,该如何解决

  19. 大佬,帮忙看看这是啥原因,感激不尽!!!
    MemTest86FreeX64.lib(uMemTest86.obj) : error LNK2001: 薹獠?abs
    Traceback (most recent call last):
    File "C:\python27\lib\logging\__init__.py", line 891, in emit
    stream.write(fs % msg.encode("UTF-8"))
    IOError: [Errno 0] Error
    Logged from file AutoGenWorker.py, line 91
    MemTest86FreeX64.lib(uMemTest86.obj) : error LNK2001: 薹獠?RunTest14ButterflyTest
    Traceback (most recent call last):
    File "C:\python27\lib\logging\__init__.py", line 891, in emit
    stream.write(fs % msg.encode("UTF-8"))
    IOError: [Errno 0] Error
    Logged from file AutoGenWorker.py, line 91
    YAMLLib.lib(reader.obj) : error LNK2001: 薹獠?memcmp
    Traceback (most recent call last):
    File "C:\python27\lib\logging\__init__.py", line 891, in emit
    stream.write(fs % msg.encode("UTF-8"))
    IOError: [Errno 0] Error
    Logged from file AutoGenWorker.py, line 91
    c:\edk2\Build\MemTest86\RELEASE_VS2015x86\X64\uMemTest86Pkg\uMemTest86\DEBUG\MemTest86FreeX64.dll : fatal error LNK1120: 3 薹獠?
    Traceback (most recent call last):
    File "C:\python27\lib\logging\__init__.py", line 891, in emit
    stream.write(fs % msg.encode("UTF-8"))
    IOError: [Errno 0] Error
    Logged from file AutoGenWorker.py, line 91
    NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe": 卮搿?x460
    Traceback (most recent call last):
    File "C:\python27\lib\logging\__init__.py", line 891, in emit
    stream.write(fs % msg.encode("UTF-8"))
    IOError: [Errno 0] Error
    Logged from file AutoGenWorker.py, line 91
    Stop.

发表评论

您的电子邮箱地址不会被公开。