Building Csound
Prev | Part I. Overview | Next

## Building Csound

Csound has become a complex project and can involve many dependencies. Unless you are a Csound developer or need to develop Csound plugins, you should try to use one of the precompiled distributions from http://www.sourceforge.net/projects/csound.

The latest Csound source code is available through the Concurrent Versions System (CVS)(http://www.cvshome.org). To download Csound sources using CVS, run the following commands:

        cvs -d:pserver:anonymous@csound.cvs.sourceforge.net:/cvsroot/csound login

        cvs -z3 -d:pserver:anonymous@csound.cvs.sourceforge.net:/cvsroot/csound co -P csound5

Information about accessing the CVS repository may be found in the SourceForge document Basic Introduction to CVS and SourceForge.net (SF.net) Project CVS Services.

If you wish to become a Csound developer, first obtain a SourceForge login, and then apply to John ffitch at the http://www.sourceforge.net/projects/csound site.

The procedure for building Csound 5 is briefly and incompletely outlined here.

The manual is built using make. Scripts are used for a few other tasks. However, this section focuses on the main Csound build system, which uses SCons, a Python program that replaces make for cross-platform configuration and building.

(Alternatively, for building a minimal version of Csound 5 (API library compiled as DLL, plugin libraries, and command line frontend) on Windows with MinGW/MSYS, you may edit and use `Makefile-win32`, eliminating the dependencies on Python and SCons.)

All Csound 5 SCons builds require the following:

- On Linux, install gcc.

- On Windows, install all of MinGW 3.4.2 (3.4.4 does not work) from www.mingw.org, or install MSVC. For MSys/MinGW, first install MSys, for example into /msys. Then install MinGW, by installing all without exception of the binary packages in the "Current" section of the download page at http://www.mingw.org/download.shtml#hdr2, in the order listed, for example into

      /msys/1.0/mingw

  . Then edit the

      /msys/1.0/etc/fstab

  file so that it tells MSys where to find MinGW, for example using the line

      /msys/1.0/mingw /mingw

  . Then, to open a shell in which to compile Csound, run the /msys/1.0/msys.bat script.

- On OS X, install the latest XCode development system.
- Install Python from http://www.python.org. Note that on Windows, if you have installed both MinGW and MSVC, it is best to use batch files to set up a separate environment for each compiler that does not refer to any header, library, DLL, or executable of the other compiler. On Windows, with Python 2.4 and later, Csound will link directly with the Python DLL. Earlier versions of the Python DLL will require a MinGW import library that the Csound build system should create.
- Install the Software Interface and Wrapper Generator (SWIG) for generating Python and Java interfaces, from http://www.swig.org.
- Install SCons from www.scons.org. On Windows, the MSys shell does not allow the user to execute the scons script directly. Therefore, you need to make sure that Python is in your Windows executable path, and run the build like this: `$$ python c:/tools/python23/scripts/scons` .
- Install libdsndfile version 1.0.13 or later from www.mega-nerd.com/libsndfile.

Optional configurations can include the following. In most cases it is best to install the most recent stable versions.

- For GUI widgets, install FLTK 1.1 from www.fltk.org ``. You must configure and build FLTK with `--enable-shared --enable-threads`.
- Real-time audio can use ALSA, JACK, CoreAudio, the Windows multimedia library, or PortAudio (v19-devel branch) from www.portaudio.com/usingcvs.html.
- Real-time MIDI can use the ALSA raw MIDI interface, Windows multimedia library, or PortMidi from www.cs.cmu.edu/~music/portmusic.
- CsoundVST, which is both a standalone GUI, a Python extension module, and a VST plugin form of Csound with extensive facilities for algorithmic composition, requires FLTK and the boost C++ template libraries for random numbers and linear algebra, from http://www.boost.org. The CsoundVST `Random` class requires that boost must be later than version 1.32.1.
- The fluid opcodes require the Fluidsynth library from http://savannah.nongnu.org/download/fluid. For Windows, use the prebuilt binaries.
- The STK opcodes require STK source code from http://ccrma.stanford.edu/software/stk, copied into `csound5/Opcodes/stk`.
- The Loris opcodes require Loris source code from http://sourceforge.net/projects/loris, copied into `csound5/Opcodes/Loris`.
- The OSC opcodes require the latest version of the liblo library from http://plugin.org.uk/liblo. On Windows, liblo requires a Windows version of the POSIX thread library (pthreads) which is available from http://sourceware.org/pthreads-win32; copy libpthreadGC2.a to libpthread.a. You may also need the latest version of autoconf from MinGW.

Execute `scons -h` to discover the current configuration options.

Modify `custom.py` as required for your installation (usually required on Windows, may not be required on Linux).

Execute `scons` with the options you desire.

Set the environment variable `OPCODEDIR` to the directory where plugin libraries are installed; in the case of a double precision build, `OPCODEDIR64` should be set instead. The NSIS installer performs this step.

To install on Linux, execute `./install.py` or `scons install`.

To create a Windows installer, build Csound for double precision samples and including the Loris, STK, py, vst4cs, and Fluidsynth opcodes, build the manual, install the NSIS installer from nsis.sourceforge.net, and run `csound5/installer/windows/csound.nsi`.

Prev | Up | Next
TclCsound Command Reference | Home | Csound Links