Skip to content
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

CUDA build fails #2177

Closed
cwule opened this issue Jan 5, 2018 · 12 comments
Closed

CUDA build fails #2177

cwule opened this issue Jan 5, 2018 · 12 comments

Comments

@cwule
Copy link

cwule commented Jan 5, 2018

Build of pcl_cuda projects fails with

  • Win 10 Pro (Ver. 1709)
  • Visual Studio 2017 (15.5.2)
  • CUDA 9.1
  • cmake 3.9.6
  • PCL 1.8.1-dev

Error msg:

Building NVCC (Device) object cuda/features/CMakeFiles/pcl_cuda_features.dir/src/Debug/pcl_cuda_features_generated_normal_3d.cu.obj
CMake Error at pcl_cuda_features_generated_normal_3d.cu.obj.Debug.cmake:222 (message):
Error generating
 C:/Users/cwule/Documents/PCL/PCL_1.8.1_source/pcl/build/cuda/features/CMakeFiles/pcl_cuda_features.dir/src/Debug/pcl_cuda_features_generated_normal_3d.cu.obj

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1.

The rest of the projects builds fine.
A similar problem is described here, so I wonder whether it has to do with changes in cmake 3.9 with respect to cuda?

@UnaNancyOwen
Copy link
Member

Probably, I think it seems necessary to switch between cuda_add_executable()/cuda_add_library() and add_executable()/add_library() depending on CMake version.
https://devblogs.nvidia.com/parallelforall/building-cuda-applications-cmake/

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.8 OR (MSVC AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.9)))
    # use add_executable()/add_library()
else()
    # use cuda_add_executable()/cuda_add_library()
endif()

@cwule
Copy link
Author

cwule commented Jan 6, 2018

I tried replacing cuda_add_executable()/cuda_add_library() with add_executable()/add_library() in pcl_targets.cmake but now cmake complains with

CMake Error at cmake/pcl_targets.cmake:234 (add_library):
  Cannot find source file:

    OPTIONS

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
Call Stack (most recent call first):
  cuda/features/CMakeLists.txt:25 (PCL_CUDA_ADD_LIBRARY)

There might be a few more things to change, unfortunately I don't understand cmake good enough to know what to modify. Here they describe a bunch of changes to get tensorflow to build, how can this be adapted here?

@Robzz
Copy link
Contributor

Robzz commented Jan 11, 2018

Hi, I'm currently dealing issues of my own that I'm running into with CUDA 9 and stumbled upon this issue, I'm just popping by to say that switching between cuda_add_executable()/cuda_add_library() and add_executable()/add_library() is in my opinion not the problem here since:

  • the FindCUDA module has been kept in CMake 3.8+ for compatibility. It's actually still needed e.g. to locate the NPP libraries.
  • I managed to fix my issues and get PCL to build with CUDA 9 without doing so. (one thing to note though is that I'm using the ninja generator, not the visual studio one, and I'm using the VS2015 toolset included in VS2017)

The error message you posted is not helpful though. I'm not very familiar with building from VS, but if you can find a way to get a more verbose build output and post the underlying error, I'll take a look at it and integrate the fix in #2181 if I can find one.

@cwule
Copy link
Author

cwule commented Jan 12, 2018

Thanks for looking into that. The comment above was already the output from the diagnostic build. I have attached a bit more and attached the pcl_cuda_features.log file, from the first project that failed.

8>    Environment Variables passed to tool:
8>      VS_UNICODE_OUTPUT=1912
8>    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\cwule\Documents\PCL\pcl\buildcuda\bin\pcl_pcd_convert_NaN_nan_debug.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:/Program Files/PCL 1.8.1/3rdParty/Boost/lib" /LIBPATH:"C:/Program Files/PCL 1.8.1/3rdParty/Boost/lib/Debug" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_system-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_filesystem-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_thread-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_date_time-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_iostreams-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_chrono-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_atomic-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_regex-vc141-mt-gd-1_64.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/cwule/Documents/PCL/pcl/buildcuda/bin/pcl_pcd_convert_NaN_nan_debug.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/cwule/Documents/PCL/pcl/buildcuda/lib/pcl_pcd_convert_NaN_nan_debug.lib" /MACHINE:X64  /machine:x64 pcl_pcd_convert_NaN_nan.dir\Debug\pcd_convert_NaN_nan.obj
8>    Tracking command:
8>    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Tracker.exe /a /d "C:\Program Files (x86)\MSBuild\15.0\FileTracker\FileTracker32.dll" /i C:\Users\cwule\Documents\PCL\pcl\buildcuda\io\tools\pcl_pcd_convert_NaN_nan.dir\Debug\pcl_pcd_.A2A29264.tlog /r C:\USERS\CWULE\DOCUMENTS\PCL\PCL\BUILDCUDA\IO\TOOLS\PCL_PCD_CONVERT_NAN_NAN.DIR\DEBUG\PCD_CONVERT_NAN_NAN.OBJ /b MSBuildConsole_CancelEvente5a00724d8a043d398d7a9e51211c8fc  /c "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\link.exe"  /ERRORREPORT:PROMPT /OUT:"C:\Users\cwule\Documents\PCL\pcl\buildcuda\bin\pcl_pcd_convert_NaN_nan_debug.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:/Program Files/PCL 1.8.1/3rdParty/Boost/lib" /LIBPATH:"C:/Program Files/PCL 1.8.1/3rdParty/Boost/lib/Debug" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_system-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_filesystem-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_thread-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_date_time-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_iostreams-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_chrono-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_atomic-vc141-mt-gd-1_64.lib" "C:\Program Files\PCL 1.8.1\3rdParty\Boost\lib\libboost_regex-vc141-mt-gd-1_64.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/cwule/Documents/PCL/pcl/buildcuda/bin/pcl_pcd_convert_NaN_nan_debug.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/cwule/Documents/PCL/pcl/buildcuda/lib/pcl_pcd_convert_NaN_nan_debug.lib" /MACHINE:X64  /machine:x64 pcl_pcd_convert_NaN_nan.dir\Debug\pcd_convert_NaN_nan.obj
6>    CMake Error at pcl_cuda_features_generated_normal_3d.cu.obj.Debug.cmake:222 (message):
6>      Error generating
6>      C:/Users/cwule/Documents/PCL/pcl/buildcuda/cuda/features/CMakeFiles/pcl_cuda_features.dir/src/Debug/pcl_cuda_features_generated_normal_3d.cu.obj
6>
6>
7>    CMake Error at pcl_cuda_segmentation_generated_connected_components.cu.obj.Debug.cmake:222 (message):
6>    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1.
6>  Done executing task "CustomBuild" -- FAILED.
6>Done building target "CustomBuild" in project "pcl_cuda_features.vcxproj" -- FAILED.
6>
6>Done building project "pcl_cuda_features.vcxproj" -- FAILED.

