openvdb icon indicating copy to clipboard operation
openvdb copied to clipboard

[BUG] Explicit instantiations crash Visual Studio 2017 linker in debug

Open matthewdcong opened this issue 3 years ago • 4 comments

Environment

Windows 10 OpenVDB v9.0.0 Visual Studio 2017, exact compiler version 14.16.27048.0

Describe the bug

Turning on USE_EXPLICIT_INSTANTIATIONS in CMake debug mode causes a fatal error in the VS2017 linker with the following error:

VolumeToMesh.obj: fatal error LNK1000: Internal error during BuildLibrary.EmitMember

Turning off USE_EXPLICIT_INSTANTIATIONS fixes the issue.

To Reproduce

Steps to reproduce the behavior:

  1. Build with the Visual Studio 15 2017 Win64 generator in the Debug configuration.
  2. See error in the linking stage

Expected behavior

The compilation should succeed like it does on GCC 7.3.1 with the same source and USE_EXPLICIT_INSTANTIATIONS enabled.

matthewdcong avatar May 27 '22 05:05 matthewdcong

@kmuseth @danrbailey

matthewdcong avatar May 27 '22 05:05 matthewdcong

Does this happen for both static and shared (dll) builds?

Idclip avatar May 27 '22 12:05 Idclip

This happens when building a static library in the debug configuration. Not sure if it happens with a shared library.

That being said, I am a bit mistaken to consider this an OpenVDB bug -- this is more a bug in MSVC (and a five year old version at that) unless we're doing something that doesn't abide by the standard which isn't the case afaict.

matthewdcong avatar May 27 '22 15:05 matthewdcong

Good to know - we currently don't test static builds with explicit instantiation on Windows (due to CI limitations) which is why I ask. There's nothing obvious as to why this should crash so I suspect it's a MSVC bug but we should investigate.

Idclip avatar May 29 '22 18:05 Idclip