openvdb icon indicating copy to clipboard operation
openvdb copied to clipboard

[BUILD/Windows] openvdb_ax.dll does not export any symbols.

Open LazyDodo opened this issue 2 years ago • 1 comments

Environment

**Operating System: Windows 10 **Version / Commit SHA: VDB 9.1 **CMake Version: 3.23.1 **Compiler: msvc 2019 - v16.9.16

Describe the problem

When building with these options

  -DOPENVDB_BUILD_PYTHON_MODULE=ON
  -DOPENVDB_BUILD_AX=ON
  -DOPENVDB_AX_SHARED=ON
  -DOPENVDB_AX_STATIC=OFF

The generated openvdb_ax.dll does not export any symbols (and the linker will not emit an import library .lib because of that) leading to the following issues:

  • A shared library that doesn't export any symbols isn't very useful :)
  • Due to no import library being generated the python module will have a linker error

To Reproduce

Steps to reproduce the behavior:

  1. Build with above build options on windows
  2. See error

Additional context

The root cause is while the regular openvdb library gets OPENVDB_DLL defined over here no such supporting code exists for openvdb_ax, hence it doesn't get OPENVDB_AX_DLL defined and the code here in platform.h decides to use this define, leading to no exports due to a lacking dllexport attribute

Adding -DOPENVDB_AX_DLL to the CMAKE_CXX_FLAGS to my cmake invocation, solves the issue short term, but a proper fix is likely the way to go here.

I don't have a CLA signed, so cannot send a pull that would have added a define right around here

Additional question

Reporting this feels strange, I can't shake the eerie feeling I'm missing something super obvious here, as CI should have caught this right out of the gate...what did i miss?

LazyDodo avatar Aug 09 '22 13:08 LazyDodo

Hey @LazyDodo thanks for reporting! I think you're right in that it's simply missing from the shared library configuration. Our CI only tests the static build on Windows (I suspect originally due to CI memory limitations with shared builds of LLVM - this has been a problem for a while, we're trying to get better runner resources asap). I will look into this now

Idclip avatar Aug 09 '22 15:08 Idclip