micro-ROS / micro_ros_zephyr_module

micro-ROS Zephyr module and sample code
Apache License 2.0
56 stars 25 forks source link

rcutils/src/time_unix.c fails on foxy #105

Closed Bamelink closed 2 years ago

Bamelink commented 2 years ago

Time_unix.c fails

Steps to reproduce the issue

I have taken the folder "modules/libmicroros" from the foxy branch and added them to my application. When building, the following output happens:

/home/jan/zephyrproject/autonomous-system-controller/Software/application/modules/libmicroros/micro_ros_src/src/rcutils/src/time_unix.c:33:10: fatal error: posix/time.h: No such file or directory
   33 | #include <posix/time.h>  //  Points to Zephyr toolchain posix time implementation
      |          ^~~~~~~~~~~~~~

There the include path for Zephyr is wrong (at least for my tested versions 3.1.0 and 3.2.0). Is has to be

#include <zephyr/posix/time.h>

Changing this makes it compile and link without any error.

pablogs9 commented 2 years ago

COuld you test again from a clean environment? Ensure that rcutils package is downloaded again.

I have just backported https://github.com/ros2/rcutils/pull/390 to foxy.

Bamelink commented 2 years ago

It seems to only be applied to the "rolling" branch right?

If I rerun it, it clones branch foxy and there these changes do not apply and so it still gives me the same error. Porting these changes manually I can confirm it is working

pablogs9 commented 2 years ago

Be careful because we at micro-ROS use a fork: https://github.com/micro-ROS/rcutils/tree/foxy

Bamelink commented 2 years ago

But here the foxy branch also differs or am I missing something? If I look at humble here, everything is right, but foxy is missing the /zephyr part in the include

pablogs9 commented 2 years ago

Check the last commit in foxy branch. It is a cherry-pick of the commit that fixes your issue.

Bamelink commented 2 years ago

Then I guess I am missing something. But for me the foxy branch has the #if defined(ZEPHYR), but is missing the #if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(3, 1, 0). I tried both branches, humble and foxy, in a clean environment and foxy fails with the posix/time.h error while humble builds just fine

pablogs9 commented 2 years ago

... Sorry ... I did the backport locally and I did not push the changes...

Here you have: https://github.com/micro-ROS/rcutils/blob/foxy/src/time_unix.c

Bamelink commented 2 years ago

Can confirm, it is working now 👍🏼