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

Problem with CMake and rosserial_arduino

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

cnhzcy14 gravatar image

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

Kevin gravatar image

Hi guys,

When I'm trying to go through this tutorial in my OS X 10.6: http://www.ros.org/wiki/rosserial_arduino/Tutorials/CMake

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)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_find_ros_package(rosserial_arduino)
set(ARDUINO_SDK_PATH /Applications/Arduino.app/Contents/Resources/Java)
include(${rosserial_arduino_PACKAGE_PATH}/cmake_scripts/rosserial.cmake)
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
generate_ros_firmware(${FIRMWARE_NAME})

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

[  6%] Building CXX object CMakeFiles/uno_CORE.dir/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.cpp.o
make[3]: avr-g++: No such file or directory
make[3]: *** [CMakeFiles/uno_CORE.dir/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.cpp.o] 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
0

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

cnhzcy14 gravatar image

Still have problem. I tried the tutorial and CMake scripts from original arduino_cmake: https://github.com/queezythegreat/arduino-cmake">https://github.com/queezythegreat/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/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.cpp.o] 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

/Applications/Arduino.app/Contents/Resources/Java
edit flag offensive delete link more
1

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

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

Comments

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 -0500 )edit
0

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

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

Comments

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

Question Tools

Stats

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

Seen: 1,115 times

Last updated: Nov 23 '11