【bug】diff-gaussian-rasterization Windows下编译 bug 解决

问题1 vcvarsall.bat" x86_amd64 && set

具体问题

\x00 \x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00*\x00\r\x00\n\x00'

error: Error executing cmd /u /c "F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 && set

原因

这个是跨平台编译(32位→64位),大概率会失败,因为你已经在 64 位开发者 PowerShell 里了。

PyTorch 的 cpp_extension 依然会默认调用 x86_amd64,所以必须强制改成 x64 才行。

解决方式

设置环境变量

bash 复制代码
$env:PLATFORM="x64"
$env:DISTUTILS_USE_SDK="1"

问题2 "crtdefs.h": No such file or directory

具体问题

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include\crt/host_config.h(231): fatal error C1083: 无法打开包括文件: "crtdefs.h": No such file or directory

error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc' failed with exit code 2

原因

1、Windows SDK 或 MSVC 头文件没装全 或者路径不对

2、CUDA 用的 nvcc 指向了错误的编译器

解决方法

cuda我是有安装的,系统路径也是有的。

vs 2022也有安装,路径也有,但还是要增加以下环境变量,增加后可以解决

bash 复制代码
$env:INCLUDE="$env:INCLUDE;F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include"

问题3 crtdefs.h(10): fatal error C1083: 无法打开包括文件: "corecrt.h": No such file or directory

具体问题

F:/Program Files (x86)/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/include\crtdefs.h(10): fatal error C1083: 无法打开包括文件: "corecrt.h": No such file or directory

error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc' failed with exit code 2

原因

你现在这个错误说明我们虽然把 crtdefs.h 找到了,但它自己还依赖 corecrt.h,而这个文件是在 Windows SDK 里,不在 MSVC 目录下。

解决

一开始忽略了Windows SDK这个东西,竟然是有用的,增加以下环境变量

$winSDK = "F:\Windows Kits\10\Include\10.0.22000.0"

bash 复制代码
$env:INCLUDE="$env:INCLUDE;$winSDK\ucrt;$winSDK\shared;$winSDK\um"

原因

LINK : fatal error LNK1104: 无法打开文件"msvcprt.lib" 表示链接器找不到 MSVC的标准C++运行库静态库文件,这是链接阶段必需的库。

解决

bash 复制代码
$msvcLib = "F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64"
$env:LIB="$env:LIB;$msvcLib"

原因

LINK : fatal error LNK1104: 无法打开文件"uuid.lib" 表示链接器找不到 Windows SDK 的 uuid.lib,这是一个系统库,通常在 Windows SDK 的 Lib 目录下。

解决

bash 复制代码
$winSdkLib = "F:\Windows Kits\10\Lib\10.0.22000.0"
$env:LIB="$env:LIB;$winSdkLib\um\x64;$winSdkLib\ucrt\x64"

具体问题

正在创建库 build\temp.win-amd64-cpython-38\Release\cuda_rasterizer_C.cp38-win_amd64.lib 和对象 build\temp.win-amd64-cpython-38\Release\cuda_rasterizer_C.cp38-win_amd64.exp

正在生成代码

已完成代码的生成

LINK : fatal error LNK1158: 无法运行"rc.exe"

error: command 'F:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64\link.exe' failed with exit code 1158

原因

LINK : fatal error LNK1158: 无法运行"rc.exe" 错误表示链接器找不到 资源编译器 rc.exe,它是生成 Windows 资源文件(.res)的工具,位于 Windows SDK 目录里。

解决

bash 复制代码
$env:PATH="$env:PATH;F:\Windows Kits\10\bin\10.0.22000.0\x64"

成功了

相关推荐
康同学游戏坊1 小时前
独立游戏周报|装备和技能模块推进,一边测试一边修Bug
游戏·bug
Vex2une2 小时前
把 Windows 装进 U 盘随身携带:Windows To Go 现状与 WinToUSB 制作完全指南
windows·vhdx·windows to go·wintousb·便携windows·系统带进u盘·随身系统
zhoulcc1 天前
前端响应处理:AjaxResult与TableDataInfo的JSON结构区别及统一取值方案
前端·后端·bug·ajaxresult·tabledatainfo
无奈笑天下1 天前
Wine适配Windows程序常见故障标准处理流程
linux·运维·服务器·windows
广东程序猿小展1 天前
PotPlayer 播放 4K 视频卡顿怎么办(硬解与渲染设置)
windows·工具·软件
xx z2 天前
Radmin LAN 怎么联机(虚拟局域网建房与加入教程)
windows·工具·软件
广东程序猿小展2 天前
谷歌相机配置文件怎么导入(GCam 配置导入与不生效排查)
windows·工具·软件
李小白杂货铺3 天前
Windows 桌面 GUI 原型快速开发技术选型指南(Mac 开发 + Windows 交付场景)
windows·原型·gui·原型开发·技术选型·快速开发·技术路线
承渊政道3 天前
magic-resume简历工具教程:Windows部署、在线编辑与远程访问
windows·远程访问·在线编辑·简历制作·工具教程·magic-resume