Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMPL on Rolling fails to build #311

Closed
werner291 opened this issue Oct 3, 2023 · 11 comments
Closed

OMPL on Rolling fails to build #311

werner291 opened this issue Oct 3, 2023 · 11 comments

Comments

@werner291
Copy link

Hi, unfortunately this flake doesn't build:

{
  description = "My ROS Project Build Environment";
  nixConfig.bash-prompt = "[ros] ";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay";
  };

  outputs = { self, nixpkgs, nix-ros-overlay }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; overlays = [ nix-ros-overlay.overlays.default ]; };
    in
    {
      devShells.x86_64-linux.default = pkgs.mkShell {
        name = "My ROS Project Build Environment";
        buildInputs = with pkgs; with pkgs.rosPackages.rolling; [
#           moveit-core
# #           eigen3
#           jsoncpp
#           fcl
#           boost
#           bullet
#           ompl
#           range-v3
#           qhull
#           cgal
#           ament-cmake
#           rclcpp
#           moveit-msgs
#           moveit-ros-planning
          moveit-planners-ompl
#           shape-msgs
        ];
      };
    };
}

Here's my lockfile: flake.lock

It fails with this error:

error: builder for '/nix/store/28yl58cy37igw9wzwgz4qs83dj7f1hji-ros-rolling-ompl-1.5.2-r3.drv' failed with exit code 1;
       last 10 log lines:
       > checking for references to /build/ in /nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3...
       > gzipping man pages under /nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3/share/man/
       > patching script interpreter paths in /nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3
       > stripping (with command strip and flags -S -p) in  /nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3/lib
       > Broken paths found in a .pc file! /nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3/lib/pkgconfig/ompl.pc
       > The following lines have issues (specifically '//' in paths).
       > 4:libdir=${prefix}//nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3/lib
       > It is very likely that paths are being joined improperly.
       > ex: "${prefix}/@CMAKE_INSTALL_LIBDIR@" should be "@CMAKE_INSTALL_FULL_LIBDIR@"
       > Please see https://github.com/NixOS/nixpkgs/issues/144170 for more details.
       For full logs, run 'nix log /nix/store/28yl58cy37igw9wzwgz4qs83dj7f1hji-ros-rolling-ompl-1.5.2-r3.drv'.
error: 1 dependencies of derivation '/nix/store/dvhm9c6gsfy0y0pw3jcaqiwbrn6nknig-ros-rolling-moveit-planners-ompl-2.8.0-r2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xspvdan026gqrycagfy5dffnyajlg75l-My-ROS-Project-Build-Environment-env.drv' failed to build
@werner291
Copy link
Author

Here's the file it's complaining about:

cat /nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3/lib/pkgconfig/ompl.pc
# This file was generated by CMake for ompl
prefix=/nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3
exec_prefix=${prefix}
libdir=${prefix}//nix/store/4jzs6xfbgs9xk71nlpz1wljvr1apwpj3-ros-rolling-ompl-1.5.2-r3/lib
includedir=${prefix}/include/ompl-1.5

Name: ompl
Description: The Open Motion Planning Library
Version: 1.5.2
Requires: eigen3 ode
Libs: -L${libdir} -lompl -L/nix/store/hz6hdj4d12da362chq3r8hhznlj6qnlj-flann-1.9.1/lib -L/nix/store/w208hh73hwj2nbn2yqmxiy1vplxnkz8d-lz4-1.9.4/lib -L/nix/store/xxydgbry9aqfvigg7qkzgb80ppi1qvb7-ode-0.16.4/lib -lboost_serialization -lboost_filesystem -lboost_system
Cflags: -std=c++14 -I${includedir} -I/nix/store/4yjad2mn8xnr1gc20bisyllgml8pl08g-boost-1.81.0-dev/include

@werner291
Copy link
Author

Commenting this to link the issues: NixOS/nixpkgs#144170

@werner291
Copy link
Author

Just ompl from Rolling and 23.05 instead of unstable; same issue:

