Installing Arduino 0023 on Ubuntu 11.10 (Oneiric Ocelot)
November 24, 2011 18 Comments
I recently installed Ubuntu 11.10 on a old laptop to be used as a dedicated robotics machine (I’m hoping to play with MOOS or ROS in the near future), and the first thing I wanted to do was install the latest Arduino IDE (0023). A quick look in the Ubuntu repository told me that the latest package for Ubuntu is the older 0022 version, so I decided to install the software directly from the Arduino website. It turns out that this process is not as ‘point-and-click’ at it should be, so I decided to document the installation process.
First, download and extract the Linux version of the Arduino software from the Arduino website. I’m using the 32 bit version and I extracted it to /home/matt/arduino-0023
I then tried to launch the IDE but received an errror about missing Java. Oh yeah, this is a new install of Ubuntu, I guess I need to install Java.
sudo apt-get install openjdk-7-jre
OK, now the IDE launches properly. I tried to compile Blink and immediately received a complaint about a missing compiler.
“Cannot run program “avr-g++”:j ava.io.IOException:Error=2: No such file or directory”
A quick Google search got me to this (somewhat outdated and only sort of correct) page on the Arduino site where I learned that I had to install the AVR C library and the AVR C cross-compiler. It also claimed to require the C++ compiler for AVR, but it seems that this package doesn’t exist (maybe it’s included in gcc-avr now?).
sudo apt-get install avr-libc gcc-avr
Let’s try compiling again. Surprise – a compilation error!
In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:44:0,
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token
Some more Google-fu pointed me to a solution here. Apparently the Arduino folks used their own implementation of the math function ’round’ as the old versions of the gcc-avr math.h library didn’t include one. The Arduino version of this function breaks the current gcc-avr math.h and needs to be commented out. I edited /home/matt/arduino-0023/hardware/arduino/cores/arduino/wiring.h (your path will vary based on your install location) and commented out this line (79):
// #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
One more compilation attempt, and…success, it builds! I then tested uploading code to a Duemilanove (appears as /dev/ttyUSB0) and an Uno (appears as /dev/ttyACM0). Both boards connected successfully. OK, time to write some code – I’ll be working on a servo controlled pan-tilt rig for a pair of webcams. Stay tuned for more on that project!