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
Build of osd_static_gpu failed (on Windows 10 using Visual Studio 2013 x64) #922
Comments
|
Filed as internal issue #142048. |
|
Which version of cmake are you using? I haven't been able to reproduce this on my Win7 machine with cmake 3.0.0 or 3.5.0 and VS 2013 |
|
I am using CMake 3.7.1. |
|
I tried with CMake 3.5.0 and there is no problem. So it must be an issue with CMake. |
|
I am packaging Opensubdiv 3.1.1 for Gentoo linux and have the same issue with CMake >= 3.7.0. What happens is that CMakeLists.txt sets a variable OPENSUBDIV_VERSION_STRING to "3.1.1" (i.e. the string contains the version number wrapped in double quotes). Code generated by CMake's Modules/FindCUDA.cmake transforms this into an improperly quoted semicolon separated list: This is then transformed into a command line to pass to nvcc to compile the osd static and dynamic gpu cuda kernels but the string has dangling quotes. The section shown above converts to: The code to convert the definitions such as OPENSUBDIV_VERSION_STRING into CUDA_NVCC_COMPILE_DEFINITIONS was introduced to Modules/FindCUDA.cmake (commit 6442709b) which was merged into Cmake 3.7.0. Prior versions of FindCUDA set the flags for nvcc differently and are able to compile opensubdiv on my system. CMake 3.6.3 works for me, but 3.7.2 fails. Ideally the FindCUDA.cmake code could be made more robust to handle definitions containing quotation marks. In any case removing the extra quotes from the OPENSUBDIV_VERSION_STRING (set it to 3.1.1 rather than "3.1.1") resolves the problem and allows opensubdiv to compile successfully with CMake 3.7.2. |
|
Ah, that makes sense. Nice debugging. We'll take a look... |
|
Hi there, thanks @redchillipadi for the trick it solved the string issue! [ 91%] Building CXX object examples/glImaging/CMakeFiles/glImaging.dir/glImaging.cpp.o The error spreads all over the samples with the same code-line. Any suggestion? |
|
As the code is in a cpp file we need to use token stringification to convert OPENSUBDIV_VERSION_STRING into a string. In each sample file define a macro In glImaging.cpp there is another line which needs to read |
Prior to this commit, what happens is that CMakeLists.txt sets a variable OPENSUBDIV_VERSION_STRING to "3.1.1" (i.e. the string contains the version number wrapped in double quotes). Code generated by CMake's Modules/FindCUDA.cmake transforms this into an improperly quoted semicolon separated list: set(CUDA_NVCC_COMPILE_DEFINITIONS "OPENSUBDIV_VERSION_STRING="3.1.1";OPENSUBDIV ... ") This is then transformed into a command line to pass to nvcc to compile the osd static and dynamic gpu cuda kernels but the string has dangling quotes. The section shown above converts to: -DOPENSUBDIV_VERSION_STRING -D3.1.1";-DOPENSUBDIV... The code to convert the definitions such as OPENSUBDIV_VERSION_STRING into CUDA_NVCC_COMPILE_DEFINITIONS was introduced to Modules/FindCUDA.cmake (commit 6442709b) which was merged into Cmake 3.7.0. Prior versions of FindCUDA set the flags for nvcc differently and are able to compile opensubdiv on my system. CMake 3.6.3 works for me, but 3.7.2 fails. Ideally the FindCUDA.cmake code could be made more robust to handle definitions containing quotation marks. In any case removing the extra quotes from the OPENSUBDIV_VERSION_STRING (set it to 3.1.1 rather than "3.1.1") resolves the problem and allows opensubdiv to compile successfully with CMake 3.7.2. This produces an additional issue that OPENSUBDIV_VERSION_STRING is no longer a string in the examples files where it is concatenated into the window title. The fix is creating a macro to stringify the token: #define STRINGIFY(a) #a Since it will be referenced by 10 example files I have created a new header file examples/common/stringify.h Then the example code is changed to use the stringify macro static const char windowTitle[] = "OpenSubdiv glPaintTest" STRINGIFY(OPENSUBDIV_VERSION_STRING); glImaging uses the macro in a second place, in the line ofs << "OpenSubdiv : " << STRINGIFY(OPENSUBDIV_VERSION_STRING) << "\n";
|
Thanks it works! |
|
The actual fix to this issue is attached at end of this post. There is no need for stringify or any of that. :) I'll create a PR in a bit so people can grab the patch easily, and hopefully upstream can merge it. |
Closes issue PixarAnimationStudios#922 Signed-off by: Jonathan Scruggs <j.scruggs@gmail.com>
|
@jtran56 Hope this PR works for you. I think I signed the CLA thing for a different PR in a different program? |
|
@dracwyrm Looks like we don't have a CLA from you yet in our records. If you could fill one out and email us as listed in the guidelines, then we can start to accept your pull requests. Thank you! https://github.com/PixarAnimationStudios/OpenSubdiv/blob/master/documentation/contributing.rst#contributor-license-agreement |
|
The underlying problem in FindCUDA.cmake has been fixed for the last several releases of CMake (tested back through CMake v3.9). We're going to close this as not-fixing based on our recent testing of OpenSubdiv releases across multiple platforms Windows, Linux, macOS, etc, including VS 2013/2015/2017/2019 and CUDA 8, 9, 10 on Windows. Thanks! |
There is an error in the CMake-generated file (build\CMakeFiles\osd_static_gpu.dir\osd\osd_static_gpu_generated_cudaKernel.cu.obj.Release.cmake)
at line 81:
set(CUDA_NVCC_COMPILE_DEFINITIONS "**OPENSUBDIV_VERSION_STRING="3.1.1";NOMINMAX;_**USE_MATH_DEFINES;_CRT_SECURE_NO_WARNINGS;OPENSUBDIV_HAS_OPENGL;GLFW_VERSION_3;OSD_USES_GLEW;OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK;OPENSUBDIV_HAS_GLSL_COMPUTE;OPENSUBDIV_HAS_OPENCL;OPENSUBDIV_HAS_CLEW;OPENSUBDIV_HAS_CUDA;OPENSUBDIV_HAS_PTEX;PTEX_STATIC;OPENSUBDIV_HAS_DX11SDK") # list (needs to be in quotes to handle spaces properly).Below is the output of Visual Studio:
31> Building NVCC (Device) object opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/Release/osd_static_gpu_generated_cudaKernel.cu.obj 31> CMake Warning (dev) at osd_static_gpu_generated_cudaKernel.cu.obj.Release.cmake:81: 31> Syntax Warning in cmake code at column 63 31> 31> Argument not separated from preceding token by whitespace. 31> This warning is for project developers. Use -Wno-dev to suppress it. 31> 31> -- Removing C:/Workspace/OpenSubdiv/build/opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/Release/osd_static_gpu_generated_cudaKernel.cu.obj 31> 31> "C:/Program Files/CMake/bin/cmake.exe" -E remove C:/Workspace/OpenSubdiv/build/opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/Release/osd_static_gpu_generated_cudaKernel.cu.obj 31> 31> -- Generating dependency file: C:/Workspace/OpenSubdiv/build/opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/osd_static_gpu_generated_cudaKernel.cu.obj.NVCC-depend 31> 31> "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/bin/nvcc.exe" -M -D__CUDACC__ C:/Workspace/OpenSubdiv/opensubdiv/osd/cudaKernel.cu -o C:/Workspace/OpenSubdiv/build/opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/osd_static_gpu_generated_cudaKernel.cu.obj.NVCC-depend -ccbin "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin" -m64 -DOPENSUBDIV_VERSION_STRING= -D3.1.1\" -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -DOPENSUBDIV_HAS_OPENGL -DGLFW_VERSION_3 -DOSD_USES_GLEW -DOPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK -DOPENSUBDIV_HAS_GLSL_COMPUTE -DOPENSUBDIV_HAS_OPENCL -DOPENSUBDIV_HAS_CLEW -DOPENSUBDIV_HAS_CUDA -DOPENSUBDIV_HAS_PTEX -DPTEX_STATIC -DOPENSUBDIV_HAS_DX11SDK\" -Xcompiler ,\"/DWIN32\",\"/D_WINDOWS\",\"/W3\",\"/GR\",\"/EHsc\",\"/MD\",\"/O2\",\"/Ob2\",\"/DNDEBUG\" -DNVCC "-IC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include" -IC:/Workspace/OpenSubdiv/opensubdiv "-IC:/Program Files/ptex/include" "-IC:/Users/VGI/Documents/Visual Studio 2013/library/glew-1.13.0/include" "-IC:/Program Files (x86)/Windows Kits/8.1/Include/um" "-IC:/Program Files/CLEW/include" 31> 31> nvcc fatal : Stray '"' character 31> 31> CMake Error at osd_static_gpu_generated_cudaKernel.cu.obj.Release.cmake:222 (message): 31> Error generating 31> C:/Workspace/OpenSubdiv/build/opensubdiv/CMakeFiles/osd_static_gpu.dir/osd/Release/osd_static_gpu_generated_cudaKernel.cu.obj 31> 31> 31>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.The text was updated successfully, but these errors were encountered: