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

"'rcl_timer_init2’ was not declared in this scope" error during initial Colcon build; Build failed #393

Closed
NikolaZgonjanin opened this issue Sep 19, 2023 · 5 comments

Comments

@NikolaZgonjanin
Copy link

  • Hardware description: Personal Computer (VM)
  • Installation type: Cloned from GitHub
  • Version or commit hash: Humble (7af2054)

Steps to reproduce

  1. Install ROS 2 Humble following the official DOCS
  2. Source the ROS distribution
  3. Make a new workspace (ros_ws; In example rclc_ws)
  4. Build using Colcon
  5. Git Clone the repository into the workspace
  6. Build using Colcon

Expected behavior

The workspace builds with no errors

Actual behavior

After entering colcon build command for the second time, the error log bellow is shown and the build fails

nikola@local:~/rclc_ws$ colcon build
Starting >>> rclc    
--- stderr: rclc                             
/home/nikola/rclc_ws/rclc/rclc/src/rclc/timer.c: In function ‘rclc_timer_init_default2’:
/home/nikola/rclc_ws/rclc/rclc/src/rclc/timer.c:36:18: warning: implicit declaration of function ‘rcl_timer_init2’; did you mean ‘rcl_timer_init’? [-Wimplicit-function-declaration]
   36 |   rcl_ret_t rc = rcl_timer_init2(
      |                  ^~~~~~~~~~~~~~~
      |                  rcl_timer_init
/home/nikola/rclc_ws/rclc/rclc/test/rclc/test_executor.cpp: In member function ‘virtual void TestDefaultExecutor::SetUp()’:
/home/nikola/rclc_ws/rclc/rclc/test/rclc/test_executor.cpp:575:7: error: ‘rcl_timer_init2’ was not declared in this scope; did you mean ‘rcl_timer_init’?
  575 |       rcl_timer_init2(
      |       ^~~~~~~~~~~~~~~
      |       rcl_timer_init
gmake[2]: *** [CMakeFiles/rclc_test.dir/build.make:191: CMakeFiles/rclc_test.dir/test/rclc/test_executor.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:188: CMakeFiles/rclc_test.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
---
Failed   <<< rclc [1.22s, exited with code 2]

Summary: 0 packages finished [1.38s]
  1 package failed: rclc
  1 package had stderr output: 

Additional information

Changing the rcl_timer_init2 to rcl_timer_init in both ~/rclc_ws/rclc/rclc/src/rclc/timer.c:36:18 and ~/rclc_ws/rclc/rclc/test/rclc/test_executor.cpp:575:7 did not resolve the issue.

Aditionally no info was found on this online hence why I'm opening up the issue.

Micro-ROS
When following the Micro-ROS tutorial there were no issues related to RCLC, but when trying to install just RCLC in a seperate workspace, this error occurs

@Zard-C
Copy link
Contributor

Zard-C commented Sep 19, 2023

Hi, I can't reperduce this compile error :

rclc git:(humble) colcon build 
Starting >>> rclc    
Finished <<< rclc [30.1s]                       
Starting >>> rclc_lifecycle
Starting >>> rclc_parameter
Finished <<< rclc_lifecycle [15.5s]                                                                      
Finished <<< rclc_parameter [30.7s]                           
Starting >>> rclc_examples
Finished <<< rclc_examples [12.5s]                            

Summary: 4 packages finished [1min 14s]

But I believe this error warning: implicit declaration of function ‘rcl_timer_init2’; did you mean ‘rcl_timer_init’? [-Wimplicit-function-declaration] is caused by the lasted commit of rclc: humble #387

@Zard-C
Copy link
Contributor

Zard-C commented Sep 19, 2023

could you info the commit hash of rcl? maybe rcl repo need to update.

@NikolaZgonjanin
Copy link
Author

How would I go about that? I can't find in the docs where it's located nor if there is a way to check the version. I'm presuming I have the latest one as I tested it on a freshly installed ROS2 Humble and it still gave me the error.

@Zard-C
Copy link
Contributor

Zard-C commented Sep 19, 2023

I see, please check your rclc branch, in humble branch, timer.c:

rcl_ret_t rc = rcl_timer_init(

but in 'rolling' it's
rcl_ret_t rc = rcl_timer_init2(
,
I believe that you're building rclc: rolling with distro humble
rclc checkout to humble and try again

@NikolaZgonjanin
Copy link
Author

That was it, thank you very much. I forgot to switch branches when cloning again, so full mistakes on me 😅

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