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,
from /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37,
from /home/matt/arduino-0023/hardware/arduino/cores/arduino/wiring_private.h:30,
from /home/matt/arduino-0023/hardware/arduino/cores/arduino/WInterrupts.c:34:
/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!
Thanks mate! LIFESAVER!
No problem, glad to help!
Hi Matt, just posted in the Ubuntu and Arduino Forums but wanted to say that I tried your tutorial on my Arduino Uno and unfortunately, I didn’t get it to work 😦 (The IDE is really slow and doesn’t recognize the correct COM port).
Hey Kev, sorry to hear this. I’ve replied to your thread on the Ubuntu forum. Let’s continue this discussion there. http://ubuntuforums.org/showthread.php?p=11490885
Pingback: [ubuntu] Arduino and Ubuntu 11.10 | Coders & Admins
Thank you so much. This post is essential and should be available in Arduinos Playground
Thanks!!
Pingback: Installare Arduino 0023 su Ubuntu 11.10 (Oneric Ocelot) | Michele Maffucci
thanku so much……
THANK YOU SO MUCH!! YOU FUCKING ROCK!!
Pingback: Ubuntu 11.10, Arduino 0023 complie problem « xiaolabaDIY
Hey, I get so pissed everytime I use the arduino ide…I installed it from the ubuntu software center and everytime I want to do something like add a lib or edit files…i can’t and have to log out and log in as root to change anything…is there any way to set the permissions on the whole usr dir so I don’t hacve to do this….arrrrhghgh!
Sure, you can modify the permissions on any folder as long as you have root access. Look into the ‘chmod’ command.
chmod +w /path/to/arduino/librariesI probably wouldn’t add global write access to your whole /usr folder though…
You may also want to learn about the ‘su’ command – it allows you to switch to root without logging out and back in.
Pingback: [Solved] Arduino Saya Kok Error Saat Mengcompile? « Insan Sains Projects
i want to serial communicate arduino with the ubuntu 11.10…can any one help
No workie… I’m totally baffled over this. This morning I had it working. Uploaded the blink sketch to 3 different Uno’s, without problems. Then-POOF…. problems have come back. Cannot compile. I have tried different versions of Arduino IDE, some of which have no wiring.h file to edit. I succeeded earlier by running sudo ./arduino in a terminal. Not anymore! Any ideas?
Maybe I have a solution… I had changed the location of my sketchbook in preferences, and the Arduino IDE was looking for the file “wiring.h” in the wrong folder. Check that you have your sketchbook located in the same folder as your Arduino files.
Worked as expected on Ubuntu LTS 12.04, thank you!