micro-ROS / micro-ROS-demos

Sample code using rclc and rclcpp implementations.
Apache License 2.0
84 stars 24 forks source link

Build eror: undefined reference to 'printk' #35

Closed anaelle-sw closed 3 years ago

anaelle-sw commented 3 years ago

Hi! An error occurs when building micro_ros_demos_rclc package.

System:

I have tested the installation on two computers with this config above. One of these computers had micro_ros_agent already installed on it last month, with no problem. As the build error occured on the other computer, I wanted to test again the installation on the first computer. So I have deleted the micro-ros workspace and try to re-install micro_ros_agent on the first computer (the one that was ok before), unsuccessfully.

Steps to reproduce

I am following this tutorial, to install micro_ros_agent on my computer. I am building the micro_ros_demos_rclc package when executing: ros2 run micro_ros_setup build_firmware.sh.

Acutal behavior

I got an undefined reference to 'prink' build error. The complete log is:

--- stderr: micro_ros_demos_rclc                                                                 
/usr/bin/ld: CMakeFiles/addtwoints_server.dir/main.c.o: in function `main':
main.c:(.text+0xda): undefined reference to `printk'
/usr/bin/ld: main.c:(.text+0x12b): undefined reference to `printk'
/usr/bin/ld: main.c:(.text+0x182): undefined reference to `printk'
/usr/bin/ld: main.c:(.text+0x1d5): undefined reference to `printk'
/usr/bin/ld: main.c:(.text+0x22d): undefined reference to `printk'
/usr/bin/ld: CMakeFiles/addtwoints_server.dir/main.c.o:main.c:(.text+0x282): more undefined references to `printk' follow
collect2: error: ld returned 1 exit status
make[5]: *** [CMakeFiles/addtwoints_server.dir/build.make:128: addtwoints_server] Error 1
make[4]: *** [CMakeFiles/Makefile2:105: CMakeFiles/addtwoints_server.dir/all] Error 2
make[3]: *** [Makefile:141: all] Error 2
make[2]: *** [CMakeFiles/addtwoints_server.dir/build.make:112: addtwoints_server/src/addtwoints_server-stamp/addtwoints_server-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:471: CMakeFiles/addtwoints_server.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:141: all] Error 2

Thanks for helping!

pablogs9 commented 3 years ago

We just copied from the FreeRTOS examples... Solved here: https://github.com/micro-ROS/micro-ROS-demos/pull/36

Sorry for the inconvenience.

BTW we are working on the other issues, this week we will bring a solution.

anaelle-sw commented 3 years ago

Ok nice! Thanks! Do you want me to close this issue, or would you rather wait for the PR to be merged?

pablogs9 commented 3 years ago

Merged, closed.

Thanks!