AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

[BUG] New and exciting linking errors with 11 and previously working code #1765

Closed cgolchert closed 5 months ago

cgolchert commented 7 months ago

Environment

Win 11 vcpkg based 11.0.0 Visual Studio 2022

Describe the bug

Prior compiles went fine, now I'm getting:

_unresolved external symbol "public: static char const const openvdb::v11_0::GridBase::META_GRID_CLASS" unresolved external symbol "public: static char const const openvdb::v11_0::GridBase::META_GRIDNAME" Is there anything that changed from 10 to 11 for this to suddenly show up?

The only thing I'm doing is: openvdb::tools::MultiResGrid mrg(levels + 1, grid; and commenting out that line builds without any issues.

levels is an int based off voxel count defaulting to 3 grid is a floatgrid

To Reproduce

Build code that worked under 10.x

Expected behavior

A successful build as before

Additional context

Before I get a bunch of did you do this and did you do that, I posted this in the discussion area three weeks ago but never heard anything. I was asking what changed to cause this so I CAN try to find the issue. I want to identify and fix the issue no matter where the problem is, not argue about it.

Idclip commented 7 months ago

We've not made any changes that I'm aware of to cause the issue you're seeing.

I saw your post but have not had a chance to reply. I also saw your comment in https://github.com/AcademySoftwareFoundation/openvdb/discussions/1759 about Utils.cc and your old issue about linking errors due to this https://github.com/AcademySoftwareFoundation/openvdb/issues/773. Note that we did not move these defines out of a TU to fix any known linking issues, they were moved because it made better sense for them to be inlined.

Taking both of these into account, and the fact that no one else has reported these issues (please let me know if I'm wrong here), the problem seems to be related to your specific build setup. To remove all ambiguity, could you please confirm how you're installing VDB (vcpkg and the toolchain triplet you're using) as well as how the application you're writing that depends on OpenVDB is including/linking against it from your vcpkg installation. Any/all build logs will help with diagnosing the problem

cgolchert commented 7 months ago

Sorry, life happened before I could reply.

I'm installing with vcpkg triplet :x64-windows openvdb version 11.0.0

For the build of my stuff I'm working in visual studio 2022 The includes are ..including:

#include <openvdb/openvdb.h>
#include <openvdb/grid.h>
#include <openvdb/tools/MultiResGrid.h>

Here is the log.
build.txt

It's including and linking based off of what vcpkg generates. Like I said it was all working up until I jumped from 10.x to 11.0

Idclip commented 7 months ago

I've only managed to skim that build log, but neither cl.exe or msbuild.exe seem to be being invoked. Additionally the ClCompile and CL targets seem to be being skipped and it's going straight to linking. Can you confirm that, in updating to VDB 11, you have re-generated the object files for your software? i.e - a complete full clean of the project + a rebuild (and attach such a log if that was not the case above)

cgolchert commented 7 months ago

Attached are two (less verbose) logs.

The "commented" one is a cleaning and build log with the line openvdb::tools::MultiResGrid<FloatGrid::TreeType> mrg(1, grid); Commented out

The "uncommented" one is a cleaning and build log with the line openvdb::tools::MultiResGrid<FloatGrid::TreeType> mrg(1, grid); NOT commented out and part of the code.

commented.txt uncommented.txt

THAT particular line of code was stolen from the tool.h command that comes with openvdb and was working quite well under 10.x.

cgolchert commented 5 months ago

I reinstalled the entire vcpkg build and it seems to be working. I'm not sure what caused it since nothing else changed.