{
  description = "My ROS Project Build Environment";
  nixConfig.bash-prompt = "[ros] ";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
    nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay";
  };

  outputs = { self, nixpkgs, nix-ros-overlay }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; overlays = [ nix-ros-overlay.overlays.default ]; };
    in
    {
      devShells.x86_64-linux.default = pkgs.mkShell {
        name = "My ROS Project Build Environment";
        buildInputs = with pkgs; with pkgs.rosPackages.rolling; [
#           moveit-core
# #           eigen3
#           jsoncpp
#           fcl
#           boost
#           bullet
#           ompl
#           range-v3
#           qhull
#           cgal
#           ament-cmake
#           rclcpp
#           moveit-msgs
#           moveit-ros-planning
#           moveit-planners-ompl
ompl
#           shape-msgs
        ];
      };
    };
}
warning: Git tree '/home/werner/workspace/Multigoal-Orchard-Drone-Planning-Library' is dirty
warning: updating lock file '/home/werner/workspace/Multigoal-Orchard-Drone-Planning-Library/flake.lock':
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/f5892ddac112a1e9b3612c39af1b72987ee5783a' (2023-09-29)
  → 'github:nixos/nixpkgs/32dcb45f66c0487e92db8303a798ebc548cadedc' (2023-09-30)
warning: Git tree '/home/werner/workspace/Multigoal-Orchard-Drone-Planning-Library' is dirty
error: builder for '/nix/store/c8nawz7rzv9zz16wdi4f1ywpc5y12dh9-ros-rolling-ompl-1.5.2-r3.drv' failed with exit code 1;
       last 10 log lines:
       > checking for references to /build/ in /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3...
       > gzipping man pages under /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/share/man/
       > patching script interpreter paths in /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3
       > stripping (with command strip and flags -S -p) in  /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/lib
       > Broken paths found in a .pc file! /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/lib/pkgconfig/ompl.pc
       > The following lines have issues (specifically '//' in paths).
       > 4:libdir=${prefix}//nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/lib
       > It is very likely that paths are being joined improperly.
       > ex: "${prefix}/@CMAKE_INSTALL_LIBDIR@" should be "@CMAKE_INSTALL_FULL_LIBDIR@"
       > Please see https://github.com/NixOS/nixpkgs/issues/144170 for more details.
       For full logs, run 'nix log /nix/store/c8nawz7rzv9zz16wdi4f1ywpc5y12dh9-ros-rolling-ompl-1.5.2-r3.drv'.
error: 1 dependencies of derivation '/nix/store/wj6svbwnjvy1gjk0xy4svdbvmibl86c0-My-ROS-Project-Build-Environment-env.drv' failed to build

@werner291
Copy link
Author

pkgs.rosPackages.foxy.ompl is affected too.

@werner291
Copy link
Author

werner291 commented Oct 3, 2023

Related? ompl/ompl#1101 (Yes, I see lopsided98 commented on it.)

@werner291
Copy link
Author

Yup, that PR fixes the issue. This flake builds correctly:

{
  description = "My ROS Project Build Environment";
  nixConfig.bash-prompt = "[ros] ";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
    nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay";
  };

  outputs = { self, nixpkgs, nix-ros-overlay }:
  let
    system = "x86_64-linux";
    pkgs = import nixpkgs { inherit system; overlays = [ nix-ros-overlay.overlays.default ]; };
  in
  {
    devShells.x86_64-linux.default = pkgs.mkShell {
      name = "My ROS Project Build Environment";
      buildInputs = with pkgs; with pkgs.rosPackages.rolling; [
        (pkgs.rosPackages.rolling.ompl.overrideAttrs(oldAttrs: {
          src = builtins.fetchGit {
            url = "https://github.com/hacker1024/ompl.git";
            rev = "1ddecbad87b454ac0d8e1821030e4cf7eeff2db2";
            allRefs = true;
          };
        }))
      ];
    };
  };
}

@hacker1024
Copy link
Contributor

hacker1024 commented Oct 4, 2023

It's often more convenient to apply the commit as a patch - that way, the sources will always be up-to-date.

