kwea123 / kwea123/pytorch-cppcuda-tutorial
Windows安装报错:LINK : fatal error LNK1181: 无法打开输入文件“G:\code\Cpp\cppcuda\build\temp.win-amd64-cpython-38\Release\interpolation.obj”
Nobody has claimed this yet.
- Dominant language
- Cuda
- Stars
- 424
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
当我运行setup.py时,出现了下面的报错:
LINK : fatal error LNK1181: 无法打开输入文件“G:\code\Cpp\cppcuda\build\temp.win-amd64-cpython-38\Release\interpolation.obj”
error: command 'F:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe' failed with exit code 1181
请问有人遇到和我一样的错误吗
下边是我的代码
interpolation.cpp :
#include <torch/extension.h>
// 定义函数
torch::Tensor trilinear_interpolation(
torch::Tensor feats,
torch::Tensor point
){
return feats;
}
// 提供python调用C++的桥梁
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
// 第一个参数,python调用使用的名称,第二个参数,调用哪个方法。
m.def("trilinear_interpolation", &trilinear_interpolation);
}
setup.py:
from setuptools import setup
from torch.utils.cpp_extension import CppExtension, BuildExtension
setup(
# python中import的名称
name="cppcuda_tutorial",
version="1.0",
description="cppcuda example",
long_description="cppcuda example",
# 程序代码位置
ext_modules=[
CppExtension(
name="cppcuda_tutorial",
sources=["interpolation.cpp"]
)
],
cmdclass={
'build_ext': BuildExtension
}
)
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"D:/miniconda3/envs/cppcuda/include",
"D:/miniconda3/envs/cppcuda/Lib/site-packages/torch/include",
"D:/miniconda3/envs/cppcuda/Lib/site-packages/torch/include/torch/csrc/api/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with setup.py and interpolation.cpp, then inspect the setup.py build output around the missing interpolation.obj file and the MSVC linker command. Reproduce the Windows build and determine why the object file is not produced; done means setup.py completes without the LNK1181 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python, pytorch
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100