构建 skia 时出错:机器类型 x64 与 x86 冲突

Error build skia: machine type x64 conflicts with x86

我正在尝试按照此处的说明构建 Skia https://skia.org/docs/user/build/。我使用 Visual Studio 安装程序为 Windows 安装 C++ clang 工具,然后按如下方式配置 skia:

bin/gn gen out/Shared --args='clang_win="C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\Llvm" is_component_build=true is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_system_icu=false skia_use_system_harfbuzz=false target_cpu="x64"'

然后我 运行 ninja -C out/Shared 但是在构建过程中我得到以下错误:

FAILED: skia.dll skia.dll.lib skia.dll.pdb
"C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\Llvm/bin/lld-link.exe" /nologo /IMPLIB:./skia.dll.lib /DLL /OUT:./skia.dll /PDB:./skia.dll.pdb @./skia.dll.rsp
lld-link: error: libcmt.lib(std_type_info_static.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(chkstk.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(locale0.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(thread0.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(xthrow.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(delete_scalar_size.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(new_scalar.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(utility.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(xlock.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(locale.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(iosptrs.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(guard_support.obj): machine type x64 conflicts with x86
lld-link: error: libcpmt.lib(syserror.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(gshandler.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(gshandlereh4.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(amdsecgs.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(gs_cookie.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(delete_scalar.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(throw_bad_alloc.obj): machine type x64 conflicts with x86
lld-link: error: libcmt.lib(cpu_disp.obj): machine type x64 conflicts with x86
lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to see all errors)
ninja: build stopped: subcommand failed.

我是 运行 Windows 11 的 64 位版本。 有人知道问题出在哪里吗?

好的,事实证明出于某种原因(不确定是什么),Skia 使用 Visual Studio 安装程序安装的 LLVM 版本存在问题。我直接从他们官网下载了LLVM然后运行:

bin/gn gen out/Shared --args='clang_win="C:\Program Files\LLVM" is_component_build=true is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_system_icu=false skia_use_system_harfbuzz=false target_cpu="x64"'

运行 这个 Skia 构建没有任何错误。