micro_ros_espidf_component icon indicating copy to clipboard operation
micro_ros_espidf_component copied to clipboard

rcl/rcl.h: No such file or directory

Open tianrking opened this issue 2 years ago • 14 comments

https://github.com/tianrking/ESP32_MicroROS

At one time I was able to compile in the old version but the current version gives this error. I'm sure the environment is clean, I've enabled the espidf environment and configured the environment variables, but I can't find rcl rcl.h

[100%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj /root/ESP32_MicroROS/main/main.c:11:10: fatal error: rcl/rcl.h: No such file or directory #include <rcl/rcl.h> ^~~~~~~~~~~ compilation terminated. make[2]: *** [esp-idf/main/CMakeFiles/__idf_main.dir/build.make:76: esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj] Error 1 make[1]: *** [CMakeFiles/Makefile2:4839: esp-idf/main/CMakeFiles/__idf_main.dir/all] Error 2 make: *** [Makefile:136: all] Error 2 make failed with exit code 2

tianrking avatar Apr 14 '23 06:04 tianrking

Could you provide the whole log on an clean environment?

pablogs9 avatar Apr 14 '23 08:04 pablogs9

A ran into the same problem. I figured out the problem (at least in my case).

  • Do not source ROS2 as stated in the readme!
  • If you had tried to build it with ROS2 sourced, make sure you remove the build folder and also run idf.py clean-microros
  • For me building libmicroros is failed with idf-4.2, I installed a fresh idf-4.4.4 and then the required python packages in a terminal where idf is sourced.
  • With the correct idf libmicroros build should be successful as well as the project. If not, check build output for details.

Digitelektro avatar Apr 27 '23 16:04 Digitelektro

Trying to build example/int32_publisher following the instructions in README.md. I have not sourced any of the ROS2 setup files. esp-idf-4.4.6. From a fresh clone, I get:

[ 99%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
/home/ffl/local/src/micro_ros_espidf_component/examples/int32_publisher/main/main.c:11:10: fatal error: rcl/rcl.h: No such file or directory
 #include <rcl/rcl.h>
          ^~~~~~~~~~~

flabrosse avatar Nov 27 '23 11:11 flabrosse

Maybe a hint on what is going on. Trying to make a simple example myself. If I clone today's version of the package (I guess defaulting to iron #d0e63d9), then I get the missing rcl/rcl.h issue. If I build from an older version (from about 2 years ago), then it is fine. Sorry this isn't more precise than that.

flabrosse avatar Nov 27 '23 13:11 flabrosse

Trying any of the branches of micro_ros_espidf_component, the whole of micro_ros_src folder is missing, ie is not pulled in by the build process, and therefore rcl.h (and others) is missing. If I use the component here then it all works fine. Apart from the obvious branch differences, I cannot see what makes one fail while the other works. It looks like the target $(EXTENSIONS_DIR)/micro_ros_src/src in libmicroros.mk is not executed, but so far I have not been able to figure out why.

flabrosse avatar Dec 25 '23 15:12 flabrosse

The reason the micro-ros-src (and other) folder is not pulled in is because the execute_process function in the CMakeLists.txt file fails. It fails because submake expands to $(MAKE) on Unix which either is not expanded further or not defined. If I set submake to make (or replace ${submake} with make in the execute_process command, then all the necessary files are pulled in.

I am not entirely sure why this is the case, but this works. Should MAKE be an environment variable? Can't submake be set to make all the time?

flabrosse avatar Jan 04 '24 16:01 flabrosse

@pablogs9 would you have views on this? I am happy to prepare a PR but I am not sure that just setting submake to make in all cases is the right approach.

I have tried to set MAKE in my environment, or to call idf.py build -DMAKE=make, to no avail.

flabrosse avatar Jan 11 '24 16:01 flabrosse

Please open a PR so we can discuss there about your proposed changes

pablogs9 avatar Jan 11 '24 16:01 pablogs9

Done (PR #223). I have worked on the humble branch as this is the one I use.

flabrosse avatar Jan 11 '24 16:01 flabrosse

hi guys , i will to create a new project not build a example how i do it !

Waelhechmi avatar Feb 27 '25 20:02 Waelhechmi

Hi @flabrosse and @pablogs9, I seem to still be getting this issue with the changed CMakeLists.txt file - I will try it in a ROS2 ubuntu docker (and on a macbook) but on my Ubuntu 22.04 desktop getting this issue trying to compile the int32 example. Any ideas?

fnndyl avatar May 15 '25 12:05 fnndyl

Same problem on MacOS as well hm. Trying to build int32_publisher.

fnndyl avatar May 15 '25 13:05 fnndyl

I have not updated my version of the code in a while, so I am not sure. Do you get the same error message?

flabrosse avatar May 15 '25 13:05 flabrosse

use the docker container of that repo .

Waelhechmi avatar May 16 '25 13:05 Waelhechmi