Menu

Installing_portmidi_on_Linux

haochuan

Installing portmidi on Linux

You will need cmake, the ALSA development package named libasound2-dev, and Java (Java is used for the pmdefaults program, which provides a graphical interface for setting default input and output devices.)

NOTE: portmidi uses SVN for version control.
You may need to install Subversion on your computer before continuing. download
For more information on using SVN, see Using SVN.

Alternatively, you can download the portmidi-src-nnn.zip file to get the most recent stable release without using SVN.

To install portmidi on a Linux machine, open a terminal window and navigate to the directory in which you would like to place the portmidi files.

From there, create a directory called portmedia and navigate into it:

 mkdir portmedia ; cd portmedia

Next, checkout the portmidi subproject from SourceForge:

 svn co https://portmedia.svn.sourceforge.net/svnroot/portmedia/portmidi/trunk portmidi

Note: if you just downloaded the portmidi-src-nnn.zip file and unzipped it, you can continue from this point.

Use ccmake to configure:

cd portmidi
ccmake .

*You may have to manually set JAVA_INCLUDE_PATH and JAVA_JVM_LIBRARY by typing 't' (toggle to advanced mode) and using the editor to change the fields. You can find possible values for JAVA_INCLUDE_PATH by typing "locate jni.h", and for JAVA_JVM_LIBRARY by typing "locate libjvm".

You also need JAVA_INCLUDE_PATH2, but this will normally be set automatically after you set JAVA_INCLUDE_PATH and run "configure" (type "c" to ccmake). Normally, JAVA_INCLUDE_PATH2 is the linux subdirectory within JAVA_INCLUDE_PATH.

Finally, compile the source code:

make

If you want, you can install libraries and the pmdefaults program:

sudo make install

You have now completed the installation of portmidi!

You can now try testing the program. As an example, type:

cd pm_test
./test

You should also try pmdefaults:

pmdefaults

This will open a dialog box where you can select default input and output devices for PortMidi.

java.library.path and the pmdefaults program

The pmdefaults program relies on a pmjni library that allows Java to call !PortMidi functions. This library is dynamically loaded. If pmdefaults complains about not finding the library, you might be able to fix it by editing the portmidi/Release/pmdefaults program (which is a shell script) by inserting (after "java") the following:

-Djava.library.path=/usr/local/lib

After editing pmdefaults, go back to the portmidi directory level and rerun sudo make install. I'm not too clear on the right way to do this for ALL Linux systems or why Java doesn't always look in /usr/local/lib. Suggestions are welcome.

Further documentation is available in README.txt, pm_common/portmidi.h, and pm_linux/README_LINUX.txt.