Essential Routines for Fundamental Astronomy
C Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


This is the source code repository for ERFA (Essential Routines for Fundamental Astronomy). ERFA is a C library containing key algorithms for astronomy, and is based on the SOFA library published by the International Astronomical Union (IAU).

ERFA is intended to replicate the functionality of SOFA (aside from possible bugfixes in ERFA that have not yet been included in SOFA), but is licensed under a three-clause BSD license to enable its compatibility with a wide range of open source licenses. Permission for this release has been obtained from the SOFA board, and is avilable in the LICENSE file included in this source distribution.

Differences from SOFA

This version of ERFA (v1.3.0) is based on SOFA version "20160503_a", with the differences outlined below.

ERFA branding

All references to "SOFA" in the source code have been changed to ERFA, and functions have the prefix era instead of iau.

C macro prefixes

All C macros used in ERFA are the same as their SOFA equivalents, but with an ERFA_ prefix to prevent namespace collisions.


ERFA includes smaller changes that may or may not eventually make it into SOFA, addressing localized bugs or similar smaller issues:

  • ERFA 1.4.0 and SOFA "20170420"
    • ERFA 1.4.0 adds the eraVersion and eraSofaVersion functions to determine the installed version of ERFA (and the SOFA version it is derived from).
    • ERFA 1.4.0 includes some bug fixes contributed to ERFA after 1.3.0 but before 1.4.0. These were incorporated (with modification) into SOFA "20170420" (without attribution) and hence these are not differences between ERFA and SOFA. (See and
  • ERFA 1.3.0 and SOFA "20160503_a"
    • There are no differences between ERFA 1.3.0 and SOFA "20160503_a".
  • ERFA 1.2.0 and SOFA "20150209_a"

Note that issues identified in ERFA should generally also be reported upstream to SOFA at

Building and installing ERFA

To build and install a released version of ERFA in your OS's standard location, simply do:

make install

If you want to run the tests to make sure ERFA built correctly, before installing do:

make check

For developers

If you are using a developer version from github, you will need to first do ./ before the above commands. This requires autoconf and libtool.

If you wish to build against the ERFA static library without installing, you will find it in $ERFAROOT/src/.libs/liberfa.a after running make.

Creating a single-file version of the source code

Alternatively, if you wish to bundle the ERFA source code with a separate package, you can use the script from the erfa-fetch repository to combine the ERFA source code into just two files: a erfa.c source file, and an erfa.h include file. You should run this script like this:

cd /path/to/erfa-source-code
python /path/to/erfa-fetch/ src -n erfa

If possible, however, it is recommended that you provide an option to use any copy of the ERFA library that is already installed on the system.

Travis build status

Cite As