PixarAnimationStudios / OpenSubdiv

An Open-Source subdivision surface library.
graphics.pixar.com/opensubdiv
Other
2.88k stars 558 forks source link

Link Error for dxPtexViewer on Windows #1328

Open jonassorgenfrei opened 6 months ago

jonassorgenfrei commented 6 months ago

Hey

I'd like to reopen this ticket as i still having this issue unfortunatly. I just tried to build the library and again hang at building dxPtexViewer. Are there any solutions to this yet.

It's still the linking issue for dxPtexViewer which can't resolve the symbols:

public: void cdecl OpenSubdiv::v3_6_0::Osd::CLD3D11VertexBuffer::UpdateData(float const ,int,int,struct _cl_command_queue ) public: struct _cl_mem __cdecl OpenSubdiv::v3_6_0::Osd::CLD3D11VertexBuffer::BindCLBuffer(struct _cl_command_queue ) public: struct ID3D11Buffer * cdecl OpenSubdiv::v3_6_0::Osd::CLD3D11VertexBuffer::BindD3D11Buffer(struct ID3D11DeviceContext ) public: static class OpenSubdiv::v3_6_0::Osd::CLD3D11VertexBuffer __cdecl OpenSubdiv::v3_6_0::Osd::CLD3D11VertexBuffer::Create(int,int,struct _cl_context ,struct ID3D11DeviceContext )

Here's my CMake config: grafik

Thanks for you help in advance :)

Cheers Jonas

Originally posted by @jonassorgenfrei in https://github.com/PixarAnimationStudios/OpenSubdiv/issues/1154#issuecomment-1987377516

davidgyu commented 5 months ago

Filed as internal issue #OSD-435

davidgyu commented 5 months ago

Sorry to hear that you're still having this issue. Seems like something is misconfigured in your CMake config.

In general, the same configuration which allows dxPtexViewer.exe to be built with support for D3D11 OpenCL interop is the configuration that enables building osd/clD3D11VertexBuffer.cpp which provides the symbols which are undefined in your build.

How are you running CMake, i.e. from the command prompt, from within Visual Studio, etc.?

I typically run CMake from the command prompt and then open the resulting solution in Visual Studio, or just build from the command prompt, e.g.:

set OpenCL_LIBPATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\lib\x64

cmake^ -S .^ -D buildDir^ -G "Visual Studio 17 2022" -A x64^ -D CMAKE_INSTALL_PREFIX="buildDir/inst"^ -D PTEX_LOCATION:path="%USERPROFILE%/3rdparty/ptex-2.1.28/build"^ -D ZLIB_ROOT:path="%USERPROFILE%/3rdparty/zlib-1.2.11/build"^ -D CUDA_TOOLKIT_ROOT_DIR:path="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0"^ -D OpenCL_ROOT:path="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0"^ -D NO_OPENGL:bool=ON^ -D NO_OPENCL:bool=OFF^ -D NO_OMP:bool=ON^ -D NO_CLEW:bool=ON^ -D NO_TBB:bool=ON^ -D NO_DOC:bool=ON^

cmake --build buildDir --config Release --target install

.\buildDir\bin\Release\dxViewer.exe

Another thing I noticed in your CMake config is that you apparently have two different OpenCL toolkits installed: NVIDIA's CUDA 12 Toolkit and another in OpenCL-SDK (possibly from Intel or AMD or Khronos?). I don't know if that's a problem, but you might try explicitly pointing to the OpenCL implementation in NVIDIA's SDK as in my example above.