Skip to content

compilation error on windows #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kfpandayang opened this issue Mar 14, 2018 · 8 comments
Open

compilation error on windows #2

kfpandayang opened this issue Mar 14, 2018 · 8 comments

Comments

@kfpandayang
Copy link

kfpandayang commented Mar 14, 2018

for cpp extension, i got the following error:

lltm.obj : error LNK2001: 无法解析的外部符号 __imp_THPVariableClass
lltm.obj : error LNK2001: 无法解析的外部符号 "struct _object * __cdecl THPVariable_Wrap(struct torch::autograd::Variable)" (?THPVariable_Wrap@@YAPEAU_object@@UVariab
le@autograd@torch@@@z)

for cuda extension, i got the following error:

error: Don't know how to compile lltm_cuda_kernel.cu to build\temp.win-amd64-3.6\Release\lltm_cuda_kernel.obj

and i step into build_extension(), and found that warp_compile did not called

-------------update---------------------
issue information:

OS: windows 10 enterprise build 14393
PyTorch version: 0.4.0a0+59d1d17
How you installed PyTorch (conda, pip, source): source
Python version: anaconda 5.1 , python 3.6.4
CUDA/cuDNN version: 9.1.85/7.1
GPU models and configuration: GTX 1050Ti
GCC version (if compiling from source): visual studio 2017 toolset 14.11

additional information:

i modified the setup.py in cpp directory as follows:

setup(
name='lltm_cpp',
ext_modules=[
CppExtension(name='lltm_cpp',
sources = ['lltm.cpp'],
library_dirs=[r'C:\ProgramData\Anaconda3\Lib\site-packages\torch\lib'],
libraries=['ATen', 'shm']),
],
cmdclass={
'build_ext': BuildExtension
})

@goldsborough
Copy link
Contributor

Hi, thanks for reporting this issue. This is not enough information to help me debug your issue. Please fill out this template here: https://github.com/pytorch/pytorch/blob/master/.github/ISSUE_TEMPLATE.md and update your description so that I can better understand how to fix your problem.

@kfpandayang
Copy link
Author

so this issue is solved?

@goldsborough
Copy link
Contributor

Sorry, I didn't see you had updated the issue. There was no response on my comment so I thought you had solved the issue.

@goldsborough goldsborough reopened this Mar 22, 2018
@goldsborough
Copy link
Contributor

I will have to investigate this. I recall running into various issues with setup.py on windows. I believe pybind11 actually requires a custom CMake setup on Windows (see here) -- setuptools may not work out of the box.

@kfpandayang
Copy link
Author

OK,thank you for your response, i will try pybind cmake first

@kfpandayang
Copy link
Author

I tried pybind cmake example, it works for me, but i don't know how to incorporate pybind cmake to the pytorch cpp extension build system, could you please help me?

@goldsborough
Copy link
Contributor

Can you share your CMakeLists.txt? But all you'll really need is:

Essentially everything that https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L213 does.

@kfpandayang
Copy link
Author

kfpandayang commented Mar 24, 2018

I use the following CMakeLists.txt

cmake_minimum_required(VERSION 2.8.12)
project(lltm)
add_subdirectory(pybind11)
include_directories("C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib\site-packages\torch\lib\include")
include_directories(ENV{CUDA_PATH_V9_1}\include)
link_directories("C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib\site-packages\torch\lib")
pybind11_add_module(lltm src/lltm.cpp)
target_link_libraries(lltm PRIVATE ATen)

howerver, I still got the lnk 2001 error:

lltm.obj : error LNK2001: unresolved external symbole __imp_THPVariableClass
lltm.obj : error LNK2001: unresolved external symbole "struct _object * __cdecl THPVariable_Wrap(struct torch::autograd::Variable)" (?THPVariable_Wrap@@YAPEAU_object@@uvariab
le@autograd@torch@@@z)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants