A Practical Guide to Compiling Csound

Hans Mikelson



This article will discuss how I was able to get Csound to compile using both an SGI computer running IRIX 6.5 and a Pentium II based computer running Windows 95. I am going through and keeping track of everything I do to compile these programs. I hope this article will prove useful to others who attempt the same thing.

Compiling under IRIX

I used an SGI Indigo 2 to compile Csound. The operating system used was IRIX release 6.5. First open up the file manager by double clicking on the icon which looks like a little folder. Next add a new directory for the source code by selecting actions and add new directory. Make sure you don't already have a directory named source. Change the name from empty.dir to source by highlighting it, typing in the word source and hitting enter.

Open up Netscape and go to the following site:


Click on Csound.tar.gz and save it in the source directory you just created. Go back to the desktop manager and select the Csound.tar.gz file by clicking on it once. It should turn yellow. The .gz extension on the file indicates that the file is compressed. Go to the selected menu and choose uncompress. This changes the file to a new file called Csound.tar. The .tar extension stands for tape archive. This is a way of storing many files and directories in a single file. To unpack the .tar file open a unix shell by going to desktop on the Toolchest and selecting open unix shell. In the unix shell window change to the source directory by typing something like cd source. Type ls to list the files in the directory. Unpack the tape archive by typing the following command:

tar xvhf Csound.tar

Type ls again to list the contents of the directory and notice the change. There should now be many files in the directory. Next go back to desktop manager and look at the source directory. You can change directories by dragging the folder icon of the directory you want to look at and dropping it onto the blue folder in the upper left corner of desktop manager.

If you try to compile the program now you get many warnings similar to the following and some errors:


cc WARNING: -Olimit is no longer supported, use -OPT:Olimit=n instead

Open up Makefile with a text editor by going to the unix shell window and typing:

jot Makefile

Choose Select then Search Forward and enter the phrase -Olimit in the search box.

Change the line:

CFLAGS = -Olimit 3000 $(DEFINES) -O2


CFLAGS = -OPT:Olimit=3000 $(DEFINES) -O2

If you tried compiling now you would still get two errors in space.c. These seem to be due DOS carriage returns being left behind. Open up space.c with a text editor and go to line 54 and take out the end of line character.

If you tried compiling now you would get some errors due to nested comments, apparently the compiler does not allow nested comments. Open up aifc.c go to line 229 and change it from:

/*if (sampsize <= 8) { /* parse CommChunk to hdr format */


/*if (sampsize <= 8) { */ /* parse CommChunk to hdr format */

Open up cscormai.c and change:

/* cc -o cscore cscore_xxx.c $CSOUND/cscoremain.o $CSOUND/cscorefns.o \


/* cc -o cscore cscore_xxx.c $CSOUND/cscoremain.o $CSOUND/cscorefns.o */

Use desktop manager to look for the file named Makefile and double click on it. The Build View program should open up and start trying to compile the program. If all goes well a program entitled csound will be created in the source directory.

That's it. Try out the new version of Csound by moving an orchestra and score to the source directory and execute the program with the following command at the unix prompt:

./csound myorc.orc myscore.sco

When it is finished rendering you can open and listen to your creation by entering the command:

soundeditor test

Compiling Under Win95

I downloaded Csound version 3.493 from the bath web site


and used Winzip to extract it to a new directory (Csound2). I next opened MS Visual C++ 6.0 Pro. I selected file, open workspace, and selected winsound.mdp. Visual C++ asked if I wanted to convert the project and I said yes. To start off I tried Build, Build winsound.

winsound.exe - 53 error(s), 11 warning(s)

A number of the errors seem to be associated with missing modules. Looking at the winsound source files I notice that some of the files in the distribution are missing from the source and header files included with the project. In particular I had to add the following files to the project:

schedule.c, schedule.h, biquad.c, biquad.h, lowpassr.c, lowpassr.h, flanger.c, flanger.h

Now I get the following errors:


MAIN.OBJ : error LNK2001: unresolved external symbol _read_unified_file

SFHEADER.OBJ : error LNK2001: unresolved external symbol _aifcReadHeader

SFHEADER.OBJ : error LNK2001: unresolved external symbol _is_aifc_formtype

SFHEADER.OBJ : error LNK2001: unresolved external symbol _aifcWriteHdr

SFHEADER.OBJ : error LNK2001: unresolved external symbol _aifcReWriteHdr

UGENS8.OBJ : error LNK2001: unresolved external symbol _SpectralExtract

pvadd.obj : error LNK2001: unresolved external symbol _SpectralExtract

UGENS8.OBJ : error LNK2001: unresolved external symbol _PvocMaxAmp

pvadd.obj : error LNK2001: unresolved external symbol _PvocMaxAmp

UGENS8.OBJ : error LNK2001: unresolved external symbol _PvAmpGate

pvadd.obj : error LNK2001: unresolved external symbol _PvAmpGate

.\WinDebug/winsound.exe : fatal error LNK1120: 8 unresolved externals

Error executing link.exe.

winsound.exe - 12 error(s), 11 warning(s)

So where do these mysterious missing symbols originate? I next perform a search on the files in the directory to find out which files reference these variables. The first one turns up in one_file.c which is not in the project. I add one_file.c to the project. I repeat the search for each symbol and add for the following files: aifc.c, pvocext.c, pvocext.h, and argdecode.c.

One unresolved symbol remains xfilename. All of the files using this variable are already included. Time to consult the mailing list. This variable is defined in MAIN.C. I notice that the variable above it has the word static commented out so I commented out the word static on the definition of the variable xfilename. It now compiles without errors although I get some warnings. I notice that it has been building in Debug mode so I go to Build/Set Active Configuration and change it to Release mode. Now to test it and see if it works. I open up Csounder and select the new version of winsound choose a fairly complex orchestra and score to compile. It compiles successfully.


I have provided a snap shot of compiling one revision of the program. Hopefully this article will provide some idea of the process one goes through when attempting to get a program to compile. As programs change and new revisions come out these problems will be eliminated but new ones will inevitably be introduced. You are now ready to begin adding your own opcodes to Csound.


Robin Whittle describes compiling Csound under linux at the following web site.