TBB issues when building - both via build_usd.py and manually

The build_usd.py script downloads and builds a version of TBB, but it doesn’t seem like it’s being picked up during the build of USD itself.

Similarly, BUILDING.md suggests setting -DTBB_ROOT_DIR when invoking cmake but, when I do that, I get:

CMake Warning:
  Manually-specified variables were not used by the project:

    TBB_ROOT_DIR

All of this spawns from:

$ python3 build_scripts/build_usd.py -vv -j 1 /home/robp/dev/github/_usd

Building with settings:
  USD source directory          /home/robp/dev/github/USD
  USD install directory         /home/robp/dev/github/_usd
  3rd-party source directory    /home/robp/dev/github/_usd/src
  3rd-party install directory   /home/robp/dev/github/_usd
  Build directory               /home/robp/dev/github/_usd/build
...
[ 26%] Building CXX object pxr/base/work/CMakeFiles/work.dir/detachedTask.cpp.o
In file included from /home/robp/dev/github/USD/pxr/base/work/detachedTask.h:15,
                 from /home/robp/dev/github/USD/pxr/base/work/detachedTask.cpp:9:
/home/robp/dev/github/USD/pxr/base/work/dispatcher.h: In constructor ‘pxrInternal_v0_25_5__pxrReserved__::WorkDispatcher::_TaskGroup::_TaskGroup(tbb::detail::d1::task_group_context&)’:
/home/robp/dev/github/USD/pxr/base/work/dispatcher.h:205:71: error: no matching function for call to ‘tbb::detail::d1::task_group::task_group(tbb::detail::d1::task_group_context&)’
  205 |         _TaskGroup(tbb::task_group_context& ctx) : tbb::task_group(ctx) {}
      |                                                                       ^
In file included from /usr/include/tbb/task_group.h:17,
                 from /home/robp/dev/github/USD/pxr/base/work/dispatcher.h:24,
                 from /home/robp/dev/github/USD/pxr/base/work/detachedTask.h:15,
                 from /home/robp/dev/github/USD/pxr/base/work/detachedTask.cpp:9:
/usr/include/oneapi/tbb/task_group.h:621:5: note: candidate: ‘tbb::detail::d1::task_group::task_group()’
  621 |     task_group() : task_group_base(task_group_context::concurrent_wait) {}
      |     ^~~~~~~~~~
/usr/include/oneapi/tbb/task_group.h:621:5: note:   candidate expects 0 arguments, 1 provided
gmake[2]: *** [pxr/base/work/CMakeFiles/work.dir/build.make:97: pxr/base/work/CMakeFiles/work.dir/detachedTask.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:4124: pxr/base/work/CMakeFiles/work.dir/all] Error 2

You can see how task_group.h is being picked up from /usr/include and not /home/robp/dev/github/_usd.

This is all using the 25.05rc1 tag, but perhaps this has been the case for longer.

I reverted to 25.02 and it looks like it’s properly picking up the local TBB - at least based on warnings like this:

[3862/4560] Building CXX object pxr/usd/usdMtlx/CMakeFiles/usdMtlx.dir/fileFormat.cpp.o
In file included from /home/robp/dev/github/USD/pxr/base/work/dispatcher.h:26,
                 from /home/robp/dev/github/USD/pxr/usd/sdf/layer.h:29,
                 from /home/robp/dev/github/USD/pxr/usd/pcp/types.h:13,
                 from /home/robp/dev/github/USD/pxr/usd/pcp/node.h:12,
                 from /home/robp/dev/github/USD/pxr/usd/usd/editTarget.h:14,
                 from /home/robp/dev/github/USD/pxr/usd/usd/stage.h:15,
                 from /home/robp/dev/github/USD/pxr/usd/usdMtlx/fileFormat.cpp:11:
/home/robp/dev/github/_usd/include/tbb/task.h:21:139: note: ‘#pragma message: TBB Warning: tbb/task.h is deprecated. For details, please see Deprecated Features appendix in the TBB reference manual.’
   21 | #pragma message("TBB Warning: tbb/task.h is deprecated. For details, please see Deprecated Features appendix in the TBB reference manual.")

Okay, I managed to find the cause and logged it as a Github issue - build_usd.py favours system TBB over local one · Issue #3610 · PixarAnimationStudios/OpenUSD · GitHub

1 Like