nix-ros-overlay icon indicating copy to clipboard operation
nix-ros-overlay copied to clipboard

navigation2 does not build

Open muellerbernd opened this issue 2 years ago • 13 comments
trafficstars

The navigation2 package does not build because nav2_mppi_controller is missing. In the last rosdistro sync there is a dependency (xtensor) of nav2_mppi_controller listed as missing. But xtensor is available in nixpkg (see search).

Because of this rtabmap-ros does also not compile.

I want to contribute more to this repo is there a guideline on how to do so?

muellerbernd avatar Aug 08 '23 12:08 muellerbernd

You'll need to make a PR to rosdistro, like this recent one that added a dependency of RViz.

hacker1024 avatar Aug 08 '23 12:08 hacker1024

@hacker1024 thanks for this information. I made a PR to rosdistro here

muellerbernd avatar Aug 08 '23 12:08 muellerbernd

It looks like nav2_mppi_controller needs xsimd as well.

lopsided98 avatar Aug 08 '23 20:08 lopsided98

I created a PR for rosdep to include xsimd

muellerbernd avatar Aug 09 '23 06:08 muellerbernd

nav2-mppi-controller is now generated but fails to build due to some non-obvious issue with the xsimd/xtensor headers. Do you need that specific package or were you just trying to use the navigation2 meta package which happens to include that package?

lopsided98 avatar Sep 09 '23 00:09 lopsided98

I was trying to build rtabmap-ros and it seemed like navigation2 was a dependency.

muellerbernd avatar Sep 12 '23 07:09 muellerbernd

nav2-mppi-controller is now generated but fails to build due to some non-obvious issue with the xsimd/xtensor headers. Do you need that specific package or were you just trying to use the navigation2 meta package which happens to include that package?

Now I need it! I'll look into it. A bunch of nav2 packages also need -Wno-error=maybe-uninitialized. I'll submit a PR with overrides sometime this week.

hacker1024 avatar Sep 24 '23 05:09 hacker1024

Alright, got it all working:

Issues

a) The following packages need to be compiled with -Wno-error=maybe-uninitialized: nav2-behaviors, nav2-constrained-smoother, nav2-planner, nav2-smoother, nav2-waypoint-follower, dwb-critics, dwb-plugins. b) OMPL requires a fix upstream: https://github.com/ompl/ompl/pull/1101 c) xtensor needs upgrading, but xsimd needs downgrading (from Nixpkgs master... it's actually an upgrade on nix-ros). This handles the former so far: https://github.com/NixOS/nixpkgs/pull/225904

Solutions

a) can be fixed here in an overlay, though it's probably best fixed upstream. That seems like a fair bit of effort, though. b) can be applied in an overlay as well, though it's probably best to just wait for it to get merged. c) is trickier. There's no easy solution yet. Apparently waiting on https://github.com/xtensor-stack/xtensor/issues/2721 to make a decision. For now, I just downgraded it globally.

hacker1024 avatar Sep 24 '23 11:09 hacker1024

Hey all, feel free to suggest a solution to the xtensor update going on at #2721 that will add xsimd support to xtensor. An option I was also thinking about is creating a dedicated xsimd10 attribute in all-packages.nix.

doronbehar avatar Sep 27 '23 13:09 doronbehar

Has anyone gotten navigation2 to build? just checking if this is the same issue:

error: builder for '/nix/store/j161k57jy8mlgfrxybhqj6498n0ga61h-ros-iron-nav2-lifecycle-manager-1.2.7-r1.drv' failed with exit code 2;
       last 10 log lines:
       >    92 |     level = lvl;
       >       |     ~~~~~~^~~~~
       > /build/navigation2-release-release-iron-nav2_lifecycle_manager-1.2.7-1/src/lifecycle_manager.cpp: In member function 'void nav2_lifecycle_manager::LifecycleManager::CreateDiagnostic(diagnostic_updater::DiagnosticStatusWrapper&)':
       > /build/navigation2-release-release-iron-nav2_lifecycle_manager-1.2.7-1/src/lifecycle_manager.cpp:161:17: note: 'error_level' was declared here
       >   161 |   unsigned char error_level;
       >       |                 ^~~~~~~~~~~
       > cc1plus: all warnings being treated as errors

This sounds like issue a mentioned above: a) The following packages need to be compiled with -Wno-error=maybe-uninitialized: nav2-behaviors, nav2-constrained-smoother, nav2-planner, nav2-smoother, nav2-waypoint-follower, dwb-critics, dwb-plugins.

Maybe we need to add nav2-lifecycle-manager to this list.

thearthur avatar Apr 29 '24 22:04 thearthur

Some (if not all) these errors have already been fixed upstream, but probably are not yet released. The problem you mention can be addressed by this commit (in my branch).

If you apply it, you will see the other problems, which are addressed by https://github.com/open-navigation/navigation2/commit/fbec0fa68a23e8257e1420075745aba0735b07c4. You can apply the changes from that commit similarly as above. The complication is that the commit is a squashed commit and you need to split it to individual packages by adding stripLen and includes arguments to fetchpatch as shown below:

          (self.fetchpatch {
            url = "https://github.com/open-navigation/navigation2/commit/fbec0fa68a23e8257e1420075745aba0735b07c4.patch";
            stripLen = 1;
            includes = [ "*/subdir..../*" ];
            hash = "";
          })

Beware that the value of those arguments influences the hash.

To be honest, I'm not sure whether it is worth the effort. Especially if the package will be released with these fixes sometimes soon, it may be better to wait :-/. However, I don't use these packages and don't know what's their release policy.

wentasah avatar Apr 30 '24 19:04 wentasah