Search code examples
drake

Error building Drake from source on deprecation warnings


I cloned the drake repo and went through the [setup instructions from source][1] (WSL Ubuntu 18.04). Now I am trying to follow the first steps and build:

bazel build //tools:drake_visualizer //manipulation/util:geometry_inspector

However some warnings treated as errors are getting in the way :

bazel-out/k8-opt/bin/systems/framework/_virtual_includes/system_scalar_converter/drake/systems/framework/system_scalar_converter.h: In member function 'void drake::systems::SystemScalarConverter::AddIfSupported()': bazel-out/k8-opt/bin/systems/framework/_virtual_includes/system_scalar_converter/drake/systems/framework/system_scalar_converter.h:138:60: error: 'GuaranteedSubtypePreservation' is deprecated: DRAKE DEPRECATED: Use MakeWithoutSubtypeChecking instead of kDisabled. The deprecated code will be removed from Drake on or after 2021-11-01. [-Werror=deprecated-declarations] AddIfSupported<S, T, U>(GuaranteedSubtypePreservation::kEnabled);

What's the proper way to resolve that? Since those warnings are coming from explicit deprecations I would assume there is a way to cleanly work around them without manually tampering with the BUILD files?


Solution

  • Perhaps there is something different with the WSL toolchain that's tripping us up here?

    In any case, it calls my attention to the fact that a bit of stale code has slipped into that function body. I'll work on a fix for that typo https://github.com/RobotLocomotion/drake/pull/15657, and perhaps it will resolve your problem as well.