spotMicro icon indicating copy to clipboard operation
spotMicro copied to clipboard

catkin build error: redefinition of 'struct i2c_msg'

Open xiangee2022 opened this issue 2 years ago • 1 comments

When I run the "catkin build" command, the following error occurs, what is the cause? How to solve? Any help from you will be appreciated!

Errors << ubiquity_motor:make /home/ubuntu/catkin_ws/logs/ubiquity_motor/build.make.002.log In file included from /home/ubuntu/catkin_ws/src/ubiquity_motor/src/motor_hardware.cc:38:0: /usr/include/linux/i2c.h:68:8: error: redefinition of 'struct i2c_msg' struct i2c_msg { ^ In file included from /home/ubuntu/catkin_ws/src/ubiquity_motor/src/motor_hardware.cc:37:0: /usr/include/linux/i2c-dev.h:37:8: error: previous definition of 'struct i2c_msg' struct i2c_msg { ^ In file included from /home/ubuntu/catkin_ws/src/ubiquity_motor/src/motor_hardware.cc:38:0: /usr/include/linux/i2c.h:129:7: error: redefinition of 'union i2c_smbus_data' union i2c_smbus_data { ^ In file included from /home/ubuntu/catkin_ws/src/ubiquity_motor/src/motor_hardware.cc:37:0: /usr/include/linux/i2c-dev.h:89:7: error: previous definition of 'union i2c_smbus_data' union i2c_smbus_data { ^ make[2]: *** [CMakeFiles/ubiquity_motor.dir/src/motor_hardware.cc.o] Error 1 make[1]: *** [CMakeFiles/ubiquity_motor.dir/all] Error 2 make: *** [all] Error 2 cd /home/ubuntu/catkin_ws/build/ubiquity_motor; catkin build --get-env ubiquity_motor | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd - ...................................................................................................................................... Failed << ubiquity_motor:make [ Exited with code 2 ] Failed <<< ubiquity_motor [ 19.7 seconds ] Abandoned <<< magni_bringup [ Unrelated job failed ] Abandoned <<< magni_demos [ Unrelated job failed ] Finished <<< spot_micro_motion_cmd [ 1 minute and 21.9 seconds ] [build] Summary: 20 of 23 packages succeeded. [build] Ignored: 2 packages were skipped or are blacklisted. [build] Warnings: None. [build] Abandoned: 2 packages were abandoned. [build] Failed: 1 packages failed. [build] Runtime: 1 minute and 29.3 seconds total.

xiangee2022 avatar Nov 12 '22 12:11 xiangee2022

I found that removing the ubiquity_motor directory under the src directory can compile and pass. But I don't know if this will have any side effects.

xiangee2022 avatar Nov 12 '22 14:11 xiangee2022