nix-ros-overlay
nix-ros-overlay copied to clipboard
moveit_ompl_interface include dirs broken when using ament
When compiling a project that uses these lines in CMakeLists:
set(AMENT_DEPS "moveit_core" "moveit_msgs" "shape_msgs" "rclcpp" "ompl" "moveit_planners_ompl")
ament_target_dependencies(${PROJECT_NAME}_shared ${AMENT_DEPS})
I get the following error:
CMake Error in CMakeLists.txt:
Imported target "moveit_planners_ompl::moveit_ompl_interface" includes
non-existent path
"/nix/store/mg432iy0715cc7fylwg10bsdhsg4qy30-ros-rolling-moveit-planners-ompl-2.8.0-r2/include/moveit_planners_ompl"
I'm using the dev shell and suggested patch from #311
I can confirm that that directory doesn't exist, but the required headers are there:
ls /nix/store/mg432iy0715cc7fylwg10bsdhsg4qy30-ros-rolling-moveit-planners-ompl-2.8.0-r2/include/moveit_planners/moveit/ompl_interface/
detail model_based_planning_context.h ompl_interface.h parameterization planning_context_manager.h
I remember having issues with this even outside of NixOS (macOS at the time), but since they're showing up here we might as well.
Flake.nix:
{
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 (import ./replace-ompl.nix) ]; };
in
{
devShells.x86_64-linux.default = pkgs.mkShell {
name = "My ROS Project Build Environment";
buildInputs = with pkgs; with pkgs.rosPackages.rolling; [
moveit-core
moveit-planners-ompl
pythonPackages.matplotlib
pythonPackages.notebook
pythonPackages.numpy
pythonPackages.pandas
cmake
jsoncpp
range-v3
cgal
];
};
};
}
replace-ompl.nix:
# 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;
};
};
};
}