Colcon build error in px4_ros_com package for ros2 humble on ubuntu 22.04 - cmake

As specified in the title I am trying to build px4_ros_com for ros2 humble. I went through the px4 tutorial and followed it pretty closely, however when I colcon build px4_ros_com I get the following error
CMake Error at /home/XXXX/px4_ros_com_ros2/install/px4_msgs/share/px4_msgs/cmake/ament_cmake_export_targets-extras.cmake:18 (message):
Failed to find exported target names in
'/home/XXXX/px4_ros_com_ros2/install/px4_msgs/share/px4_msgs/cmake/export_px4_msgs__rosidl_generator_cExport.cmake'
Call Stack (most recent call first):
/home/XXXX/px4_ros_com_ros2/install/px4_msgs/share/px4_msgs/cmake/px4_msgsConfig.cmake:41 (include)
CMakeLists.txt:24 (find_package)
Any help would be appreciated!
I made sure of the following:
Fast-RTPS-Gen is version 1.0.4
Java version is 11.0.17
ros2 is sourced

This was a bug in ament_cmake that was fixed in the most recent version of ament_cmake (1.3.3).
Make sure you upgrade your packages with:
apt update
apt upgrade
After upgrading, check your ament_cmake version with:
ros2 pkg xml ament_cmake | grep version
If you see the following, or a newer version, this bug should be fixed:
<version>1.3.3</version>

Related

ROS2 colcon build failure

Win10 x64, ROS 2 - Humble, VS 2019
I'm going through the ROS beginners tutorials but I've run into problem building packages with colcon and got as far as the Using colcon to build packages tutorial.
I'm running as admin from a VS 2019 command line, I sourced ros2 by running the local_setup.bat file. I installed the colcon extensions, downloaded the examples & set up the directory structure as outlined in the tutorial.
I then tried to build colcon using colcon build --symlink-install --merge-install
Which after installing a few packages complains & aborts the build with,
--- stderr: examples_rclcpp_minimal_publisher
Traceback (most recent call last):
File "C:\ROS_Humble\ros2\share\ament_cmake_core\cmake\core\package_xml_2_cmake.py", line 22, in <module>
from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at C:/ROS_Humble/ros2/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
execute_process(C:/ProgramData/Anaconda3/python.exe
C:/ROS_Humble/ros2/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
D:/ROS_scratch/dev/ros2_ws/src/examples/rclcpp/topics/minimal_publisher/package.xml
D:/ROS_scratch/build/examples_rclcpp_minimal_publisher/ament_cmake_core/package.cmake)
returned error code 1
Call Stack (most recent call first):
C:/ROS_Humble/ros2/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
C:/ROS_Humble/ros2/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml)
CMakeLists.txt:47 (ament_lint_auto_find_test_dependencies)
Anyone know what this is about? I've seen a few posts around about people not sourcing ros2 in the right environment but that isn't the issue here.
I would start by trying to obtain the catkin_pkg module and making sure it's installed, based on:
ModuleNotFoundError: No module named 'catkin_pkg'
Apparently this should do the trick: pip install -U catkin_pkg
If that doesn't help then I will update my answer with hints on how to debug this to get more information for us.

Building OSRM on Ubuntu, CMake fails with "Intel TBB NOT found!" message

I am following this tutorial to build OSRM-backend from source.
When it says:
cd build
cmake /srv/osrm/osrm-backend/
I got this error message:
ERROR: Intel TBB NOT found!
-- Looked for Threading Building Blocks in /usr
CMake Error at cmake/FindTBB.cmake:274 (message):
Could NOT find TBB library.
Call Stack (most recent call first):
CMakeLists.txt:533 (find_package)
I have installed TBB:
sudo apt install -y libtbb
And it looks good:
/usr/lib/x86_64-linux-gnu/libtbb.so
/usr/lib/x86_64-linux-gnu/libtbb.so.2
(...)
But cmake fails.
I'd go to the file from the error message and see that it can't find the library at some default paths.
It means we have to help cmake a bit. At the beginning we can see that this module respects TBB_INSTALL_DIR. So I'd try setting it while configuring the project.
It's hard to find the solution, althought, it says, there're duplications:
This is a duplicate of #6248 and #6253. Building with
cmake -DENABLE_MASON=ON will fix it.
Surprisingly, on MacOS, there's a simple workaround:
brew install osrm-backend

Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)

I am trying to catkin_make in my catkin workspace, but I get the following error
CMake Deprecation Warning at gazebo_ros_demos/gazebo_tutorials/CMakeLists.txt:1
(cmake_minimum_required): Compatibility with CMake < 2.8.12 will be
removed from a future version of CMake.
Update the VERSION argument value or use a ... suffix to
tell CMake that the project does not need compatibility with older
versions.
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found Boost: /usr/include (found suitable version "1.58.0", minimum required is "1.40.0") found components: thread signals system
filesystem program_options regex iostreams date_time chrono atomic
CMake Error at
/usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230
(message): Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594
(_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.20/Modules/FindProtobuf.cmake:646
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/usr/lib/x86_64-linux-gnu/cmake/gazebo/gazebo-config.cmake:114
(FIND_PACKAGE) gazebo_ros_demos/gazebo_tutorials/CMakeLists.txt:11
(find_package)
-- Configuring incomplete, errors occurred! See also "/home/ashwin/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also
"/home/ashwin/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:5582: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1 Invoking "make
cmake_check_build_system" failed
This issue came up when I tried to update my cmake to 3.20. I am fairly new to Ubuntu. Would appreciate any help.
I have encountered the same issue (on ubuntu 18.04). Installing the following packages resolved the issue for me:
sudo apt-get install libprotobuf-dev protobuf-compiler
These are similar to the packages mentioned by K.S., but with those packages I got the same error as Ashwin mentioned in the comments on K.S.'s answer.

CMake io2d error missing CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES

I'm trying to follow the steps on this link:https://github.com/cpp-io2d/P0267_RefImpl/blob/master/BUILDING.md
to install io2d.
However I get an error message after I write the cmake ..:
C:\Users\walid\Desktop\Udacity_Nanodegree\RoutePlanningProject\build>cmake ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
CMake Error at CMakeLists.txt:15 (find_package):
By not providing "Findio2d.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "io2d", but
CMake did not find one.
Could not find a package configuration file provided by "io2d" with any of
the following names:
io2dConfig.cmake
io2d-config.cmake
Add the installation prefix of "io2d" to CMAKE_PREFIX_PATH or set
"io2d_DIR" to a directory containing one of the above files. If "io2d"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "C:/Users/walid/Desktop/Udacity_Nanodegree/RoutePlanningProject/build/CMakeFiles/CMakeOutput.log".
Therefore I found this suggestion On StackOverflow:
CMake third-party library installation
But I get a new error message here it is:
cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
Default IO2D backend was not specified, choosing automatically...
Found Windows, using CAIRO_WIN32.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at C:/CMake/cmake-3.17.3-win64-x64/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Cairo (missing: CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES)
Call Stack (most recent call first):
C:/CMake/cmake-3.17.3-win64-x64/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
cmake/FindCairo.cmake:102 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
P0267_RefImpl/P0267_RefImpl/cairo/CMakeLists.txt:5 (find_package)
PS: I'm using Windows, I have CMake,Make,g++ and gcc installed.
Here is a screenshot demonstrating that I have Cairo already installed:

Problem with WEBP and LENSFUN when installing 'darktable' from source using cmake

I'm trying to install darktable from source. To this end,
I downloaded darktable-2.4.4.tar.xz from here. After unpacking I try to build it with
sudo ./build.sh
I get the following errors:
(...)
-- Checking for one of the modules 'libsoup-2.2;libsoup2'
-- Could NOT find WEBP (missing: WEBP_LIBRARY WEBP_INCLUDE_DIR) (Required is at least version "0.3.0")
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find LENSFUN (missing: LENSFUN_LIBRARY LENSFUN_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindLensFun.cmake:37 (find_package_handle_standard_args)
src/CMakeLists.txt:286 (find_package)
However, both WEBP and LENSFUN are installed.
sudo apt-get install webp
Reading package lists... Done
Building dependency tree
Reading state information... Done
webp is already the newest version (0.6.1-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
LENSFUN was installed from source.
It's worth mentioning build.sh uses cmake.
What can I do to solve these problems?