Part 2: Compiling CODAS

Note

As of April 2013, this version of the documentation is no longer maintained; however, it is consistent with the last (now retired) version of CODAS processing that used Matlab. We no longer update or fix the Matlab processing code, but we will maintain the Matlab code that reads CODAS Matlab output. Although the notes refer to both Python and Matlab processing, none of the code here will be maintained. This (now retired) documentation and code will remain available for awhile longer.

Python processing code is actively maintained and developed, and CODAS Python processing is documented here.

You need a C compiler.

  • Linux : gcc is available as a standard package on every linux distribution; if it is not already installed, install it.

  • OSX : install the complete XCode Tools. It should be on your OSX installation DVD. It is also at http://developer.apple.com/tools/xcode/. This is is a huge download (1.1 GB), so do it when you have a good network connection.

  • Windows: we use Windows as little as possible and as simply as possible, so we do not use MS compilers. Instead, we use a Windows version of the standard free compiler, “gcc”.

    Note

    CODAS has been tested on XP and Window 7, but only 32bit packages can be installed at present.

    If you are using the Enthought Python Distribution and have followed the instructions in Installing Python and IPython, then skip now to How to compile; you should already have gcc and scons from EPD.

    We recommend the C-compiler installation from Equation Solution. The installer includes much more than gcc, but that is not a problem. Scroll down on the page to see the links. Choose a 32bit version of gcc. As of 2011/10/17, gcc 4.6 works with CODAS software.

    Now follow the next four steps:

    1. Download the package and install it.

    Let’s assume you install it in C:\gcc. (Do not install it in C:\Program Files or any other path with spaces.)

    1. Add the compiler location to your path.
    • Bring up the Windows Control Panel, select System, then click Advanced
    • you will be able to edit the system “PATH” environment variable.
    • Append ;C:\gcc\bin (or appropriate path) to it.
    • Note that the path variable is a set of paths separated by semicolons.
    1. We use a tool called Scons (see below) to manage the compilation. You must ensure that Scons will be able to find and identify the compiler.

    The Windows port of gcc is of a style called “mingw”; SCons will need to detect this by finding (but not actually running) a file called mingw32-gcc.exe. Assuming the installation was in C:\gcc, do this:

    • find C:\gcc\bin\gcc.exe
    • copy it (to the same folder)
    • rename it to C:\gcc\bin\mingw32-gcc.exe
    1. Now tell Python distutils what kind of compiler to use.

    If your Python is installed in C:\Python26, for example, put the contents below in the file C:\Python26\lib\distutils\distutils.cfg; or save the file from this link to that location.

    [build]
    compiler = mingw32
    

    Note

    Make sure your file is saved as distutils.cfg not distutils.cfg.txt! Windows tends to tack on spurious extensions without asking, and then fails to display the full filename with the added extension.

    There are other distributions of mingw. If you find a different one that you like, please tell us, and we may add it to this documentation. If you have problems, please find a Windows expert to sort them out; we cannot take on that role. If you discover things that would be useful to others if included in this documentation, again, tell us.

You need the build tool, scons

Scons is a build system. Together with scripts in codas3, it generates the many commands required to compile, link, and install codas3 with whatever C compiler is available, on whatever type of system you are working on. It is written in pure python so it is easy to install.

Note

On Windows, assuming you have python installed in C:\python26 you will need to make sure that C:\python26\scripts is on your system PATH

Bring up the Windows Control Panel, select System, then click Advanced, and you will be able to edit the system “PATH” environment variable. Append ;C:\Python26\scripts (or appropriate). Note that the path variable is a set of paths separated by semicolons.

How to compile

Compile codas3 first:

go to the codas3 directory and read “INSTALL.txt”. From that directory, you would typically compile as in these examples:

linux, 32-bit:

scons platform=lnx

linux, 64-bit:

scons platform=lnx64

OSX intel:

scons platform=osxintel

Windows:

scons platform=win32