使用 MSVC 在 Windows 10 上编译 V8 引擎时出现编译错误

发布于 2025-01-17 02:28:11 字数 6364 浏览 0 评论 0原文

首先,我运行下一个命令:

python tools/dev/v8gen.py x64.release.sample

所有 GN 文件生成成功。之后我运行以下命令:

ninja -C out.gn/x64.release.sample v8_monolith

经过几分钟的编译,我收到很多编译错误:

[226/1842] LINK bytecode_builtins_list_generator.exe bytecode_builtins_list_generator.exe.pdb
FAILED: bytecode_builtins_list_generator.exe bytecode_builtins_list_generator.exe.pdb
..\..\third_party\llvm-build\Release+Asserts\bin\lld-link.exe /OUT:./bytecode_builtins_list_generator.exe /nologo -libpath:..\..\third_party\llvm-build\Release+Asserts\lib\clang\15.0.0\lib\windows "-libpath:../../../Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/ATLMFC/lib/x64" "-libpath:../../../Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/lib/x64" "-libpath:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "-libpath:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64" "-libpath:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\\um\x64" /MACHINE:X64  /PDB:./bytecode_builtins_list_generator.exe.pdb @./bytecode_builtins_list_generator.exe.rsp
lld-link: error: procedure symbol record for `_CxxThrowException` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\throw.obj refers to PDB item index 0x134F which is not a valid function ID record
lld-link: error: procedure symbol record for `_IsExceptionObjectToBeDestroyed` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehhelpers.obj refers to PDB item index 0x1193 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameUnwindFilter` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehhelpers.obj refers to PDB item index 0x118E which is not a valid function ID record
lld-link: error: procedure symbol record for `__std_terminate` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehhelpers.obj refers to PDB item index 0x1190 which is not a valid function ID record
lld-link: error: procedure symbol record for `_CallSETranslator<__FrameHandler3>` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F7 which is not a valid function ID record
lld-link: error: procedure symbol record for `_CallSETranslator<__FrameHandler4>` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F8 which is not a valid function ID record
lld-link: error: procedure symbol record for `FH4::DecompFuncInfo` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x1151 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::ExecutionInCatch` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12EC which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler4::ExecutionInCatch` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12DF which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler4::FrameUnwindToEmptyState` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12E2 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::GetEstablisherFrame` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F0 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::GetRangeOfTrysToCheck` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F6 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::UnwindNestedFrames` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F1 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler4::UnwindNestedFrames` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12E3 which is not a valid function ID record
lld-link: error: procedure symbol record for `_CreateFrameInfo` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12DD which is not a valid function ID record
lld-link: error: procedure symbol record for `_GetThrowImageBase` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12EB which is not a valid function ID record
lld-link: error: procedure symbol record for `_SetImageBase` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12DB which is not a valid function ID record
lld-link: error: procedure symbol record for `_SetThrowImageBase` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12FB which is not a valid function ID record
lld-link: error: procedure symbol record for `__vcrt_getptd` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\per_thread_data.obj refers to PDB item index 0x1270 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::GetCurrentState` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehstate.obj refers to PDB item index 0x12F2 which is not a valid function ID record
lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to see all errors)
[235/1842] CXX obj/torque_base/implementation-visitor.obj
ninja: build stopped: subcommand failed.

是什么导致了这个问题?怎么解决呢?

First of all, I run next command:

python tools/dev/v8gen.py x64.release.sample

All GN files generating successfuly. After that I run following command:

ninja -C out.gn/x64.release.sample v8_monolith

After several minutes of compilation, I receive a lot of compilation error:

[226/1842] LINK bytecode_builtins_list_generator.exe bytecode_builtins_list_generator.exe.pdb
FAILED: bytecode_builtins_list_generator.exe bytecode_builtins_list_generator.exe.pdb
..\..\third_party\llvm-build\Release+Asserts\bin\lld-link.exe /OUT:./bytecode_builtins_list_generator.exe /nologo -libpath:..\..\third_party\llvm-build\Release+Asserts\lib\clang\15.0.0\lib\windows "-libpath:../../../Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/ATLMFC/lib/x64" "-libpath:../../../Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/lib/x64" "-libpath:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "-libpath:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64" "-libpath:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\\um\x64" /MACHINE:X64  /PDB:./bytecode_builtins_list_generator.exe.pdb @./bytecode_builtins_list_generator.exe.rsp
lld-link: error: procedure symbol record for `_CxxThrowException` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\throw.obj refers to PDB item index 0x134F which is not a valid function ID record
lld-link: error: procedure symbol record for `_IsExceptionObjectToBeDestroyed` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehhelpers.obj refers to PDB item index 0x1193 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameUnwindFilter` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehhelpers.obj refers to PDB item index 0x118E which is not a valid function ID record
lld-link: error: procedure symbol record for `__std_terminate` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehhelpers.obj refers to PDB item index 0x1190 which is not a valid function ID record
lld-link: error: procedure symbol record for `_CallSETranslator<__FrameHandler3>` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F7 which is not a valid function ID record
lld-link: error: procedure symbol record for `_CallSETranslator<__FrameHandler4>` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F8 which is not a valid function ID record
lld-link: error: procedure symbol record for `FH4::DecompFuncInfo` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x1151 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::ExecutionInCatch` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12EC which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler4::ExecutionInCatch` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12DF which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler4::FrameUnwindToEmptyState` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12E2 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::GetEstablisherFrame` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F0 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::GetRangeOfTrysToCheck` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F6 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::UnwindNestedFrames` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12F1 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler4::UnwindNestedFrames` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12E3 which is not a valid function ID record
lld-link: error: procedure symbol record for `_CreateFrameInfo` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12DD which is not a valid function ID record
lld-link: error: procedure symbol record for `_GetThrowImageBase` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12EB which is not a valid function ID record
lld-link: error: procedure symbol record for `_SetImageBase` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12DB which is not a valid function ID record
lld-link: error: procedure symbol record for `_SetThrowImageBase` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\risctrnsctrl.obj refers to PDB item index 0x12FB which is not a valid function ID record
lld-link: error: procedure symbol record for `__vcrt_getptd` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\per_thread_data.obj refers to PDB item index 0x1270 which is not a valid function ID record
lld-link: error: procedure symbol record for `__FrameHandler3::GetCurrentState` in d:\a01\_work\43\s\Intermediate\vctools\libvcruntime.nativeproj_520857879\objr\amd64\ehstate.obj refers to PDB item index 0x12F2 which is not a valid function ID record
lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to see all errors)
[235/1842] CXX obj/torque_base/implementation-visitor.obj
ninja: build stopped: subcommand failed.

What could be causing this problem? How to solve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌面超妹 2025-01-24 02:28:11

我遇到了同样的问题,我是这样解决的:

  1. 下载 Visual Studio 2019 安装程序,然后安装 vs2019,注意不需要检查 Windows SDK 项,因为这不是重点,也不需要重新安装/添加新版本Windows SDK。并且,vs2019 可能与 vs2022 一起存在。
  2. 切换到 vs2019 编译环境: 打开一个新的 Windows 终端选项卡,然后执行命令:
> set vs2019_install=[path to your \Microsoft Visual Studio\2019\Community]
> set WINDOWSSDKDIR=[path to your \Windows Kits\10]
> set DEPOT_TOOLS_WIN_TOOLCHAIN=0
> gclient sync

  1. OK,您现在可以使用 vs2019 构建 v8:
> python tools\dev\gm.py x64.release

希望这会有所帮助。

I encountered the same problem, and I solved it like this:

  1. Download the visual studio 2019 installer, and install vs2019, notice that no need to check the Windows SDK item as it's not the point and no need to reinstall/add a new version of Windows SDK. And, vs2019 could exists along with vs2022.
  2. Switch to vs2019 compile environment: Open a new Windows Terminal tab, and execute command:
> set vs2019_install=[path to your \Microsoft Visual Studio\2019\Community]
> set WINDOWSSDKDIR=[path to your \Windows Kits\10]
> set DEPOT_TOOLS_WIN_TOOLCHAIN=0
> gclient sync

  1. OK, you could build v8 with vs2019 now:
> python tools\dev\gm.py x64.release

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文