micro-ROS / micro_ros_stm32cubemx_utils

A set of utilities for integrating micro-ROS in a STM32CubeMX project
Apache License 2.0
174 stars 67 forks source link

undefined reference to `__sync_synchronize' #112

Open pdl0x0lbq opened 1 year ago

pdl0x0lbq commented 1 year ago

Hi,

I Get this error:
opt/st/stm32cubeide_1.13.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /home/ros/CLionProjects/csmr/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/libmicroros.a(librcutils-atomic_64bits.c.obj): in function `unlock_memory':
atomic_64bits.c:(.text+0xa0): undefined reference to `__sync_synchronize'
/opt/st/stm32cubeide_1.13.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /home/ros/CLionProjects/csmr/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/libmicroros.a(librcutils-atomic_64bits.c.obj): in function `__atomic_load_8':
atomic_64bits.c:(.text+0x11c): undefined reference to `__sync_synchronize'
/opt/st/stm32cubeide_1.13.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /home/ros/CLionProjects/csmr/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/libmicroros.a(librcutils-atomic_64bits.c.obj): in function `__atomic_store_8':
atomic_64bits.c:(.text+0x198): undefined reference to `__sync_synchronize'
/opt/st/stm32cubeide_1.13.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /home/ros/CLionProjects/csmr/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/libmicroros.a(librcutils-atomic_64bits.c.obj): in function `__atomic_exchange_8':
atomic_64bits.c:(.text+0x214): undefined reference to `__sync_synchronize'
/opt/st/stm32cubeide_1.13.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /home/ros/CLionProjects/csmr/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/libmicroros.a(librcutils-atomic_64bits.c.obj): in function `__atomic_fetch_add_8':
atomic_64bits.c:(.text+0x2a8): undefined reference to `__sync_synchronize'

How to resolve this error

pablogs9 commented 1 year ago

You can disable building atomic_64bits.c file here: https://github.com/micro-ROS/micro_ros_stm32cubemx_utils/blob/3819f6819cee1ff01c3da58ecbc8bfcbf4b0a2a5/microros_static_library_ide/library_generation/colcon.meta#L26C19-L26C40

pdl0x0lbq commented 1 year ago

You can disable building atomic_64bits.c file here: https://github.com/micro-ROS/micro_ros_stm32cubemx_utils/blob/3819f6819cee1ff01c3da58ecbc8bfcbf4b0a2a5/microros_static_library_ide/library_generation/colcon.meta#L26C19-L26C40

thank you very much

pdl0x0lbq commented 1 year ago

You can disable building atomic_64bits.c file here: https://github.com/micro-ROS/micro_ros_stm32cubemx_utils/blob/3819f6819cee1ff01c3da58ecbc8bfcbf4b0a2a5/microros_static_library_ide/library_generation/colcon.meta#L26C19-L26C40

Another error occurred /opt/st/stm32cubeide_1.13.1/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.linux64_1.1.0.202305231506/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: /home/ros/CLionProjects/csmr/micro_ros_stm32cubemx_utils/microros_static_library_ide/libmicroros/libmicroros.a(librcl-time.c.obj): in functionrcl_get_ros_time': time.c:(.text.rcl_get_ros_time+0xa): undefined reference to __atomic_load_8'

pablogs9 commented 1 year ago

That is the point that you need to have 64 bits atomics in your platform to use micro-ROS. If your native platform does not implement them nor is able to build the provided ones, you need to provide an implementation of __atomic_load_8