Required package not found while building 'mav_trajectory_generation' during catkin build.
I'm trying to get the example described in the main README file working. I'm inside a docker container on ubuntu 20.02 focal. I'm using the ros-noetic-robot container file to start with. After getting catkin working, and all prereqs installed, i manged to get through the build process, up until the 'mav_trajectory_generation' step. Then I get a somewhat unhelpful message about a missing package;
...
Starting >>> eigen_checks
Finished <<< geo_controller [ 0.3 seconds ]
Finished <<< eigen_checks [ 0.2 seconds ]
Starting >>> mav_trajectory_generation
___________________________________________________________________________________________________
Errors << mav_trajectory_generation:cmake /catkin_ws/logs/mav_trajectory_generation/build.cmake.004.log
CMake Warning (dev) at CMakeLists.txt:2 (project):
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The following variable(s) would be set to empty:
CMAKE_PROJECT_VERSION
CMAKE_PROJECT_VERSION_MAJOR
CMAKE_PROJECT_VERSION_MINOR
CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
CMakeLists.txt:19 (pkg_check_modules)
cd /catkin_ws/build/mav_trajectory_generation; catkin build --get-env mav_trajectory_generation | catkin env -si /usr/bin/cmake /catkin_ws/src/mav_trajectory_generation/mav_trajectory_generation --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/catkin_ws/devel/.private/mav_trajectory_generation -DCMAKE_INSTALL_PREFIX=/catkin_ws/install; cd -
...................................................................................................
Failed << mav_trajectory_generation:cmake [ Exited with code 1 ]
Failed <<< mav_trajectory_generation [ 1.0 seconds ]
Abandoned <<< multi_uav_simulator [ Unrelated job failed ]
[build] Summary: 8 of 10 packages succeeded.
[build] Ignored: 7 packages were skipped or are skiplisted.
[build] Warnings: None.
[build] Abandoned: 1 packages were abandoned.
[build] Failed: 1 packages failed.
[build] Runtime: 3.1 seconds total.
Up to this point, I was getting the occasional dependency errors (libtools), but they were easy to resolve. The error message made me think it was an issue with pulling/merging the dependency mentioned in the walkthrough, so I reran those steps, but the error persisted.
This is interesting.
When I initialized with wstool this seems to work perfectly (on Ubuntu 20.04). However, for the sake of reproduction, I followed this [1]; first installed rosdep (sudo apt install python3-rosdep2) and then initialized the directory with rosdep by running rosdep install --from-paths . --ignore-src --rosdistro noetic -yr. This led me to exactly the same error, and some additional complaints about it not being able to find tf and rospy. I then had to install using sudo apt-get install ros-noetic-rospy and sudo apt-get install ros-noetic-tf.
This led me to think rosdep resolve dependencies in a different way (it seems to check system-wide) than wstool [2]. To me it seems like this problem only occur if you have initialized using rosdep and dependencies are not installed system-wide, in which case you'll have to install the dependencies using apt-get. But, I doubt all the packages do have apt-get installations, e.g., rosdep couldn't find glog_catkin, which is a dependency to mav_trajectory_generation. Which might be the reason it's failing mav_trajectory_generation and not saying what exactly is missing.
[1] https://answers.ros.org/question/354964/cmake-error-a-required-package-was-not-found/ [2] https://answers.ros.org/question/267067/difference-between-wstool-and-rosdep/
@wpower12 Can you confirm this on a clean catkin_ws on Ubuntu 20.04 + Ros Noetic?
I also encountered this issue on Ubuntu 20.04, and simply installing the tf package using sudo apt install ros-noetic-tf solved this issue for me.