【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"

成功了

相关推荐
非凡ghost4 小时前
MediaHuman YouTube to MP3 多语便携版:高效音频提取工具
windows·音视频·软件需求
Su^!-苏释州5 小时前
Windows配置C/C++环境:MinGW+Vscode
c语言·c++·windows·vscode·大一新生学c语言
一点都不方女士6 小时前
.NET Framework 4.0.30319:官方下载与常见问题解决指南
c++·windows·.net·动态链接库·运行库
我的xiaodoujiao6 小时前
Windows系统Web UI自动化测试学习系列3--浏览器驱动下载使用
前端·windows·测试工具·ui
谷咕咕18 小时前
windows下python3,LLaMA-Factory部署以及微调大模型,ollama运行对话,开放api,java,springboot项目调用
java·windows·语言模型·llama
初圣魔门首席弟子1 天前
flag使用错误出现bug
c++·bug
kali-Myon1 天前
解决 win+R 运行处以及文件资源管理器处无法使用 wt、wsl 命令打开终端
windows·wsl·path·regedit·wt
yubo05091 天前
YOLO系列——实时屏幕检测
开发语言·windows·python
火车叼位1 天前
Clink实战指南:让Windows开发者拥有Bash级别的命令行体验
windows
私人珍藏库1 天前
[Windows] PDF 专业压缩工具 v3.6
windows·pdf