ompl.overrideAttrs ({ patches ? [ ], ... }: {
  patches = patches ++ [
    # Use full install paths for pkg-config
    (self.fetchpatch {
      url = "https://github.com/hacker1024/ompl/commit/1ddecbad87b454ac0d8e1821030e4cf7eeff2db2.patch";
      hash = "sha256-sAQLrWHoR/DhHk8TtUEy8E8VXqrvtXl2BGS5UvElJl8=";
    })
  ];
});

@werner291
Copy link
Author

werner291 commented Oct 4, 2023

Oh, a patch, that's cool.

Here's the overlay that pulls in your PR commit, just because I already had it:

# See: https://github.com/lopsided98/nix-ros-overlay/issues/311

self: super:

let
  myOmpl = super.rosPackages.rolling.ompl.overrideAttrs (oldAttrs: {
    src = builtins.fetchGit {
      url = "https://github.com/hacker1024/ompl.git";
      rev = "1ddecbad87b454ac0d8e1821030e4cf7eeff2db2";
    };
  });
in
{
  rosPackages = super.rosPackages // {
    rolling = super.rosPackages.rolling // {
      ompl = myOmpl;
    };
  };
}

Perhaps better to use the patch, though.

@werner291
Copy link
Author

Wait, how do I use that?

I'm actually trying to use moveit-planners-ompl which depends on ompl. I figured that applying the overlay like I'm doing would override the ompl being pulled in here, but... it isn't?

error: builder for '/nix/store/c8nawz7rzv9zz16wdi4f1ywpc5y12dh9-ros-rolling-ompl-1.5.2-r3.drv' failed with exit code 1;
       last 10 log lines:
       > checking for references to /build/ in /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3...
       > gzipping man pages under /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/share/man/
       > patching script interpreter paths in /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3
       > stripping (with command strip and flags -S -p) in  /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/lib
       > Broken paths found in a .pc file! /nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/lib/pkgconfig/ompl.pc
       > The following lines have issues (specifically '//' in paths).
       > 4:libdir=${prefix}//nix/store/8kxzs91f4zsnb0vwjbwwc1zcpbrkd2sv-ros-rolling-ompl-1.5.2-r3/lib
       > It is very likely that paths are being joined improperly.
       > ex: "${prefix}/@CMAKE_INSTALL_LIBDIR@" should be "@CMAKE_INSTALL_FULL_LIBDIR@"
       > Please see https://github.com/NixOS/nixpkgs/issues/144170 for more details.
       For full logs, run 'nix log /nix/store/c8nawz7rzv9zz16wdi4f1ywpc5y12dh9-ros-rolling-ompl-1.5.2-r3.drv'.
error: 1 dependencies of derivation '/nix/store/dxy85ns0jpryl076ahl929va4jywqz3z-ros-rolling-moveit-planners-ompl-2.8.0-r2.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-ros-rolling-geometry-msgs-5.2.0-r1.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/vvgzlbpaj3pnna2kicsd0yyaalwc5nhw-My-ROS-Project-Build-Environment-env.drv' failed to build

@werner291
Copy link
Author

werner291 commented Oct 4, 2023

This so far seems to not crash? (Compiling is taking a while.) I figured that overriding the package in the overlay would get moveit to import the new version; quess I had to override it explicitly.

# See: https://github.com/lopsided98/nix-ros-overlay/issues/311

self: super:

let
  myOmpl = super.rosPackages.rolling.ompl.overrideAttrs ({ patches ? [ ], ... }: {
    version="Fix patch";
    patches = patches ++ [
      # Use full install paths for pkg-config
      (self.fetchpatch {
        url = "https://github.com/hacker1024/ompl/commit/1ddecbad87b454ac0d8e1821030e4cf7eeff2db2.patch";
        hash = "sha256-sAQLrWHoR/DhHk8TtUEy8E8VXqrvtXl2BGS5UvElJl8=";
      })
    ];
  });
in
{
  rosPackages = super.rosPackages // {
    rolling = super.rosPackages.rolling // {
      ompl = myOmpl;
      moveit-planners-ompl = super.rosPackages.rolling.moveit-planners-ompl.override { ompl = myOmpl; };
    };
  };
}

Yup, this compiles!

@lopsided98
Copy link
Owner

The patch is now applied in the overlay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants