question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows build failed

See original GitHub issue
  • OS: Microsoft Windows 7 Professional
  • CMake version: version 3.17.1
  • Python version: 3.7 (64-bit runtime)
  • Is CUDA available: N/A
  • [pip3] numpy==1.18.5
  • [pip3] torch==1.7.1+cpu
  • [pip3] torchaudio==0.7.2
  • [pip3] torchvision==0.8.2+cpu

I am trying to build torch vision 0.8.2 from source using CMake but build fails.

I used the command: cmake -DCMAKE_PREFIX_PATH="E:/Dev/ext/libs/libtorch-win-shared-with-deps-debug-1.7.1+cpu/libtorch; -DCMAKE_INSTALL_PREFIX="E:/Dev/ext/libs/pytorch_vision/install" -DCMAKE_BUILD_TYPE=Release --DWITH_CUDA=OFF ...

but then running cmake --build . the output is:

1>deform_conv2d.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\deform_conv2d.cpp(86,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\deform_conv2d.cpp(86,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\deform_conv2d.cpp(86,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\deform_conv2d.cpp(86,40): error C2448: ‘vision::ops::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>nms.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\nms.cpp(18,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\nms.cpp(18,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\nms.cpp(18,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\nms.cpp(18,40): error C2448: ‘vision::ops::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>ps_roi_align.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_align.cpp(56,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_align.cpp(56,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_align.cpp(56,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_align.cpp(56,40): error C2448: ‘vision::ops::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>ps_roi_pool.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_pool.cpp(52,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_pool.cpp(52,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_pool.cpp(52,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\ps_roi_pool.cpp(52,40): error C2448: ‘vision::ops::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>roi_align.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_align.cpp(66,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_align.cpp(66,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_align.cpp(66,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_align.cpp(66,40): error C2448: ‘vision::ops::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>roi_pool.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_pool.cpp(51,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_pool.cpp(51,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_pool.cpp(51,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\ops\roi_pool.cpp(51,40): error C2448: ‘vision::ops::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>vision.cpp 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\vision.cpp(31,24): error C2065: ‘torchvision’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\vision.cpp(31,37): error C2065: ‘m’: undeclared identifier 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\vision.cpp(31,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>E:\Dev\ext\libs\pytorch_vision\torchvision\csrc\vision.cpp(31,40): error C2448: ‘vision::TORCH_LIBRARY_FRAGMENT’: function-style initializer appears to be a function definition 1>Generating Code… 1>Done building project “torchvision.vcxproj” – FAILED. 2>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------ 2>Building Custom Rule E:/Dev/ext/libs/pytorch_vision/CMakeLists.txt

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dc986commented, Feb 4, 2021

@datumbox No, I am using libtorch1.7.1+cpu torchvision0.8.2

Installing libtorch nightly did not solve the problem either.

I had to modify the macro TORCH_LIBRARY_FRAGMENT with TORCH_LIBRARY_FRAGMENT_THIS_API_IS_FOR_PER_OP_REGISTRATION_ONLY in torchvision src files.

Not sure this is a good solution but the build finishes with no errors.

1reaction
datumboxcommented, Feb 1, 2021

@dc986 Building TorchVision from source should be done by running: python setup.py install

For details on how to compile from source check our contributing page. Just replace nightly with the latest stable version of PyTorch since you want to build v0.8.2.

Using cmake is something we plan to support on the future. See #2349

@zsef123 You should do the same as described above. The only difference is that you need to install the nightly PyTorch lib because the current master of TorchVision depends on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

build error on windows #3568 - google/mediapipe - GitHub
Describe the problem: When ran the follow command on windows, errors occured! I followed the official document. Can not find any solutions.
Read more >
Windows Insider build error! Can't use my pc! - Microsoft Q&A
Can't use my pc! My Laptop (windows 11) suddenly had a pop up that windows insider build ran into a problem and needs...
Read more >
Flutter Windows Application fails to compile - Stack Overflow
Your compiler needs upgrading. I've got 16.11.something; you've got 16.1.something. Run the Visual Studio Installer again to upgrade it. (For ...
Read more >
SlicerCustomAppTemplate Build failed - 3D Slicer Community
Slicer version I installed in my pc is 4.11 and the version I built (according to Windows — 3D Slicer documentation) is 4.13,...
Read more >
Obscure build failure on Windows after Bazel commit ...
Obscure build failure on Windows after Bazel commit f6c4e624dc89ee0600b418eeea7108b6ed5c9708 · Philipp Stephani · p.ste...@gmail.com.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found