Ask Your Question
1

Unable to install because of missing ninja

asked 2016-09-21 21:44:03 -0500

Cerin gravatar image

updated 2016-09-21 22:23:55 -0500

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?

edit retag flag offensive close merge delete

Comments

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?

gvdhoorn gravatar imagegvdhoorn ( 2016-09-22 02:15:46 -0500 )edit

CMake should also output the generator it is using for your build scripts. Can you find that anywhere in the output?

gvdhoorn gravatar imagegvdhoorn ( 2016-09-22 03:18:21 -0500 )edit

@gvdhoorn, What is the generator called? What am I looking for?

Cerin gravatar imageCerin ( 2016-09-22 11:13:21 -0500 )edit

The generator is called ninja. See cmake-generators(7) and What is a CMake generator? for some discussion on generators.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-22 12:23:41 -0500 )edit

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?

gvdhoorn gravatar imagegvdhoorn ( 2016-09-22 12:24:39 -0500 )edit

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 was rosinstall_generator.

Cerin gravatar imageCerin ( 2016-09-22 13:15:17 -0500 )edit
1

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.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-22 13:30:49 -0500 )edit
1

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.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-22 13:32:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-24 22:32:55 -0500

jb gravatar image

In src/catkin/python/catkin/builder.py line 532, make the following change:

@@ -527,11 +527,11 @@
         run_command_colorized(
             make_check_cmake_cmd, build_dir, quiet
         )

     # Run make
-    if not use_ninja:
+    if use_ninja:
         make_executable = 'ninja'
     elif use_nmake:
         make_executable = 'nmake'
     else:
         make_executable = 'make'
edit flag offensive delete link more

Comments

@Cerin: this could indeed be the cause of Catkin using the ninja generator. What I haven't figured out yet is why it only tries to do that with OpenCV3, but it's a bug in any case.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-25 05:03:43 -0500 )edit
1

The bug only affected plain CMake packages. This is being addressed by https://github.com/ros/catkin/pull/827

Dirk Thomas gravatar imageDirk Thomas ( 2016-09-25 09:59:08 -0500 )edit

Thx @dirk-thomas !

Vincent Rabaud gravatar imageVincent Rabaud ( 2016-09-25 13:56:31 -0500 )edit

Great find. Thank you.

Cerin gravatar imageCerin ( 2016-09-25 20:27:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-09-21 21:44:03 -0500

Seen: 1,519 times

Last updated: Sep 24 '16