LINK : fatal error LNK1181: 无法打开输入文件“advapi32.lib”解决方法

关键位置
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\vsdevcmd\core\winsdk.bat


E:\git\niiirce\test>cl hello.c /link advapi32.lib
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.44.35207.1 版
版权所有(C) Microsoft Corporation。保留所有权利。

hello.c
Microsoft (R) Incremental Linker Version 14.44.35207.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
advapi32.lib
hello.obj
LINK : fatal error LNK1181: 无法打开输入文件“advapi32.lib”

LINK : fatal error LNK1181: 无法打开输入文件“advapi32.lib”解决方法
解决了"C:\Program Files\Python312\Scripts\reg.py"这个和reg.exe冲突的问题
删除py文件

E:\git\niiirce\test>cl hello.c /link advapi32.lib
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.44.35215 版
版权所有(C) Microsoft Corporation。保留所有权利。

hello.c
Microsoft (R) Incremental Linker Version 14.44.35215.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
advapi32.lib
hello.obj

1>------ 已启动发布: 项目: GEPLCCORE, 配置: Release x64 ------
1>正在确定要还原的项目…
1>所有项目均是最新的,无法还原。
1>GEPLCCORE -> E:\git\niiirce\GEPLCCORE\GEPLCCORE\bin\x64\Release\net9.0-windows10.0.26100.0\win-x64\GEPLCCORE.dll
1>"C:\Users\cbwan\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.8\build\findvcvarsall.bat" x64
1>"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\link.exe" @"obj\x64\Release\net9.0-windows10.0.26100.0\win-x64\native\link.rsp"
1>GEPLCCORE -> E:\git\niiirce\GEPLCCORE\GEPLCCORE\bin\Release\net9.0\publish\win-x64\
========== 生成: 0 成功,0 失败,1 最新,0 已跳过 ==========
========== 生成 于 9:43 完成,耗时 13.203 秒 ==========
========== 发布: 1 个成功,0 个失败,0 个已跳过 ==========
========== 发布 于 9:43 完成,耗时 13.203 秒 ==========
(pytorch_env) PS E:\PyTorch_Build\pytorch> # 1. 将 Windows SDK 的路径添加到当前的 LIB 环境变量中 (pytorch_env) PS E:\PyTorch_Build\pytorch> # 这个路径是标准路径,通常不会变 (pytorch_env) PS E:\PyTorch_Build\pytorch> $env:LIB = "$env:LIB;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x64" (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> # 2. 验证路径是否添加成功 (pytorch_env) PS E:\PyTorch_Build\pytorch> echo $env:LIB ;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x64 (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> # 3. 重新尝试编译(继续从上次的地方开始) (pytorch_env) PS E:\PyTorch_Build\pytorch> cmake --build build --target install --config Release -j 4 [1/352] Building CXX object caffe2\CMakeFiles\cuda_reportM...r\__\aten\src\ATen\test\cuda_reportMemoryUsage_test.cpp.ob FAILED: [code=2] caffe2/CMakeFiles/cuda_reportMemoryUsage_test.dir/__/aten/src/ATen/test/cuda_reportMemoryUsage_test.cpp.obj C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DAT_PER_OPERATOR_HEADERS -DCPUINFO_SUPPORTED_PLATFORM=1 -DEXPORT_AOTI_FUNCTIONS -DFMT_HEADER_ONLY=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DNOMINMAX -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTORCH_CUDA_USE_NVTX3 -DUSE_EXTERNAL_MZCRC -DUSE_MIMALLOC -DWIN32_LEAN_AND_MEAN -DXNN_LOG_LEVEL=0 -D_CRT_SECURE_NO_DEPRECATE=1 -D_UCRT_LEGACY_INFINITY -IE:\PyTorch_Build\pytorch\build\aten\src -IE:\PyTorch_Build\pytorch\aten\src -IE:\PyTorch_Build\pytorch\build -IE:\PyTorch_Build\pytorch -IE:\PyTorch_Build\pytorch\nlohmann -IE:\PyTorch_Build\pytorch\moodycamel -IE:\PyTorch_Build\pytorch\third_party\mimalloc\include -IE:\PyTorch_Build\pytorch\build\caffe2\aten\src -IE:\PyTorch_Build\pytorch\aten\src\ATen\.. -IE:\PyTorch_Build\pytorch\third_party\miniz-3.0.2 -IE:\PyTorch_Build\pytorch\torch\csrc\api -IE:\PyTorch_Build\pytorch\torch\csrc\api\include -IE:\PyTorch_Build\pytorch\c10\.. -IE:\PyTorch_Build\pytorch\third_party\pthreadpool\include -IE:\PyTorch_Build\pytorch\third_party\cpuinfo\include -IE:\PyTorch_Build\pytorch\third_party\ittapi\include -IE:\PyTorch_Build\pytorch\third_party\FP16\include -IE:\PyTorch_Build\pytorch\third_party\fmt\include -IE:\PyTorch_Build\pytorch\build\third_party\ideep\mkl-dnn\include -IE:\PyTorch_Build\pytorch\third_party\ideep\mkl-dnn\src\..\include -IE:\PyTorch_Build\pytorch\third_party\onnx -IE:\PyTorch_Build\pytorch\build\third_party\onnx -IE:\PyTorch_Build\pytorch\third_party\flatbuffers\include -IE:\PyTorch_Build\pytorch\c10\cuda\..\.. -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googlemock\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\protobuf\src -external:IE:\PyTorch_Build\pytorch\third_party\XNNPACK\include -external:IE:\PyTorch_Build\pytorch\torch\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\eigen -external:IE:\PyTorch_Build\pytorch\third_party\ideep\include -external:IE:\PyTorch_Build\pytorch\INTERFACE -external:IE:\PyTorch_Build\pytorch\third_party\nlohmann\include -external:IE:\PyTorch_Build\pytorch\third_party\concurrentqueue -external:I"E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -external:IE:\PyTorch_Build\pytorch\third_party\NVTX\c\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /EHsc /Zc:__cplusplus /bigobj /FS /utf-8 -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273 -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /Zc:preprocessor /Zc:preprocessor /O2 /Ob2 /DNDEBUG /bigobj -DNDEBUG -std:c++17 -MD /permissive- /EHsc /bigobj -openmp:experimental /utf-8 /showIncludes /Focaffe2\CMakeFiles\cuda_reportMemoryUsage_test.dir\__\aten\src\ATen\test\cuda_reportMemoryUsage_test.cpp.obj /Fdcaffe2\CMakeFiles\cuda_reportMemoryUsage_test.dir\ /FS -c E:\PyTorch_Build\pytorch\aten\src\ATen\test\cuda_reportMemoryUsage_test.cpp E:\PyTorch_Build\pytorch\torch/headeronly/macros/Macros.h(3): fatal error C1083: 无法打开包括文件: “cassert”: No such file or directory [2/352] Building CXX object caffe2\CMakeFiles\cuda_allocat...\aten\src\ATen\test\cuda_allocatorTraceTracker_test.cpp.ob FAILED: [code=2] caffe2/CMakeFiles/cuda_allocatorTraceTracker_test.dir/__/aten/src/ATen/test/cuda_allocatorTraceTracker_test.cpp.obj C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DAT_PER_OPERATOR_HEADERS -DCPUINFO_SUPPORTED_PLATFORM=1 -DEXPORT_AOTI_FUNCTIONS -DFMT_HEADER_ONLY=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DNOMINMAX -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTORCH_CUDA_USE_NVTX3 -DUSE_EXTERNAL_MZCRC -DUSE_MIMALLOC -DWIN32_LEAN_AND_MEAN -DXNN_LOG_LEVEL=0 -D_CRT_SECURE_NO_DEPRECATE=1 -D_UCRT_LEGACY_INFINITY -IE:\PyTorch_Build\pytorch\build\aten\src -IE:\PyTorch_Build\pytorch\aten\src -IE:\PyTorch_Build\pytorch\build -IE:\PyTorch_Build\pytorch -IE:\PyTorch_Build\pytorch\nlohmann -IE:\PyTorch_Build\pytorch\moodycamel -IE:\PyTorch_Build\pytorch\third_party\mimalloc\include -IE:\PyTorch_Build\pytorch\build\caffe2\aten\src -IE:\PyTorch_Build\pytorch\aten\src\ATen\.. -IE:\PyTorch_Build\pytorch\third_party\miniz-3.0.2 -IE:\PyTorch_Build\pytorch\torch\csrc\api -IE:\PyTorch_Build\pytorch\torch\csrc\api\include -IE:\PyTorch_Build\pytorch\c10\.. -IE:\PyTorch_Build\pytorch\third_party\pthreadpool\include -IE:\PyTorch_Build\pytorch\third_party\cpuinfo\include -IE:\PyTorch_Build\pytorch\third_party\ittapi\include -IE:\PyTorch_Build\pytorch\third_party\FP16\include -IE:\PyTorch_Build\pytorch\third_party\fmt\include -IE:\PyTorch_Build\pytorch\build\third_party\ideep\mkl-dnn\include -IE:\PyTorch_Build\pytorch\third_party\ideep\mkl-dnn\src\..\include -IE:\PyTorch_Build\pytorch\third_party\onnx -IE:\PyTorch_Build\pytorch\build\third_party\onnx -IE:\PyTorch_Build\pytorch\third_party\flatbuffers\include -IE:\PyTorch_Build\pytorch\c10\cuda\..\.. -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googlemock\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\protobuf\src -external:IE:\PyTorch_Build\pytorch\third_party\XNNPACK\include -external:IE:\PyTorch_Build\pytorch\torch\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\eigen -external:IE:\PyTorch_Build\pytorch\third_party\ideep\include -external:IE:\PyTorch_Build\pytorch\INTERFACE -external:IE:\PyTorch_Build\pytorch\third_party\nlohmann\include -external:IE:\PyTorch_Build\pytorch\third_party\concurrentqueue -external:I"E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -external:IE:\PyTorch_Build\pytorch\third_party\NVTX\c\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /EHsc /Zc:__cplusplus /bigobj /FS /utf-8 -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273 -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /Zc:preprocessor /Zc:preprocessor /O2 /Ob2 /DNDEBUG /bigobj -DNDEBUG -std:c++17 -MD /permissive- /EHsc /bigobj -openmp:experimental /utf-8 /showIncludes /Focaffe2\CMakeFiles\cuda_allocatorTraceTracker_test.dir\__\aten\src\ATen\test\cuda_allocatorTraceTracker_test.cpp.obj /Fdcaffe2\CMakeFiles\cuda_allocatorTraceTracker_test.dir\ /FS -c E:\PyTorch_Build\pytorch\aten\src\ATen\test\cuda_allocatorTraceTracker_test.cpp E:\PyTorch_Build\pytorch\c10/core/Allocator.h(3): fatal error C1083: 无法打开包括文件: “array”: No such file or directory [4/352] Linking CXX shared library bin\shm.dll FAILED: [code=4294967295] bin/shm.dll lib/shm.lib C:\WINDOWS\system32\cmd.exe /C "cd . && E:\PyTorch_Build\pytorch\pytorch_env\Lib\site-packages\cmake\data\bin\cmake.exe -E vs_link_dll --msvc-ver=1944 --intdir=caffe2\torch\lib\libshm_windows\CMakeFiles\shm.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe /nologo caffe2\torch\lib\libshm_windows\CMakeFiles\shm.dir\core.cpp.obj /out:bin\shm.dll /implib:lib\shm.lib /pdb:bin\shm.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO -LIBPATH:"E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64" lib\torch.lib lib\c10.lib /WHOLEARCHIVE:lib\torch_cuda.lib /WHOLEARCHIVE:lib\torch_cpu.lib lib\XNNPACK.lib lib\microkernels-prod.lib lib\pthreadpool.lib lib\libittnotify.lib "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64\libomp.lib" lib\kineto.lib "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\extras\CUPTI\lib64\cupti.lib" lib\dnnl.lib sleef\lib\sleef.lib /WHOLEARCHIVE:lib\onnx.lib lib\onnx_proto.lib lib\libprotobuf.lib /WHOLEARCHIVE:lib\Caffe2_perfkernels_avx2.lib -INCLUDE:?warp_size@cuda@at@@YAHXZ lib\c10_cuda.lib lib\c10.lib lib\cpuinfo.lib lib\mimalloc.lib psapi.lib shell32.lib user32.lib advapi32.lib bcrypt.lib "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\curand.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart_static.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cufft.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusolver.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusparse.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublas.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublasLt.lib" cudadevrt.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." LINK: command "C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe /nologo caffe2\torch\lib\libshm_windows\CMakeFiles\shm.dir\core.cpp.obj /out:bin\shm.dll /implib:lib\shm.lib /pdb:bin\shm.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO -LIBPATH:E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64 lib\torch.lib lib\c10.lib /WHOLEARCHIVE:lib\torch_cuda.lib /WHOLEARCHIVE:lib\torch_cpu.lib lib\XNNPACK.lib lib\microkernels-prod.lib lib\pthreadpool.lib lib\libittnotify.lib C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64\libomp.lib lib\kineto.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\extras\CUPTI\lib64\cupti.lib lib\dnnl.lib sleef\lib\sleef.lib /WHOLEARCHIVE:lib\onnx.lib lib\onnx_proto.lib lib\libprotobuf.lib /WHOLEARCHIVE:lib\Caffe2_perfkernels_avx2.lib -INCLUDE:?warp_size@cuda@at@@YAHXZ lib\c10_cuda.lib lib\c10.lib lib\cpuinfo.lib lib\mimalloc.lib psapi.lib shell32.lib user32.lib advapi32.lib bcrypt.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\curand.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart_static.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cufft.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusolver.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusparse.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublas.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublasLt.lib cudadevrt.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1104) with the following output: onnx.lib(helper.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(convert.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(implementation.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(inliner.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(tensor_util.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(tensor_proto_util.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(shape_inference.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(schema.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(printer.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(parser.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(function.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(data_type_utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(attr_proto_util.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(status.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(path.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(model_helpers.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(ir_pb_converter.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(interned_strings.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(assertions.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(checker.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx_proto.lib(onnx_onnx_torch-ml.pb.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx_proto.lib(onnx-data_onnx_torch.pb.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) LINK : fatal error LNK1104: 无法打开文件“msvcprt.lib” ninja: build stopped: subcommand failed. (pytorch_env) PS E:\PyTorch_Build\pytorch> # 搜索 psapi.lib 文件 (pytorch_env) PS E:\PyTorch_Build\pytorch> dir "C:\Program Files (x86)\Windows Kits\10\Lib\" -Recurse -Filter psapi.lib | Format-List FullName FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm\Psapi.Lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm64\Psapi.Lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\Psapi.Lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86\Psapi.Lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\arm\psapi.lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\arm64\psapi.lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64\psapi.lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x86\psapi.lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\arm64\psapi.lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x64\psapi.lib FullName : C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x86\psapi.lib (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> $env:LIB = "$env:LIB;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm\Psapi.Lib" (pytorch_env) PS E:\PyTorch_Build\pytorch> cmake --build build --target install --config Release -j 4 [1/352] Building CXX object caffe2\CMakeFiles\cuda_allocat...\aten\src\ATen\test\cuda_allocatorTraceTracker_test.cpp.ob FAILED: [code=2] caffe2/CMakeFiles/cuda_allocatorTraceTracker_test.dir/__/aten/src/ATen/test/cuda_allocatorTraceTracker_test.cpp.obj C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DAT_PER_OPERATOR_HEADERS -DCPUINFO_SUPPORTED_PLATFORM=1 -DEXPORT_AOTI_FUNCTIONS -DFMT_HEADER_ONLY=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DNOMINMAX -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTORCH_CUDA_USE_NVTX3 -DUSE_EXTERNAL_MZCRC -DUSE_MIMALLOC -DWIN32_LEAN_AND_MEAN -DXNN_LOG_LEVEL=0 -D_CRT_SECURE_NO_DEPRECATE=1 -D_UCRT_LEGACY_INFINITY -IE:\PyTorch_Build\pytorch\build\aten\src -IE:\PyTorch_Build\pytorch\aten\src -IE:\PyTorch_Build\pytorch\build -IE:\PyTorch_Build\pytorch -IE:\PyTorch_Build\pytorch\nlohmann -IE:\PyTorch_Build\pytorch\moodycamel -IE:\PyTorch_Build\pytorch\third_party\mimalloc\include -IE:\PyTorch_Build\pytorch\build\caffe2\aten\src -IE:\PyTorch_Build\pytorch\aten\src\ATen\.. -IE:\PyTorch_Build\pytorch\third_party\miniz-3.0.2 -IE:\PyTorch_Build\pytorch\torch\csrc\api -IE:\PyTorch_Build\pytorch\torch\csrc\api\include -IE:\PyTorch_Build\pytorch\c10\.. -IE:\PyTorch_Build\pytorch\third_party\pthreadpool\include -IE:\PyTorch_Build\pytorch\third_party\cpuinfo\include -IE:\PyTorch_Build\pytorch\third_party\ittapi\include -IE:\PyTorch_Build\pytorch\third_party\FP16\include -IE:\PyTorch_Build\pytorch\third_party\fmt\include -IE:\PyTorch_Build\pytorch\build\third_party\ideep\mkl-dnn\include -IE:\PyTorch_Build\pytorch\third_party\ideep\mkl-dnn\src\..\include -IE:\PyTorch_Build\pytorch\third_party\onnx -IE:\PyTorch_Build\pytorch\build\third_party\onnx -IE:\PyTorch_Build\pytorch\third_party\flatbuffers\include -IE:\PyTorch_Build\pytorch\c10\cuda\..\.. -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googlemock\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\protobuf\src -external:IE:\PyTorch_Build\pytorch\third_party\XNNPACK\include -external:IE:\PyTorch_Build\pytorch\torch\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\eigen -external:IE:\PyTorch_Build\pytorch\third_party\ideep\include -external:IE:\PyTorch_Build\pytorch\INTERFACE -external:IE:\PyTorch_Build\pytorch\third_party\nlohmann\include -external:IE:\PyTorch_Build\pytorch\third_party\concurrentqueue -external:I"E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -external:IE:\PyTorch_Build\pytorch\third_party\NVTX\c\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /EHsc /Zc:__cplusplus /bigobj /FS /utf-8 -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273 -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /Zc:preprocessor /Zc:preprocessor /O2 /Ob2 /DNDEBUG /bigobj -DNDEBUG -std:c++17 -MD /permissive- /EHsc /bigobj -openmp:experimental /utf-8 /showIncludes /Focaffe2\CMakeFiles\cuda_allocatorTraceTracker_test.dir\__\aten\src\ATen\test\cuda_allocatorTraceTracker_test.cpp.obj /Fdcaffe2\CMakeFiles\cuda_allocatorTraceTracker_test.dir\ /FS -c E:\PyTorch_Build\pytorch\aten\src\ATen\test\cuda_allocatorTraceTracker_test.cpp E:\PyTorch_Build\pytorch\c10/core/Allocator.h(3): fatal error C1083: 无法打开包括文件: “array”: No such file or directory [2/352] Building CXX object caffe2\CMakeFiles\cuda_reportM...r\__\aten\src\ATen\test\cuda_reportMemoryUsage_test.cpp.ob FAILED: [code=2] caffe2/CMakeFiles/cuda_reportMemoryUsage_test.dir/__/aten/src/ATen/test/cuda_reportMemoryUsage_test.cpp.obj C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DAT_PER_OPERATOR_HEADERS -DCPUINFO_SUPPORTED_PLATFORM=1 -DEXPORT_AOTI_FUNCTIONS -DFMT_HEADER_ONLY=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DNOMINMAX -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTORCH_CUDA_USE_NVTX3 -DUSE_EXTERNAL_MZCRC -DUSE_MIMALLOC -DWIN32_LEAN_AND_MEAN -DXNN_LOG_LEVEL=0 -D_CRT_SECURE_NO_DEPRECATE=1 -D_UCRT_LEGACY_INFINITY -IE:\PyTorch_Build\pytorch\build\aten\src -IE:\PyTorch_Build\pytorch\aten\src -IE:\PyTorch_Build\pytorch\build -IE:\PyTorch_Build\pytorch -IE:\PyTorch_Build\pytorch\nlohmann -IE:\PyTorch_Build\pytorch\moodycamel -IE:\PyTorch_Build\pytorch\third_party\mimalloc\include -IE:\PyTorch_Build\pytorch\build\caffe2\aten\src -IE:\PyTorch_Build\pytorch\aten\src\ATen\.. -IE:\PyTorch_Build\pytorch\third_party\miniz-3.0.2 -IE:\PyTorch_Build\pytorch\torch\csrc\api -IE:\PyTorch_Build\pytorch\torch\csrc\api\include -IE:\PyTorch_Build\pytorch\c10\.. -IE:\PyTorch_Build\pytorch\third_party\pthreadpool\include -IE:\PyTorch_Build\pytorch\third_party\cpuinfo\include -IE:\PyTorch_Build\pytorch\third_party\ittapi\include -IE:\PyTorch_Build\pytorch\third_party\FP16\include -IE:\PyTorch_Build\pytorch\third_party\fmt\include -IE:\PyTorch_Build\pytorch\build\third_party\ideep\mkl-dnn\include -IE:\PyTorch_Build\pytorch\third_party\ideep\mkl-dnn\src\..\include -IE:\PyTorch_Build\pytorch\third_party\onnx -IE:\PyTorch_Build\pytorch\build\third_party\onnx -IE:\PyTorch_Build\pytorch\third_party\flatbuffers\include -IE:\PyTorch_Build\pytorch\c10\cuda\..\.. -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googlemock\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\protobuf\src -external:IE:\PyTorch_Build\pytorch\third_party\XNNPACK\include -external:IE:\PyTorch_Build\pytorch\torch\include -external:IE:\PyTorch_Build\pytorch\cmake\..\third_party\eigen -external:IE:\PyTorch_Build\pytorch\third_party\ideep\include -external:IE:\PyTorch_Build\pytorch\INTERFACE -external:IE:\PyTorch_Build\pytorch\third_party\nlohmann\include -external:IE:\PyTorch_Build\pytorch\third_party\concurrentqueue -external:I"E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -external:IE:\PyTorch_Build\pytorch\third_party\NVTX\c\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest\include -external:IE:\PyTorch_Build\pytorch\third_party\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /EHsc /Zc:__cplusplus /bigobj /FS /utf-8 -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273 -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /Zc:preprocessor /Zc:preprocessor /O2 /Ob2 /DNDEBUG /bigobj -DNDEBUG -std:c++17 -MD /permissive- /EHsc /bigobj -openmp:experimental /utf-8 /showIncludes /Focaffe2\CMakeFiles\cuda_reportMemoryUsage_test.dir\__\aten\src\ATen\test\cuda_reportMemoryUsage_test.cpp.obj /Fdcaffe2\CMakeFiles\cuda_reportMemoryUsage_test.dir\ /FS -c E:\PyTorch_Build\pytorch\aten\src\ATen\test\cuda_reportMemoryUsage_test.cpp E:\PyTorch_Build\pytorch\torch/headeronly/macros/Macros.h(3): fatal error C1083: 无法打开包括文件: “cassert”: No such file or directory [4/352] Linking CXX shared library bin\shm.dll FAILED: [code=4294967295] bin/shm.dll lib/shm.lib C:\WINDOWS\system32\cmd.exe /C "cd . && E:\PyTorch_Build\pytorch\pytorch_env\Lib\site-packages\cmake\data\bin\cmake.exe -E vs_link_dll --msvc-ver=1944 --intdir=caffe2\torch\lib\libshm_windows\CMakeFiles\shm.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100261~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe /nologo caffe2\torch\lib\libshm_windows\CMakeFiles\shm.dir\core.cpp.obj /out:bin\shm.dll /implib:lib\shm.lib /pdb:bin\shm.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO -LIBPATH:"E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64" lib\torch.lib lib\c10.lib /WHOLEARCHIVE:lib\torch_cuda.lib /WHOLEARCHIVE:lib\torch_cpu.lib lib\XNNPACK.lib lib\microkernels-prod.lib lib\pthreadpool.lib lib\libittnotify.lib "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64\libomp.lib" lib\kineto.lib "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\extras\CUPTI\lib64\cupti.lib" lib\dnnl.lib sleef\lib\sleef.lib /WHOLEARCHIVE:lib\onnx.lib lib\onnx_proto.lib lib\libprotobuf.lib /WHOLEARCHIVE:lib\Caffe2_perfkernels_avx2.lib -INCLUDE:?warp_size@cuda@at@@YAHXZ lib\c10_cuda.lib lib\c10.lib lib\cpuinfo.lib lib\mimalloc.lib psapi.lib shell32.lib user32.lib advapi32.lib bcrypt.lib "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\curand.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart_static.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cufft.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusolver.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusparse.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublas.lib" "E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublasLt.lib" cudadevrt.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." LINK: command "C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe /nologo caffe2\torch\lib\libshm_windows\CMakeFiles\shm.dir\core.cpp.obj /out:bin\shm.dll /implib:lib\shm.lib /pdb:bin\shm.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO -LIBPATH:E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64 lib\torch.lib lib\c10.lib /WHOLEARCHIVE:lib\torch_cuda.lib /WHOLEARCHIVE:lib\torch_cpu.lib lib\XNNPACK.lib lib\microkernels-prod.lib lib\pthreadpool.lib lib\libittnotify.lib C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64\libomp.lib lib\kineto.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\extras\CUPTI\lib64\cupti.lib lib\dnnl.lib sleef\lib\sleef.lib /WHOLEARCHIVE:lib\onnx.lib lib\onnx_proto.lib lib\libprotobuf.lib /WHOLEARCHIVE:lib\Caffe2_perfkernels_avx2.lib -INCLUDE:?warp_size@cuda@at@@YAHXZ lib\c10_cuda.lib lib\c10.lib lib\cpuinfo.lib lib\mimalloc.lib psapi.lib shell32.lib user32.lib advapi32.lib bcrypt.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\curand.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cudart_static.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cufft.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusolver.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cusparse.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublas.lib E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\lib\x64\cublasLt.lib cudadevrt.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1104) with the following output: onnx.lib(helper.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(convert.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(implementation.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(inliner.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(tensor_util.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(tensor_proto_util.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(shape_inference.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(schema.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(printer.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(parser.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(function.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(data_type_utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(utils.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(old.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(defs.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(attr_proto_util.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(status.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(path.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(model_helpers.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(ir_pb_converter.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(interned_strings.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(assertions.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx.lib(checker.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx_proto.lib(onnx_onnx_torch-ml.pb.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) onnx_proto.lib(onnx-data_onnx_torch.pb.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(core.cpp.obj 中) LINK : fatal error LNK1104: 无法打开文件“msvcprt.lib” ninja: build stopped: subcommand failed. (pytorch_env) PS E:\PyTorch_Build\pytorch>
最新发布
09-01
<think>首先,用户的问题是:在Abaqus子程序编译时遇到错误“LINK : fatal error LNK1181: 无法打开输入文件‘user32.lib’”,希望找到解决方案。 回顾系统级指令: - 所有行内数学表达式使用$...$格式。 - 独立公式使用$$...$$格式并单独成段。 - LaTeX语法正确。 - 使用中文回答。 - 生成相关问题。 - 回答中引用的段落末尾自然地添加引用标识,如[^1]。 - 回答结构清晰,帮助用户逐步解决问题。 - 保证回答真实可靠。 参考站内引用: - [^1]:解决无法打开“msmpi.lib”的问题,通过卸载和安装MPI。 - [^2]:解决无法打开“vcruntime.lib”的问题,涉及关联VS2015和IVF2016。 - [^3]:修改win86_64.env文件添加libopenblas.lib。 - [^4]:解决模块计算机类型冲突的问题。 - [^5]:Abaqus安装和关联教程。 用户的问题是关于“user32.lib无法打开的错误。这是一个链接错误,表明编译器在链接阶段找不到user32.lib文件。user32.lib是Windows系统的一部分,通常与用户界面功能相关。在Abaqus子程序编译中,这可能是因为Visual Studio的路径没有正确设置。 从引用中提取相关信息: - [^2]提到链接错误LNK1181,类似问题,但针对vcruntime.lib,建议检查关联。 - [^3]提到修改env文件,这涉及环境变量设置。 - [^4]是关于计算机类型冲突,但不直接相关。 - [^5]是关于安装和关联。 常见解决方案: 1. **检查Visual Studio安装**:确保VS正确安装,并且路径包含在系统环境变量中。user32.lib通常在VS目录下。 2. **验证Abaqus关联**:确保Abaqus与Visual Studio和Fortran编译器正确关联。 3. **环境变量设置**:可能需要手动添加路径。 4. **检查系统架构**:确保所有组件(Abaqus、VS、Fortran)都是相同架构(32位或64位),避免冲突。 结构化回答: - 逐步指导用户解决问题。 - 使用中文。 - 在末尾生成相关问题。 - 引用相关引用自然地。 步骤: 1. **确认错误原因**:解释错误LNK1181是由于链接器找不到user32.lib文件。 2. **检查Visual Studio安装**:建议用户验证VS安装是否完整,特别是Windows SDK部分。 3. **设置环境变量**:指导如何添加路径到系统环境变量或Abaqus的env文件。 4. **验证关联**:检查Abaqus与编译器的关联。 5. **其他潜在问题**:如系统架构不匹配。 生成相关问题: 1. 如何正确安装和配置Visual Studio for Abaqus子程序开发? 2. Abaqus子程序编译常见错误有哪些? 3. 如何调试Abaqus子程序链接错误? 引用使用: - 参考[^2]和[^3],因为它们涉及类似链接错误和环境设置。 最终回答结构: - 介绍问题。 - 逐步解决方案。 - 生成相关问题。</think>### 解决Abaqus子程序报错“LINK : fatal error LNK1181: 无法打开输入文件‘user32.lib’”的步骤 用户在使用Abaqus子程序编译时遇到链接错误“LINK : fatal error LNK1181: 无法打开输入文件‘user32.lib’”,这表明编译器在链接阶段无法找到Windows系统文件`user32.lib`(该通常用于用户界面相关功能)。此错误通常由Visual Studio(VS路径未正确配置、Abaqus关联问题或环境变量缺失引起。以下基于常见解决方案和参考引用[^2][^3],提供逐步解决方法。请确保操作前备份相关文件。 #### 步骤1: 验证Visual Studio安装和路径 `user32.lib`是Windows SDK的一部分,需要确认VS安装完整且路径正确。 - **检查VS安装**: - 打开Visual Studio Installer,确保已安装“Desktop development with C++”工作负载(包含Windows SDK)。 - 确认SDK版本:在VS中,通过“工具” > “获取工具和功能”查看是否安装了与Abaqus兼容的SDK(如Abaqus 2022推荐Windows 10 SDK)。 - **定位`user32.lib`文件**: - 默认路径为`C:\Program Files (x86)\Windows Kits\10\Lib\<SDK版本>\um\<架构>\user32.lib`(`<架构>`为`x64`或`x86`)。 - 如果文件缺失,重新运行VS Installer修复安装。 #### 步骤2: 设置环境变量或修改Abaqus配置文件 编译器需要知道文件路径。参考引用[^3]中修改env文件的思路,添加路径到系统或Abaqus环境。 - **方法A: 添加系统环境变量**(推荐): 1. 打开“系统属性” > “高级” > “环境变量”。 2. 在“系统变量”中,编辑`LIB`变量(若无则新建): - 添加路径:`C:\Program Files (x86)\Windows Kits\10\Lib\<SDK版本>\um\<架构>`(替换`<SDK版本>`和`<架构>`为实际值,如`10.0.19041.0`和`x64`)。 - 示例:`LIB`变量值追加`;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64`。 3. 重启计算机使变更生效。 - **方法B: 修改Abaqus环境文件**: 1. 找到Abaqus的env文件(如`C:\SIMULIA\EstProducts\2022\win_b64\SMA\site\win86_64.env`)。 2.文件末尾添加路径(类似引用[^3]中处理`libopenblas.lib`的方式): ```bash link_sl += "user32.lib /LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64" ``` 3. 保存文件后重启Abaqus。 #### 步骤3: 检查Abaqus与编译器关联 确保Abaqus正确关联了VS和Fortran编译器。引用[^2][^5]表明关联错误会导致类似链接问题。 - 运行Abaqus验证命令:在命令行输入`abaqus verify -user_std`,检查输出是否显示关联成功。 - 重新关联(如需): 1. 卸载现有MPI(参考引用[^1]),通过控制面板移除所有MPI组件。 2. 使用Abaqus安装目录下的MPI(如`C:\SIMULIA\EstProducts\2022\win_b64\code\bin\mpi`),运行安装程序。 3. 运行关联脚本(如`abaqus cae -vs`选择VS版本)。 #### 步骤4: 确认系统架构一致性 避免32位/64位冲突(类似引用[^4])。 - 确保所有组件匹配:Abaqus版本(64位)、VS(64位开发设置)、Fortran编译器(如Intel IVF 64位)。 - 在VS中,检查项目属性: - “配置管理器”设置为`x64`。 - “链接器” > “高级” > “目标计算机”设为`MachineX64`。 #### 步骤5: 测试和验证 - 编译一个简单子程序(如空函数)测试: ```fortran SUBROUTINE DUM() END SUBROUTINE ``` - 如果错误未解决,检查Abaqus日志文件.log)确认路径是否生效。 - 常见备选方案:重新安装Windows SDK或更新VS至最新版本。 > **注意事项**: > - 此错误多由路径配置引起,非子程序代码问题[^2]。 > - 确保操作权限(以管理员身份运行VS和Abaqus)。 > - 如果使用自定义Fortran编译器,检查其兼容性(Abaqus官方支持Intel IVF)。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值