enoki icon indicating copy to clipboard operation
enoki copied to clipboard

Enoki cannot build on VS2019 16.10

Open andyyankai opened this issue 3 years ago • 11 comments

16.9 works pretty good. Just to notify here if anyone have any ideas. It seems Visual studio recent update have trouble with cuda related building 0.0

andyyankai avatar Jun 24 '21 06:06 andyyankai

What is the compiler log?

Speierers avatar Jun 25 '21 09:06 Speierers

The output might be too much I will just leave the top, others are saved in the file below the input command are cmake --build . --config Release && copy /y lib\Release\*.pyd lib\ cmake -G "Visual Studio 16 2019" -A x64 ..

image log.txt

andyyankai avatar Jul 01 '21 06:07 andyyankai

Interesting, looks like nvcc doesn't like the new standard library headers. It works fine on my machine. What's your nvcc version?

Here is mine:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:32:27_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.2, V10.2.89

Speierers avatar Jul 05 '21 07:07 Speierers

I am currently using cuda11.0 and cuda 11.4 It seems new visual studio (16.10) have trouble building many cuda related thing

andyyankai avatar Jul 05 '21 21:07 andyyankai

It seems new visual studio (16.10) have trouble building many cuda related thing

Have you seen similar issues with the new version of MSVC on other projects online? Maybe this will be fixed in a future version of MSVC then?

Speierers avatar Jul 06 '21 05:07 Speierers

It seems new visual studio (16.10) have trouble building many cuda related thing

Have you seen similar issues with the new version of MSVC on other projects online? Maybe this will be fixed in a future version of MSVC then?

I do see some similar problems before. Haven't seen a solution so far. I think if this can't be fixed then just avoid updating 16.10 for now until some future solution appears. btw if I build enoki using 16.9 and link with my project which build using 16.10, it will also fail.

andyyankai avatar Jul 12 '21 20:07 andyyankai

Just find this problem appears also in the old visual studio and maybe not a bug? Here are some link that might be useful https://developercommunity.visualstudio.com/t/xutility-errors-compiling-asio-and-basic-source/631347 https://stackoverflow.com/questions/67732065/why-does-vs2019-pro-have-compile-errors-with-xutility-xmemory-and-atomic-when

andyyankai avatar Jul 12 '21 20:07 andyyankai

During the cmake building, I have this warning (not sure if this is important: image

andyyankai avatar Jul 13 '21 00:07 andyyankai

What's the spec of your machine?

Speierers avatar Jul 13 '21 04:07 Speierers

I solved my Windows build problems (also CUDA 11 and VS 16.10) by changing

if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
    if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
    else()
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
    endif()
endif()

to

if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
    if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
      #set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
      #set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
    else()
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
    endif()
endif()

in C:\Program Files\CMake\share\cmake-3.19\Modules\Compiler\NVIDIA-CUDA.cmake

Maybe that's helpful for you

hesom avatar Jul 21 '21 16:07 hesom

I solved my Windows build problems (also CUDA 11 and VS 16.10) by changing

if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
    if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
    else()
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
    endif()
endif()

to

if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
    if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
      #set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
      #set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
    else()
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
    endif()
endif()

in C:\Program Files\CMake\share\cmake-3.19\Modules\Compiler\NVIDIA-CUDA.cmake

Maybe that's helpful for you

Thanks! this indeed works!

andyyankai avatar Jul 25 '21 00:07 andyyankai

I solved my Windows build problems (also CUDA 11 and VS 16.10) by changing

if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
    if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
    else()
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
    endif()
endif()

to

if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
    if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
      #set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
      #set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
    else()
      set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
      set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
    endif()
endif()

in C:\Program Files\CMake\share\cmake-3.19\Modules\Compiler\NVIDIA-CUDA.cmake

Maybe that's helpful for you

That works for me!!!

winterwindwang avatar Sep 02 '22 07:09 winterwindwang