Skip to content

Fix Clang Template errors #1977

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

Merged

Conversation

dgovil
Copy link
Contributor

@dgovil dgovil commented Dec 3, 2024

Upcoming versions of Clang/LLVM change some behaviour around templating that causes OpenVDB to fail to compile.

This commit addresses two issues and allows VDB to compile again.

  1. There were three instances of an unnecessary template keyword in NodeManager.h that were not followed by a template call, and therefore are illegal to the compiler.

  2. GridBuilder.h had a template call to a non-existent method. This was not previously validated, but is now validated. Switching the call from isActive to isOn works (as suggested by Ken).

See the changelog for Clang and the associated PR for the second point above

This fixes #1976

Built on macOS with the following build args

-DBOOST_ROOT=/usr/local/apps/boost/1.82.0-a0
-DTBB_ROOT=/usr/local/apps/tbb/2020_U3-a1/platform-osx
-DBlosc_ROOT=/usr/local/apps/blosc/1.21.5-a0/apple_universal-2
-DOPENVDB_BUILD_NANOVDB=ON
-DNANOVDB_USE_OPENVDB=ON

Copy link
Contributor

@kmuseth kmuseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see request for minor change

Upcoming versions of Clang/LLVM change some behaviour around templating that causes OpenVDB to fail to compile.

This commit addresses two issues and allows VDB to compile again.

1. There were three instances of an unnecessary template keyword in NodeManager.h that were not followed by a template call, and therefore are illegal to the compiler.

2. GridBuilder.h had a template call to a non-existent method. This was not previously validated, but is now validated. Switching the symbol from `isActive` to `isOn` per Ken's review.

See the [changelog](https://releases.llvm.org/19.1.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics:~:text=Clang%20now%20looks%20up%20members%20of%20the%20current%20instantiation%20in%20the%20template%20definition%20context%20if%20the%20current%20instantiation%20has%20no%20dependent%20base%20classes.) for Clang and the associated [PR for the second point above](llvm/llvm-project#84050)

Signed-off-by: Dhruv Govil <[email protected]>
@dgovil dgovil force-pushed the 1976-clang_template_fixes branch from 62c002c to e3ee850 Compare December 3, 2024 20:33
@mont29
Copy link

mont29 commented Dec 4, 2024

Can confirm that this PR fixes the issue I have when building Blender with clang19 on linux (reported as #1976).

@kmuseth kmuseth merged commit 930c3ac into AcademySoftwareFoundation:master Dec 5, 2024
34 checks passed
@meshula
Copy link

meshula commented Feb 28, 2025

@dgovil @kmuseth Thanks for identifying, patching, and landing this one so quickly.

We're tracking this one for our next release of OpenUSD in May. I was wondering if there'll be a tagged release or patch we can point to in order to pick up this fix?

cc/ @jesschimein

pixar-oss pushed a commit to PixarAnimationStudios/OpenUSD that referenced this pull request Mar 8, 2025
AcademySoftwareFoundation/openvdb#1977 fixed a syntax issue that
caused errors when building with Xcode 16.3. This change updates
build_usd.py to apply the (simple) patch to the version of OpenVDB
it builds. We manually back-port this fix for a few reasons:

- The PR was merged in December 2024, but is currently not part
  of an official release.

- build_usd.py currently uses OpenVDB 9.1.0, which is several
  major versions behind the current latest version 12.0.0.
  Even if the PR were released in a new 12.x version, we wouldn't
  want to jump all the way there since it's so far ahead of what
  we're building and testing against internally.

If OpenVDB officially ports the fix back to older versions, we
can revert this change and just update build_usd.py to pull in
the official release instead.

(Internal change: 2359154)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]Nanovdb: Invalid code in GridBuilder fails to compile with clang19
4 participants