Skip to content

Instantly share code, notes, and snippets.

@573
Created October 23, 2012 22:46
Show Gist options
  • Save 573/3942268 to your computer and use it in GitHub Desktop.
Save 573/3942268 to your computer and use it in GitHub Desktop.
For later reference, libsvm .dll and .a file building on win32

In a ghci session (doing this way for autodidactical reasons):

:module +System.Process
createProcess (proc "mingw32-make.exe" ["dll"]) { env = Just ( ("PATH", "C:/PROGRA~2/HASKEL~1/201220~1.0/mingw/bin;h:/mingw/bin"):[] ) }

Will build the libsvm.dll file for runtime use in ghci.

For the .a file I did (PATH setting this order to first find the g++ tools coming with Haskell Platform itself, then the remaining mingw+msys-bundled mingw32-make):

:module +System.Process
createProcess (proc "mingw32-make.exe" []){ env = Just ( ("PATH", "C:/PROGRA~2/HASKEL~1/201220~1.0/mingw/bin;h:/mingw/bin;"):[] ) }
createProcess (proc "ar.exe" ["rc", "libsvm.a", "svm.o"]){ env = Just ( ("PATH", "C:/PROGRA~2/HASKEL~1/201220~1.0/mingw/bin;h:/mingw/bin"):[] ) }
createProcess (proc "ranlib.exe" ["libsvm.a"]){ env = Just ( ("PATH", "C:/PROGRA~2/HASKEL~1/201220~1.0/mingw/bin;h:/mingw/bin"):[] ) }

You'll need the libsvm sources.

And you'll have to edit their Makefile, adding:

svm.dll: svm.cpp svm.h
    $(CXX) $(CFLAGS) -c svm.cpp
dll: svm.dll
	$(CXX) -shared svm.o -o libsvm.dll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment