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. However, building from source is probably the best option on GNU/Linux.

The sources for the latest release of Csound can be found along with the binary packages at www.sourceforge.net/projects/csound. The source packages have either a zip or tar.gz extension.

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

The Csound CVS front page is located at: http://sourceforge.net/cvs/?group_id=81968. Information about accessing the CVS repository may be found in the SourceForge document http://sourceforge.net/docs/E04/.

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

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:

- A compiler like gcc or Microsoft Visual Studio.

- 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.
- libdsndfile version 1.0.13 or later from www.mega-nerd.com/libsndfile.
- Python from http://www.python.org or your linux distribution repositories. 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. Python version is currently required.
- The SCons build system 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` .

Optional configurations can include any of 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.

  | Note
  Be sure to get Portaudio v19. Earlier versions will not work.

- Real-time MIDI can use the ALSA raw MIDI interface (requires alsa-dev), 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.
- Install the Software Interface and Wrapper Generator (SWIG) for generating Python and Java interfaces, from http://www.swig.org.

Get both the packages and their sources (or -dev packages).

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. For example:

scons buildOSC=1 buildCsound5GUI=1 buildPythonOpcodes=1 useOSC=1 buildLoris=0

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`.

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