Xtra-Computing / thundersvm

ThunderSVM: A Fast SVM Library on GPUs and CPUs
Apache License 2.0
1.56k stars 216 forks source link

Build error in CUDA 9.1 and Visual C++ 2017 #45

Open mjmg opened 6 years ago

mjmg commented 6 years ago

I get the following errors when building Microsoft Visual Studio Solution

Severity    Code    Description Project File    Line    Suppression State
Error   MSB6006 "cmd.exe" exited with code 1.   thundersvm  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets  171 
Severity    Code    Description Project File    Line    Suppression State
Error   MSB6006 "cmd.exe" exited with code 1.   thundersvm-predict  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets  171 
Severity    Code    Description Project File    Line    Suppression State
Error   MSB6006 "cmd.exe" exited with code 1.   thundersvm-train    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets  171 

Build system is Windows 10 Home 1709, MS Visual Studio 2017 Community, CUDA 9.1 Development Environment. CMAKE is bundled from Visual Studio install:

cmake --version
cmake version 3.9.2-MSVC_2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

CMAKE was invoked as:

> cd thundersvm\build
> cmake -G "Visual Studio 15 2017 Win64" ..
-- The C compiler identification is MSVC 19.12.25835.0
-- The CXX compiler identification is MSVC 19.12.25835.0
......
-- Build files have been written to: C:/thundersvm/build

Complete build message as follows:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking Build System
1>CMake does not need to re-run because C:/thundersvm/build/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/thundersvm/build/src/thundersvm/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/thundersvm/build/src/test/CMakeFiles/generate.stamp is up-to-date.
.......
5>
5>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.
5>Done building project "thundersvm-train.vcxproj" -- FAILED.
2>Your branch is up-to-date with 'origin/master'.
2>Already on 'master'
2>Performing update step for 'googletest'
2>Current branch master is up to date.
2>No patch step for 'googletest'
2>Performing configure step for 'googletest'
2>-- The C compiler identification is MSVC 19.12.25835.0
2>-- The CXX compiler identification is MSVC 19.12.25835.0
......
2>
2>Build succeeded.
2>    0 Warning(s)
2>    0 Error(s)
2>
2>Time Elapsed 00:00:11.22
2>No install step for 'googletest'
2>Completed 'googletest'
6>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
6>Building Custom Rule C:/thundersvm/CMakeLists.txt
6>CMake does not need to re-run because C:/thundersvm/build/CMakeFiles/generate.stamp is up-to-date.
========== Build: 3 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
zeyiwen commented 6 years ago

Thank you for reporting! We're inspecting the issue, and will get back to you as soon as possible.

QinbinLi commented 6 years ago

@mjmg There seem to be issues with CUDA 9.1 and Visual C++ 2017 Compiler. I got the same problem as yours. You can find related information on https://github.com/opencv/opencv/issues/9908 and https://github.com/ethereum-mining/ethminer/issues/37. There are two solutions:

  1. Use Visual Studio 2017 installer to install Visual Studio 2015 v140 toolset. Then build with cmake .. -G "Visual Studio 15 2017 Win64" -Tv140.

  2. Change the CUDA_HOST_COMPILER parameter manually to the path of cl.exe: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.exe. You can set the parameter on cmake-gui or add set(CUDA_HOST_COMPILER "your path to cl.exe") in your CMakeList.txt.

Both solutions are useful for me. Before try the solutions, remember to update the code to the latest version. If you have problems building all projects together on visual studio, try build each project separately. Thank you.