Frequently Asked Questions

See also the MATLAB FAQ.

Why Does Build Fail with “this rule is missing dependency declarations” on macOS?

Symptom: After upgrading Xcode on macOS, you encounter an error similar to the following:

$ bazel build ...
ERROR: /private/var/tmp/_bazel_liang/6afb2531e78184cc48f3db789230c79d/
external/libbot/BUILD.bazel:59:1: undeclared inclusion(s) in rule
this rule is missing dependency declarations for the following files
included by 'external/libbot/bot2-lcm-utils/src/tunnel/ldpc/getopt.cpp':

Solution: Install Xcode’s command-line tools and reset the tools’ path to be the default. To install Xcode’s command-line tools:

$ xcode-select --install

Once installed, you should have bin/, include/, lib/, and libexec/ directories within /Library/Developer/CommandLineTools/usr/.

Check the Xcode command line tools’ path:

$ xcode-select -p

Drake’s Bazel-based build system is currently hard-coded to assume the Xcode command line tools are in the default location of /Applications/ If the path is not the default, reset it to be the default by executing the following command:

$ sudo xcode-select --reset

Why Does Build Fail With Missing or Stray Character Error in

Symptom: When building Drake using cmake and make or ninja, the following error occurs:

drake-distro/drake/automotive/maliput/utility/test/ error: missing terminating " character
   EXPECT_EQ(R"R(<?xml version="1.0" ?>
drake-distro/drake/automotive/maliput/utility/test/ error: stray ‘\’ in program
 <robot name="dut">
drake-distro/drake/automotive/maliput/utility/test/ error: missing terminating " character
drake-distro/drake/automotive/maliput/utility/test/ error: stray ‘\’ in program
   <link name="world"/>

Solution: One known cause of this problem is employing ccache without the environment variable CCACHE_CPP2=yes. Try adding the following line to your ~/.bashrc:

export CCACHE_CPP2=yes

Alternatively, update to ccache 3.3 or newer since it by default sets CCACHE_CPP2=yes.

Why Does CMake Fail With An Error Indicating No Compatible VTK Found?

Symptom: When running cmake .. in drake-distro/build, the following error is reported:

CMake Error at cmake/options.cmake:172 (find_package):
  Could not find a configuration file for package "VTK" that is compatible
  with requested version "5.10".

  The following configuration files were considered but not accepted:

    /usr/lib/cmake/vtk-6.2/VTKConfig.cmake, version: 6.2.0

Call Stack (most recent call first):
  cmake/options.cmake:249 (drake_system_dependency)
  CMakeLists.txt:17 (drake_setup_options)

-- Configuring incomplete, errors occurred!

Solution: This error is typically caused by your system having a newer version of VTK installed than the version required by Drake. As indicated by the error message, Drake needs VTK 5.10 whereas the system has VTK 6.2. To get around this error, add -DUSE_SYSTEM_VTK=OFF -DWITH_VTK=ON to the cmake command:

cd drake-distro/build

Alternatively, if you have a compatible version of VTK5 installed, you can tell CMake to use it by specifying VTK_DIR as follows:

cd drake-distro/build
cmake .. -DVTK_DIR=path/to/vtk5

Why doesn’t Drake Visualizer work in VMWare Fusion or Workstation?

Symptom: The simulation runs and the visualization window appears, but no objects are actually drawn. This appeared to be due to display drivers and/or non support of hardware-accelerated rendering. To address this, go to Virtual Machine Settings, and check the Accelerate 3D Graphics box under Display settings; now the simulations draw properly.

Why Does drake-visualizer Segfault Upon Start?

Symptom: VTK6 is installed but Drake’s CMake-based super-build is configured to download and build against VTK5 using the technique described in here. When starting drake-visualizer, it immediately segfaults:

$ cd drake-distro
$ ./build/install/bin/drake-visualizer
Segmentation fault (core dumped)

Solution: The problem is drake-visualizer is correctly being built against VTK5, but is incorrectly run against VTK6. To fix this problem, modify the LD_LIBRARY_PATH and PYTHONPATH environment variables to ensure VTK5 is prioritized over VTK6 as described here. For more information, see this comment.

Why does Drake Visualizer crash with a “No module named vtkCommonCorePython” Error?

Symptom: When you start drake-visualizer, it crashes with the following error:

File "/usr/lib/python2.7/dist-packages/vtk/", line 39, in <module>
  from vtkCommonCore import *
File "/usr/lib/python2.7/dist-packages/vtk/", line 1, in <module>
  from vtkCommonCorePython import *
ImportError: No module named vtkCommonCorePython

Solution: This is a known problem when you have python-vtk6 installed. To workaround the problem, configure Drake’s build system to build VTK5 from source (drake-visualizer is built on Director, which is built on VTK5):

cd drake-distro/build
cd drake-distro/build
make (or ninja)

Next, modify two environment variables before starting drake-visualizer (note that this has only been tested when there are no spaces in the path to the present working directory):

cd drake-distro
export LD_LIBRARY_PATH=`pwd`/build/install/lib/vtk-5.10:$LD_LIBRARY_PATH
export PYTHONPATH=`pwd`/build/externals/vtk/Wrapping/Python:`pwd`/build/externals/vtk/bin:$PYTHONPATH

You should now be able to start drake-visualizer.

Problems Installing Drake on Ubuntu After Installing NVidia Drivers

I’m having trouble trying to install drake on Ubuntu after installing NVidia drivers. I get the error:

make[5]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/', needed by `lib/'.  Stop.

You may need to follow these steps:

Can’t find jpeglib.h when compiling bot2-vis on Mac

Make sure you’ve installed the xcode command line tools with xcode-select --install, then make clean and make again.

Why do OpenGL-based VTK targets run with bazel test sometimes fail on Linux?

Symptom: While the binary works with bazel run, when you run a test using bazel test, such as:

$ bazel test //drake/systems/sensors:rgbd_camera_test

you encounter a slew of errors from VTK / OpenGL:

ERROR: In /vtk/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 820
vtkXOpenGLRenderWindow (0x55880715b760): failed to create offscreen window

ERROR: In /vtk/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 816
vtkXOpenGLRenderWindow (0x55880715b760): GLEW could not be initialized.

ERROR: In /vtk/Rendering/OpenGL2/vtkShaderProgram.cxx, line 453
vtkShaderProgram (0x5588071d5aa0): Shader object was not initialized, cannot attach it.

ERROR: In /vtk/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 1858
vtkXOpenGLRenderWindow (0x55880715b760): Hardware does not support the number of textures defined.

Solution: The best workaround is to first mark the test as as local in the BUILD file, either with local = 1, or tags = [.., "local"],. Doing so will make the specific target run without sandboxing, such that it has an environment similar to that of bazel run.

As an example, in drake/systems/sensors/BUILD:

    name = "rgbd_camera_test",
    # ...
    local = 1,
    # ...

If this does not work, then try running the test in Bazel without sandboxing:

$ bazel test --spawn_strategy=standalone //drake/systems/sensors:rgbd_camera_test

Please note that you can possibly add --spawn_strategy=standalone to your ~/.bazelrc, but be aware that this means your development machine may have a different environment than other development machines when running the test.