Search code examples
yaml-cppdrake

meshcat_visualizer_test fails fetching repository 'yaml_cpp'


I'm trying to run drake/bindings/pydrake/systems/test/meshcat_visualizer_test.py as per the commented instructions at the top of said file, but I am unfamiliar as to how I would add yaml-ccp, which I believe is causing errors. I have the drake repo cloned and pydrake configured, and was able to Run Server (the first required command), but do not know how to add the yaml-cpp package if it is missing.

phil@philpc:~/drake/bindings/pydrake/systems/test$ bazel run --run_under='env TEST_ZMQ_URL=tcp://127.0.0.1:6000' //bindings/pydrake/systems:py/meshcat_visualizer_test -- 'TestMeshcat.test_point_cloud_visualization'
INFO: Repository yaml_cpp instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule pkg_config_repository defined at:
  /home/phil/drake/tools/workspace/pkg_config.bzl:276:25: in <toplevel>
ERROR: An error occurred during the fetch of repository 'yaml_cpp':
   Unable to complete pkg-config setup for @yaml_cpp repository: error 1 from [/usr/bin/pkg-config, "yaml-cpp"]: 
INFO: Repository remotejdk11_linux instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule http_archive defined at:
  /home/phil/.cache/bazel/_bazel_phil/a5ca8dfa5bc97606d4bf1d23312635a2/external/bazel_tools/tools/build_defs/repo/http.bzl:336:16: in <toplevel>
INFO: Repository remote_java_tools_linux instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule http_archive defined at:
  /home/phil/.cache/bazel/_bazel_phil/a5ca8dfa5bc97606d4bf1d23312635a2/external/bazel_tools/tools/build_defs/repo/http.bzl:336:16: in <toplevel>
INFO: Repository fmt instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule _github_archive_real defined at:
  /home/phil/drake/tools/workspace/github.bzl:102:24: in <toplevel>
INFO: Repository lcm instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule _github_archive_real defined at:
  /home/phil/drake/tools/workspace/github.bzl:102:24: in <toplevel>
ERROR: /home/phil/drake/tools/install/libdrake/BUILD.bazel:251:1: //tools/install/libdrake:libdrake_runtime_so_deps depends on @yaml_cpp//:yaml_cpp in repository @yaml_cpp which failed to fetch. no such package '@yaml_cpp//': Unable to complete pkg-config setup for @yaml_cpp repository: error 1 from [/usr/bin/pkg-config, "yaml-cpp"]: 
ERROR: Analysis of target '//bindings/pydrake/systems:py/meshcat_visualizer_test' failed; build aborted: no such package '@yaml_cpp//': Unable to complete pkg-config setup for @yaml_cpp repository: error 1 from [/usr/bin/pkg-config, "yaml-cpp"]: 
INFO: Elapsed time: 0.515s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (6 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (6 packages loaded, 0 targets configured)

Solution

  • Try running /usr/bin/pkg-config yaml-cpp --libs on the command line and see what happens. It should report no error and just print -lyaml-cpp.

    Have you installed Drake's dependencies using https://drake.mit.edu/ubuntu.html command? It should have installed libyaml-cpp-dev at that point, which should be all that is needed for pkg-config to succeed.