0
$\begingroup$

Rosanswers logo

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!


Originally posted by cnhzcy14 on ROS Answers with karma: 58 on 2011-11-19

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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

sudo apt-get install avr-libc avrdude

Originally posted by Lorenz with karma: 22731 on 2011-11-20

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by cnhzcy14 on 2011-11-22:
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.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Still have problem. I tried the tutorial and CMake scripts from original 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

Originally posted by cnhzcy14 with karma: 58 on 2011-11-23

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.