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?
Originally posted by Cerin on ROS Answers with karma: 940 on 2016-09-21
Post score: 1
Original comments
Comment by gvdhoorn on 2016-09-22:
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?
Comment by gvdhoorn on 2016-09-22:
CMake should also output the generator it is using for your build scripts. Can you find that anywhere in the output?
Comment by Cerin on 2016-09-22:
@gvdhoorn, What is the generator called? What am I looking for?
Comment by gvdhoorn on 2016-09-22:
The generator is called ninja
. See cmake-generators(7) and What is a CMake generator? for some discussion on generators.
Comment by gvdhoorn on 2016-09-22:
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?
Comment by Cerin on 2016-09-22:
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
.
Comment by gvdhoorn on 2016-09-22:
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.
Comment by gvdhoorn on 2016-09-22:
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.
Comment by gvdhoorn on 2016-09-22:
I'm also assuming here that you haven't somehow configured CMake to always use ninja.
If OpenCV3 forces ninja to be used, then obviously that is the culprit.
As to the error message you see after installing ninja-build: I'm guessing Catkin doesn't know about ninja, and doesn't invoke it correctly.
Comment by Vincent Rabaud on 2016-09-23:
Have you tried with any other package ? (unrelated to OpenCV)
Comment by gvdhoorn on 2016-09-23:
@Vincent Rabaud: does opencv3 force use of the ninja generator? (I haven't checked, so this may be a strange question to ask).
Comment by Qamar on 2016-09-23:
I'm receiving same errors when compiling octomap
on Raspberry pi.
==> Processing plain cmake package: 'octomap'
[..]
==> ninja -j4 in '/home/pi/ros_catkin_ws/build_isolated/octomap/install'
/opt/ros/kinetic/env.sh: 16: exec: ninja: not found
Comment by Cerin on 2016-09-23:
@Vincent, It's a source installation, so I've installed all packages from source, and this is the only one that's given me this error.
Comment by Cerin on 2016-09-23:
@Vincent, How would I check if opencv3 forces ninja? It appears to be mentioned in their CMakeLists, but I'm not completely familiar with CMake's format, so I can't say if it's being forced.