Here again my setup:

  • Cmake 3.9.6
  • Visual Studio 2017 15.5.3
  • CUDA 9.1
  • Win64
  • PCL-dev

Let me know if you need any other information or log files.

pcl_cuda_features.log

@Robzz
Copy link
Contributor

Robzz commented Jan 12, 2018

That's good, but that looks like it's only Visual Studio/MSBuild logs, I don't see any output from NVCC here. There are the following lines in your first message:
Building NVCC (Device) object cuda/features/CMakeFiles/pcl_cuda_features.dir/src/Debug/pcl_cuda_features_generated_normal_3d.cu.obj CMake Error at pcl_cuda_features_generated_normal_3d.cu.obj.Debug.cmake:222 (message):
Which suggests you're encountering a CUDA compilation error. However, the actual error doesn't seem to be in the log you posted. Again, I'm not so familiar with VS so I'm unsure where you'd find the NVCC output but that would be the interesting piece of information here.

@SergioRAgostinho SergioRAgostinho added the needs: code review Specify why not closed/merged yet label Jan 13, 2018
@tudodetalhado
Copy link

tudodetalhado commented Jan 14, 2018

I tried to build PCL 1.8.1-Dev with Windows 10, VS 2017, CUDA 9.1 without success too.

In these forums I found that there are incompatibilities between VS17 x CUDA91:
https://stackoverflow.com/questions/47645436/cuda-9-unsupported-error-with-vs-2017
https://stackoverflow.com/questions/46120769/visual-studio-2017-and-cuda-9-rc-still-do-not-work-together

These orientations from the first forum worked to me:

  1. Make sure that you have VC++ 2015.3 v140 toolset (can be installed either from web or Visual Studio installer)
  2. In the project properties (general) -> Platform toolset choose Visual Studio 2015 (v140).

@cwule
Copy link
Author

cwule commented Jan 14, 2018

Hi, thanks a lot for the tip, tried that but also encountered some problems. Do you compile with cmake (if so which version) and any specific settings, eg. changing the path to CUDA_HOST_COMPILER? And what version of Visual Studio do you have (15.4, 15.5.?)?

@Robzz
Copy link
Contributor

Robzz commented Jan 15, 2018

OK that would explain why it works for me then, since I'm using the 2015 toolset.

@cwule The way to do that with CMake is to start a VS2017 command shell loading the VS2015 toolset (A command along the lines of C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat -vcvars_ver=14.0, or there might be a launcher in your start menu) and run CMake from that shell. You could also try updating your CMake installation to 3.10, as it includes a few bugfixes regarding CUDA 9.

@tudodetalhado
Copy link

I used vs 15.4 and CMake 3.10. I didn't change the CUDA_HOST_COMPILER.

@cwule
Copy link
Author

cwule commented Jan 17, 2018

I might have to install VS 15.4, tried all these tips (I have 15.5.3, a bit tricky to reverse to a previous version without reinstalling) and only the cuda builds keep failing. But from looking around, you are right, it seems to be a cuda and visual studio issue, not a pcl issue.

@taketwo taketwo removed the needs: code review Specify why not closed/merged yet label Jan 26, 2018
@taketwo
Copy link
Member

taketwo commented Jan 26, 2018

Please re-open if there is an evidence that the problem is on the PCL side.

@Zzj-pcl
Copy link

Zzj-pcl commented Jan 8, 2019

Incompatibilities between VS2017 x CUDA9.2

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

No branches or pull requests

7 participants