Building AVR-Ada-1.2.2 on Mac OSX (Lion+)

Look for the file AVR-Ada-README for the procedure at:


The associated script files, README and patches are available by:

git clone https://github.com/ve3wwg/avr.git

The following is a wiki-fied version of that documentation. The git repo README file should be checked for the latest in corrections/improvements.


This document describes the steps necessary for building AVR-Ada on Mac OSX (Lion+). With a few exceptions, this procedure applies also to Linux generally.

This area of the repository also provides some patches and scripts that will simplify your task.

The *.sh files and *.myconf files will require you to edit them prior to use.


HAVE TIME: If you're in a hurry, then you're destined to do this procedure more than once! Block off about two hours of steady time so that you don't miss a step. This procedure is lengthy, detailed and prone to error. One mistake will ruin the result.

USE ONE SESSION: The environment (PATH) is critical to the success of this build procedure. If you switch windows often, log out and then log back in, leaves you vulnerable to forgetting to restore the correct environment.

WORK FROM A CHECK LIST: You may want to print the procedure out so that you can check off each item as it is done. It is very easy to miss a step, and all steps are critical to your success.


You need a native Ada compiler to build an Ada compiler (cross or native). These days it is trivial on most distributions of Linux. For Mac OSX users, this can be a problem.

Thankfully, there is a binary download available here, should you need it:



Assuming that you have a working native Ada compiler, there are some other prerequisites.

For OSX users, it is assumed, that you have already install many great GNU tools from the macports collection (or equivalent). Linux users will simply install packages as required.

Packages/Tools Needed:

  • awk or gawk
  • GNU binutils
  • gzip version 1.2.4+ or bzip2 version 1.0.2+
  • GNU make version 3.80+ (must be GNU make)
  • GNU tar version 1.14+
  • Perl version 5.6.1+
  • zip and unzip - (for libgcj, the GCJ runtime).
  • GMP - GNU Multiple Precision Library (GMP) version 4.3.2+
  • MPFR - MPFR Library version 2.4.2+

Also make sure a reasonably current version of these are installed:

  • autoconf
  • automake
  • bison
  • bzip2
  • coreutils
  • dejagnu
  • flex
  • gmake
  • gnutls
  • gzip
  • libmpc
  • libtool
  • m4
  • makedepend
  • mpc
  • gmp (mentioned above)
  • mpfr (mentioned above)
  • perl5.12+
  • zlib

For Linux users, make sure that all libraries have the "development" package installed. The development packages include the installation of the C/C++ include files.


There are FOUR main packages required to build AVR-Ada:

  1. Binutils
  2. GCC
  3. AVR-Libc
  4. AVR-Ada

The versions used in this document are:

  1. binutils-2.20.1.tar.bz2
  2. gcc-4.7.2.tar.bz2
  3. avr-libc-1.8.0.tar.bz2
  4. avr-ada-1.2.2.tar.bz2

These will be installed in the order listed.


The packages required are tightly coupled to the AVR-Ada project itself. If you are upgrading to a newer version than 1.2.2, then download that package and unpack it to determine which GCC and Binutils you need.

  1. tar xjvf avr-ada-9.9.9.tar.bz2
  2. cd ./avr-ada-9.9.9
  3. ls patches/binutils

In AVR-Ada-1.2.2 this shows only 2.20.1 as an option.

ls patches/gcc:

AVR-Ada-1.2.2 only shows 4.7.2 as an option.

Check for new subdirectories in ./patches for other requirements in the future.

OSX/Linux Build Procedure

  1. [OSX_binutils|Binutils Build and Install]
  2. [OSX_workaround|OSX libiconv work-around]
  3. [OSX_avrgcc|AVR-GCC Build and Install]
  4. [OSX_avrlibc|AVR-libc Build and Install]
  5. [OSX_avrada|AVR-Ada Build and Install]
  6. [OSX_undo|OSX libiconv restore]
  7. [OSX_linkerr|Link error (crtm168.o)]
  8. [OSX_tweaks|AVR-Ada Tweaks]

Reminder: Don't forget to reinstate the libiconv and libintl libraries for Mac OSX builds. If you forget, this may create problems for your macport updates.


Wiki: OSX_avrada|AVR-Ada Build and Install
Wiki: OSX_avrgcc|AVR-GCC Build and Install
Wiki: OSX_avrlibc|AVR-libc Build and Install
Wiki: OSX_binutils|Binutils Build and Install
Wiki: OSX_linkerr|Link error (crtm168.o)
Wiki: OSX_tweaks|AVR-Ada Tweaks
Wiki: OSX_undo|OSX libiconv restore
Wiki: OSX_workaround|OSX libiconv work-around