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

CMake Error at cmake/ROS2.cmake:85 (find_package) #10

Closed
JackPieCZ opened this issue May 29, 2024 · 10 comments
Closed

CMake Error at cmake/ROS2.cmake:85 (find_package) #10

JackPieCZ opened this issue May 29, 2024 · 10 comments

Comments

@JackPieCZ
Copy link

JackPieCZ commented May 29, 2024

Hi!
I am running Ubuntu Jammy (22.04) and Iron Irwini ROS.
When building, I encountered the following error:

desktop:~/event_camera_tools_ws$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo  # (optionally add -DCMAKE_EXPORT_COMPILE_COMMANDS=1)
Starting >>> event_camera_msgs
Starting >>> dvs_msgs
Starting >>> prophesee_event_msgs
Finished <<< event_camera_msgs [16.4s]
Starting >>> event_camera_codecs
Finished <<< prophesee_event_msgs [17.1s]
Finished <<< dvs_msgs [18.6s]
--- stderr: event_camera_codecs
CMake Error at cmake/ROS2.cmake:85 (find_package):
  By not providing "Findament_cmake_clang_format.cmake" in CMAKE_MODULE_PATH
  this project has asked CMake to find a package configuration file provided
  by "ament_cmake_clang_format", but CMake did not find one.

  Could not find a package configuration file provided by
  "ament_cmake_clang_format" with any of the following names:

    ament_cmake_clang_formatConfig.cmake
    ament_cmake_clang_format-config.cmake

  Add the installation prefix of "ament_cmake_clang_format" to
  CMAKE_PREFIX_PATH or set "ament_cmake_clang_format_DIR" to a directory
  containing one of the above files.  If "ament_cmake_clang_format" provides
  a separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:21 (include)


---
Failed   <<< event_camera_codecs [10.2s, exited with code 1]

Summary: 3 packages finished [27.0s]
  1 package failed: event_camera_codecs
  1 package had stderr output: event_camera_codecs
  1 package not processed

What could I do to mitigate this issue? Thank you very much in advance!

@berndpfrommer
Copy link
Collaborator

Bug on my side. The problem is a missing dependency in the package.xml, such that ament-cmake-clang-format is missing.
I just pushed a fix for it, but in a pinch this should fix the problem:

sudo apt install ros-iron-ament-cmake-clang-format

@berndpfrommer
Copy link
Collaborator

Hmm, actually not. The problem is that the build instructions are outdated. You may hit more errors. Let me fix the README

@JackPieCZ
Copy link
Author

Thank you for your fast reply!
I installed the ros-iron-ament-cmake-clang-format, and the mentioned error message disappeared.
However, a new one related to MovieMaker and cv::Mat::~Mat() showed up instead, which might be the one you are referring to. Thank you, and I'll wait for the README update

@berndpfrommer
Copy link
Collaborator

That one is unexpected. Please post error messages.

@berndpfrommer
Copy link
Collaborator

I updated the build instructions. They now refer to the common build instructions for ROS2 packages. I just tested building event_camera_tools on ROS2 humble/Ubuntu Jammy and it built without error. Should also build on ROS2 iron since that is tested by the automated build scripts.

@JackPieCZ
Copy link
Author

JackPieCZ commented May 29, 2024

Thank you, I followed the updated instructions. Unfortunately, the MovieMaker compile issues remain:

desktop::~/event_camera_tools_ws$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev
Starting >>> event_camera_msgs
Starting >>> dvs_msgs
Starting >>> prophesee_event_msgs
Finished <<< event_camera_msgs [3.46s]
Starting >>> event_camera_codecs
Finished <<< dvs_msgs [3.53s]
Finished <<< prophesee_event_msgs [3.71s]
Finished <<< event_camera_codecs [1.59s]
Starting >>> event_camera_tools
[Processing: event_camera_tools]
--- stderr: event_camera_tools
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `event_camera_tools::MovieMaker::~MovieMaker()':
/home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:26: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `event_camera_tools::MovieMaker::~MovieMaker()':
/home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:26: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `event_camera_tools::MovieMaker::resetImage(unsigned int, unsigned int)':
/home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:48: undefined reference to `cv::Mat::zeros(int, int, int)'
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `cv::MatExpr::~MatExpr()':
/mnt/c/Program Files/Prophesee/third_party/include/opencv2/core/mat.hpp:3554: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: /mnt/c/Program Files/Prophesee/third_party/include/opencv2/core/mat.hpp:3554: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: /mnt/c/Program Files/Prophesee/third_party/include/opencv2/core/mat.hpp:3554: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: /mnt/c/Program Files/Prophesee/third_party/include/opencv2/core/mat.hpp:3554: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: /mnt/c/Program Files/Prophesee/third_party/include/opencv2/core/mat.hpp:3554: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o:/mnt/c/Program Files/Prophesee/third_party/include/opencv2/core/mat.hpp:3554: more undefined references to `cv::Mat::~Mat()' follow
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `event_camera_tools::MovieMaker::writeImage(unsigned long, cv::Mat const&)':
/home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:57: undefined reference to `cv::imwrite(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
/usr/bin/ld: /home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:58: undefined reference to `cv::noArray()'
/usr/bin/ld: /home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:58: undefined reference to `cv::mean(cv::_InputArray const&, cv::_InputArray const&)'
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `event_camera_tools::MovieMaker::MovieMaker()':
/home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:26: undefined reference to `cv::Mat::Mat()'
/usr/bin/ld: CMakeFiles/movie_maker.dir/src/movie_maker_ros2.cpp.o: in function `event_camera_tools::MovieMaker::~MovieMaker()':
/home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:26: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: /home/kolarj55/event_camera_tools_ws/src/event_camera_tools/include/event_camera_tools/movie_maker.h:26: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: movie_maker: unable to sort relocs - they are of an unknown size
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/movie_maker.dir/build.make:217: movie_maker] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:285: CMakeFiles/movie_maker.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< event_camera_tools [46.1s, exited with code 2]

Summary: 4 packages finished [51.5s]
  1 package failed: event_camera_tools
  1 package had stderr output: event_camera_tools

As it seems to be related to Prophesee's mat.hpp, I will have a look at their docs to see if I find something useful.

@berndpfrommer
Copy link
Collaborator

Something funky is going on with opencv. It is getting pulled in from the wrong place.
From the looks of it you still have some references to your windows build there, no? Have you done a rm -rf build install log to get rid of your old build files?

@JackPieCZ
Copy link
Author

Yes. That was it! My bad. Thank you! The build was successful this time.
I assume that running tools for both ROS1 and ROS2 should be called with rosrun and rus2 run respectively, since installing rosrun on ROS2 using sudo apt install rosbash results in a conflict with python3-catkin-pkg.

However, when I try to run for example the ros2 run event_camera_tools raw_to_bag I get the following message:

desktop:~/event_camera_tools_ws$ ros2 run event_camera_tools raw_to_bag
Package 'event_camera_tools' not found

Is there something I am doing wrong?

@berndpfrommer
Copy link
Collaborator

after you successfully compiled you need to update your environment variables so ros can find the newly compiled packages.
This is done with:

cd ~/your_workspace
source ./install/setup.bash

@JackPieCZ
Copy link
Author

Oh, of course! Thank you very much for your time!

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

2 participants