Install OSC for Matlab on Windows

This is a short HowTo on compiling the OSC implementation by Andy Schmeder for Matlab on Windows.

Needed Tools

Installation

MinGW, MSYS and MinGW-DTK can be installed using the setup programs. Afterwards, you need to add the MinGW/bin folder to your “Path” under Settings → Control Panel → System → Advanced → Environment Variables → System Variable → Path (usually, you need to add “C:\MinGW\bin”)

Then, extract the autoconf update into the MinGW installation folder (usually, C:\MinGW). Replace existing files!

pthreads

Now we need to download and compile pthreads: Extract pthreads to C:\MinGW and start MSYS. You are now dropped to a Unix-like shell. Enter the following:

cd pthreads-w32-2-8-0-release
make GC-inlined
cp libpthreadGC2.a ../lib
cp *.h ../include
cp libpthreadGC2.a ../lib/libpthread.a

liblo

Download liblo and extract it to C:\MinGW. Open the file src/server.c in a text editor and comment the gia_strerrorA function (lines 79-95). They cause an error upon compilation.

Again, fire up MSYS and enter the following:

cd liblo-0.24
./configure LIBS=-lws2_32 CFLAGS="-DWIN32 -D_WIN32_WINNT=0x0501"
make
make install

gnumex

Download and install gnumex as documented on the homepage. Run gnumex.m in Matlab and enter the details. Now you can find the file mexopts.bat in C:\Document and Settings\%USERNAME%\Application Data\Mathworks\Matlab\R2009a.

Compiling OSC

Download and extract osc-mexsrc.zip somewhere on your harddrive. Copy mexopts.bat from the previous step into this directory.

Open osc_make.m in the Editor and adapt the windows specific function at the bottom. The following works for me:

mex -Ic:\mingw\liblo-0.24 -Lc:\mingw\lib -f mexopts.bat osc_new_address.c c:\mingw\liblo-0.24\src\.libs\*.o c:\mingw\lib\libws2_32.a c:\mingw\lib\libpthreadGC2.a
mex -Ic:\mingw\liblo-0.24 -Lc:\mingw\lib -f mexopts.bat osc_free_address.c c:\mingw\liblo-0.24\src\.libs\*.o c:\mingw\lib\libws2_32.a c:\mingw\lib\libpthreadGC2.a
mex -Ic:\mingw\liblo-0.24 -Lc:\mingw\lib -f mexopts.bat osc_new_server.c c:\mingw\liblo-0.24\src\.libs\*.o c:\mingw\lib\libws2_32.a c:\mingw\lib\libpthreadGC2.a
mex -Ic:\mingw\liblo-0.24 -Lc:\mingw\lib -f mexopts.bat osc_free_server.c c:\mingw\liblo-0.24\src\.libs\*.o c:\mingw\lib\libws2_32.a c:\mingw\lib\libpthreadGC2.a
mex -Ic:\mingw\liblo-0.24 -Lc:\mingw\lib -f mexopts.bat osc_send.c c:\mingw\liblo-0.24\src\.libs\*.o c:\mingw\lib\libws2_32.a c:\mingw\lib\libpthreadGC2.a
mex -Ic:\mingw\liblo-0.24 -Lc:\mingw\lib -f mexopts.bat osc_recv.c c:\mingw\liblo-0.24\src\.libs\*.o c:\mingw\lib\libws2_32.a c:\mingw\lib\libpthreadGC2.a

If everything went fine, you should now find some new .mexw32 files in your directory.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information