Unable to install because of missing ninja
I'm trying to install the diagnostics module from source into my existing Kinetic source installation.
To do this, I'm running:
cd /home/pi/ros_catkin_ws;
rosinstall_generator diagnostics --rosdistro kinetic --deps | wstool merge -t src -
wstool update -t src -j2 --delete-changed-uris
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y -r --os=debian:jessie
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j1
It's failing when trying to install the dependency Opencv3, with the error:
-- Build files have been written to: /home/pi/ros_catkin_ws/build_isolated/opencv3/install
==> ninja -j1 in '/home/pi/ros_catkin_ws/build_isolated/opencv3/install'
/opt/ros/kinetic/env.sh: 16: exec: ninja: not found
<== Failed to process package 'opencv3':
Command '['/opt/ros/kinetic/env.sh', 'ninja', '-j1']' returned non-zero exit status 127
Reproduce this error by running:
==> cd /home/pi/ros_catkin_ws/build_isolated/opencv3 && /opt/ros/kinetic/env.sh ninja -j1
Command failed, exiting.
What "ninja" program is it referring to, and why wasn't this auto-installed by rosdep? There appears to be both an apt package and pip package called "ninja", which do very different things, so it's unclear which one it's expecting.
Edit: I'm assuming it's referring to the ninja build system? I tried installing the ninja-build
package, and re-running the build process, but that reports a different but similar ninja error:
==> Processing plain cmake package: 'opencv3'
==> Building with env: '/opt/ros/kinetic/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/home/pi/ros_catkin_ws/build_isolated/opencv3/install'
==> ninja -j1 in '/home/pi/ros_catkin_ws/build_isolated/opencv3/install'
ninja: error: loading 'build.ninja': No such file or directory
<== Failed to process package 'opencv3':
Command '['/opt/ros/kinetic/env.sh', 'ninja', '-j1']' returned non-zero exit status 1
Reproduce this error by running:
==> cd /home/pi/ros_catkin_ws/build_isolated/opencv3 && /opt/ros/kinetic/env.sh ninja -j1
How do I fix this?
Somehow CMake is generating build files for
ninja
(the build tool, not the python library), which is definitely not standard.As
opencv3
is a "plain cmake" package, it might be doing some strange things. Perhaps OpenCV3's build files are hard-coding a generator?CMake should also output the generator it is using for your build scripts. Can you find that anywhere in the output?
@gvdhoorn, What is the generator called? What am I looking for?
The generator is called
ninja
. See cmake-generators(7) and What is a CMake generator? for some discussion on generators.But more interesting would be to understand why CMake chose the ninja generator in the first place: did this ever happen before? Can you successfully use
rosinstall_generator
to build other pkgs?I still don't understand. Like I said in my question, it's outputting
ninja
, so I'm not sure why you're telling me to look for it. The problem is the ninja build script isn't being generated, so ninja is throwing an error. And yes, the first command I ran wasrosinstall_generator
.Nowhere in ROS is the CMake generator being configured. Afaik, all catkin driven CMake activity uses the GNU Makefile generator. Something in your setup is forcing CMake to use the ninja generator. That is something to figure out. Who or what is making CMake use the ninja generator.
As to the output I'm asking for: CMake uses its generators at configuration time, not build time. I'm asking whether you see any output during initial configuration that states that CMake is using its ninja generator. Lines regarding that should appear before the lines you've copy/pasted.