RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.19k stars 1.24k forks source link

OpenUSD compilation errors on Ubuntu 24.04 #21456

Open jwnimmer-tri opened 1 month ago

jwnimmer-tri commented 1 month ago

This is a sub-task of #20898.

When compiling OpenUSD on Ubuntu 24.04 (i.e., with GCC 13.2 in C++20 mode), we experience a compilation error.

See here for a build log, but here's a partial snippet for context:

ERROR: external/openusd_internal/BUILD.bazel:43:16: Compiling pxr/usd/pcp/diagnostic.cpp failed:
In file included from external/openusd_internal/pxr/usd/pcp/diagnostic.cpp:31:
external/openusd_internal/pxr/usd/pcp/dependencies.h: In function 'bool drake_vendor_pxrInternal__pxrReserved__::Pcp_NodeUsesLayerOrLayerStack(const PcpNodeRef&, const PcpLayerStackPtr&)':
external/openusd_internal/pxr/usd/pcp/dependencies.h:316:33: error: no match for 'operator==' (operand types are 'const drake_vendor_pxrInternal__pxrReserved__::PcpLayerStackRefPtr' {aka 'const drake_vendor_pxrInternal__pxrReserved__::TfRefPtr<drake_vendor_pxrInternal__pxrReserved__::PcpLayerStack>'} and 'const drake_vendor_pxrInternal__pxrReserved__::PcpLayerStackPtr' {aka 'const drake_vendor_pxrInternal__pxrReserved__::TfWeakPtr<drake_vendor_pxrInternal__pxrReserved__::PcpLayerStack>'})
  316 |     return node.GetLayerStack() == layerStack;
      |            ~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~
      |                              |     |
      |                              |     const drake_vendor_pxrInternal__pxrReserved__::PcpLayerStackPtr {aka const drake_vendor_pxrInternal__pxrReserved__::TfWeakPtr<drake_vendor_pxrInternal__pxrReserved__::PcpLayerStack>}
      |                              const drake_vendor_pxrInternal__pxrReserved__::PcpLayerStackRefPtr {aka const drake_vendor_pxrInternal__pxrReserved__::TfRefPtr<drake_vendor_pxrInternal__pxrReserved__::PcpLayerStack>}

This seems like another instance where the operator== overloading in OpenUSD experiences problems when the new C++20 "rewritten comparison operators" semantics are enabled.

I haven't looked yet whether this is a bug in the upstream code, or a mistake in the patch from Drake.

jwnimmer-tri commented 1 month ago

For now, I'll disable OpenUSD on Ubuntu 24.04 in order to get CI up and running (#21335).

Fixing this bug (and undoing my disablement) will be a prerequisite of shipping OpenUSD as a Drake feature.

I'll request that +@hong-nvidia implement the necessary fixes and open a pull request. (There is no particular rush.)