You are here

Arduino Development on CentOS 5

You almost take it for granted that an  open source products work together seamlessly, but getting Arduino development to work on CentOS 5 is a pretty difficult undertaking.

If you want the easy way out, go to CentOS 6.   CentOS 5 came out in 2007 and back then Arduino was only 2 years old, so getting support for something two years old is a bit risky for a Linux distribution that is supposed to have some stability.

If you hell bent on CentOS 5 and have it in 64bit then you can download RPMs already build by blogger Philip and his site

http://utlw.blogspot.com/2011/08/arduino-on-centos-5.html

Need to give props where props are due, his site gave me hints of where to go to resolve me problems.

So if you are still here, I guess you are willing to go through the pain of installing Arduino Developement kit on CentOS5.

First off, you need a starting point, everyone builds their machines their own way, here is mine for this project

http://www.apolonio.com/node/22

Next is a link to the official site (I think its official)

http://arduino.cc/playground/Linux/All

The first line is so important

First of all, install sun-java, avr-gcc (aka "gcc-avr"), avr-gcc-c++, avr-libc.

I just installed the stock Java (which works) and ignored these instructions just went and installed arduino 1.0, it launched, but I could not compile because I did not have avr-gcc.

It took hours, but I finally figured out how to install avr-gcc, it worked but failed compiling because I was missing avr-libc.

So, in attempt to contribute back to the open source world, I give you these instructions.

The end goal is to be able to run the blink program on the board.

Install Java

This is the easiest, you can do this using yum

yum -y install java

Done

Install avr-gcc and avr-gcc-c++

Before you start you should create the user mockbuild (not required but gets rid of build warnings) and change to the /usr/src directory.

  1. useradd mockbuild
  2. cd /usr/src

This requires several packages to be downloaded, compiled and installed.  The source rpms are actually decompressed and installed because for some reason there is an MD5 checksum error I have not been able to identify why.  These are the packages that need to be installed and in that order.

  • gmp 4.3.2
  • mpfr 3.0.0
  • libmpc 0.9.1
  • avr-binutils 2.20-2
  • avr-gcc 4.6.1
  • avr-gcc-c++ 4.6.1

The first four packages require four steps each, the last two are combined into the same four steps.  The steps are basically

  1. Download Source RPM
  2. Install Source RPM
  3. Build Source RPM To Binary RPM
  4. Install Binary RPM

Once you have the binary RPM (which will be in /usr/src/redhat/RPMS/i386) you can copy them to a USB or network share so you don't have to download and compile later.

These steps assume you are in the /usr/src directory

gmp 4.3.2
Required by the other packages so it needs to go first, there is a 4.3.1 version out there that does not work with the upcoming packages.

  1. wget http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Everything/source/SRPMS/gmp-4.3.2-4.fc16.src.rpm
  2. rpm -ivh --nomd5 gmp-4.3.2-4.fc16.src.rpm
  3. rpmbuild -ba redhat/SPECS/gmp.spec
  4. rpm -Uvh redhat/RPMS/i386/gmp-4.3.2-4.i386.rpm redhat/RPMS/i386/gmp-devel-4.3.2-4.i386.rpm

mpfr 3.0.0

  1. wget http://download.fedora.redhat.com/pub/fedora/linux/releases/16/Everything/source/SRPMS/mpfr-3.0.0-4.fc15.src.rpm
  2. rpm -ivh --nomd5 mpfr-3.0.0-4.fc15.src.rpm
  3. rpmbuild -ba redhat/SPECS/mpfr.spec
  4. rpm -Uvh redhat/RPMS/i386/mpfr-3.0.0-4.i386.rpm redhat/RPMS/i386/mpfr-devel-3.0.0-4.i386.rpm

libmpc 0.9.1

  1. wget http://dl.fedoraproject.org/pub/fedora/linux/releases/16/Everything/source/SRPMS/libmpc-0.9-1.fc16.src.rpm
  2. rpm -ivh --nomd5 libmpc-0.9-1.fc16.src.rpm
  3. rpmbuild -ba redhat/SPECS/libmpc.spec
  4. rpm -Uvh redhat/RPMS/i386/libmpc-0.9-1.i386.rpm redhat/RPMS/i386/libmpc-devel-0.9-1.i386.rpm

avr-binutils 2.20-2

  1. wget http://download.fedora.redhat.com/pub/fedora/linux/updates/16/SRPMS/avr-binutils-2.20-2.fc16.src.rpm
  2. rpm -ivh --nomd5 avr-binutils-2.20-2.fc16.src.rpm
  3. rpmbuild -ba redhat/SPECS/avr-binutils.spec
  4. rpm -ivh redhat/RPMS/i386/avr-binutils-2.20-2.i386.rpm

avr-gcc-4.6.1 and avr-gcc-c++-4.6.1

  1. wget http://download.fedora.redhat.com/pub/fedora/linux/releases/16/Everything/source/SRPMS/avr-gcc-4.6.1-3.fc16.src.rpm
  2. rpm -ivh --nomd5 avr-gcc-4.6.1-3.fc16.src.rpm
  3. rpmbuild -ba redhat/SPECS/avr-gcc.spec
  4. rpm -ivh redhat/RPMS/i386/avr-gcc-4.6.1-3.i386.rpm redhat/RPMS/i386/avr-gcc-c++-4.6.1-3.i386.rpm

Install avr-libc 1.7

As of this writing 1.8 exists but I had problems with it so I dropped to the version available right before this which is avr-libc-1.7.2rc2252.tar.bz2.  These steps do not produce and RPM, the source RPMs I have found had some dependencies that were a pain.  I hit a point where I just decided to install from source.  Hopefully in the future I will produce steps to build the RPM.

For now the steps are download, decompress, configure, build, install

  1. wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.7.2rc2252.tar.bz2
  2. tar jxvf avr-libc-1.7.2rc2252.tar.bz2
  3. cd avr-libc-1.7.2rc2252
  4. ./configure --prefix=/usr --host=avr --build=`./config.guess`
  5. make
  6. make install

Install Arduino

There is no compile step here, simply download and unroll.  It can go in /usr/local or /opt or even some custom directory you want. I choose the /opt

  1. cd /opt
  2. wget http://files.arduino.cc/downloads/arduino-1.0-linux.tgz
  3. tar zxvf arduino-1.0-linux.tgz

One More Thing

Sorry, I know it seems like you are done, but the version of avrdude, which is used to upload code to the microcontroller, does not work with the glibc version that came with arduino.

So you will have to download, configure, build, and replace the version of avrdude that came with the arduino software.

  1. cd /usr/src
  2. wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.11.tar.gz
  3. tar zxvf avrdude-5.11.tar.gz
  4. cd avrdude-5.11
  5. ./configure
  6. make
  7. cat avrdude > /opt/arduino-1.0/hardware/tools/avrdude

Final Note

At this point you should be able to compile and upload code but as root.  Also you may not like the java IDE, there are solutions online to run as a normal user and to use the plain CLI for coding.  I will be working on my own docs in the future, for now, I am playing with what I got.

More Reading

Cut and Paste Goodness - Like to copy and paste into a putty window?  Go here, some may consider this the quick start option.

PreCompiled Install - Here is a page to make it super easy to install Arduino on CentOS 5 32bit.

Arduino Downloads - Page of MD5 sums and links to the original source as of this writing.

Originally published January 22, 2012 by Larry Apolonio

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer