ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Problem with CMake and rosserial_arduino

asked 2011-11-19 14:56:07 -0600

cnhzcy14 gravatar image

updated 2012-02-20 11:32:32 -0600

Kevin gravatar image

Hi guys,

When I'm trying to go through this tutorial in my OS X 10.6:

I have the ARDUINO_SDK_PATH-NOTFOUND problem mentioned, so I add set(ARDUINO_SDK_PATH <path_to_arduino_installation>) into my CMakeLists.txt. Here is the whole CMakeLists.txt:

cmake_minimum_required(VERSION 2.4.6)
set(ARDUINO_SDK_PATH /Applications/
set(FIRMWARE_NAME chatter)
set(${FIRMWARE_NAME}_BOARD uno)         # Arduino Target board
set(${FIRMWARE_NAME}_SRCS src/chatter.cpp )
set(${FIRMWARE_NAME}_PORT /dev/tty.usbmodem411)            # Serial upload port

But when I'm try to compile it, I have got the following error:

[  6%] Building CXX object CMakeFiles/uno_CORE.dir/Applications/
make[3]: avr-g++: No such file or directory
make[3]: *** [CMakeFiles/uno_CORE.dir/Applications/] Error 1
make[2]: *** [CMakeFiles/uno_CORE.dir/all] Error 2
make[1]: *** [CMakeFiles/chatter.dir/rule] Error 2
make: *** [chatter] Error 2

I know it cannot find avr-g++, but I have already point out the ARDUINO_SDK_PATH, so I think something is missing. I have no problem when I use Arduino IDE to do compile the same code. Do you guys know how to solve this problem? Thanks!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-11-23 02:06:20 -0600

cnhzcy14 gravatar image

Still have problem. I tried the tutorial and CMake scripts from original arduino_cmake:">

That works on my OS X. So I tried to look into these scripts. In original top CMakeLists.txt, there are two lines:

set(CMAKE_MODULE_PATH    ${CMAKE_SOURCE_DIR}/cmake/modules)  # CMake module search path
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Arduino.cmake) # Arduino Toolchain

But in rosserial.cmake in rosserial_arduino package, these two lines become:

set(CMAKE_MODULE_PATH    ${rosserial_arduino_PACKAGE_PATH}/cmake_scripts/modules)  # CMake module search path
include(${rosserial_arduino_PACKAGE_PATH}/cmake_scripts/toolchains/Arduino.cmake) # Arduino Toolchain

So I changed them into

set(CMAKE_MODULE_PATH    ${rosserial_arduino_PACKAGE_PATH}/cmake_scripts/modules)  # CMake module search path
set(CMAKE_TOOLCHAIN_FILE ${rosserial_arduino_PACKAGE_PATH}/cmake_scripts/toolchains/Arduino.cmake) # Arduino Toolchain

Now I have following error:

cc1plus: error: unrecognized command line option "-mmcu=atmega328p"
make[2]: *** [CMakeFiles/uno_CORE.dir/Applications/] Error 1
make[1]: *** [CMakeFiles/uno_CORE.dir/all] Error 2
make: *** [all] Error 2

I'm not a CMake guy, so is there anyone can help me to solve this problem? Thanks!

BTW the arduino installation path in OS X is

edit flag offensive delete link more

answered 2011-11-20 06:17:23 -0600

Lorenz gravatar image

You need to install avr-gcc and friends. Under Ubuntu, you can install everything as follows:

sudo apt-get install avr-libc avrdude
edit flag offensive delete link more


It will work on Ubuntu. But I'm using OS X. I have avr-libc avrdude installed by macports, but still have errors when compiling.
cnhzcy14 gravatar image cnhzcy14  ( 2011-11-22 02:12:10 -0600 )edit

answered 2011-11-22 02:19:36 -0600

fergs gravatar image

I don't know what the Arduino installation looks like on OSX, but on other platforms, the "hardware" folder is a top-level folder side by side with the Java stuff for the IDE. Have you tried removing the "Java" or "Resources/Java" parts of the path?

edit flag offensive delete link more


Thanks, I have tried, but it's not working.
cnhzcy14 gravatar image cnhzcy14  ( 2011-11-23 02:07:14 -0600 )edit

Question Tools


Asked: 2011-11-19 14:56:07 -0600

Seen: 1,104 times

Last updated: Nov 23 '11