Building libsvm-3.11/python on Mac OS X 10.6

From SnOwy - Ed's Wiki Notebook

Jump to: navigation, search

I wanted to build libsvm-3.11/python for use with pybrain.

I did this ...

Tin:ThePlace eddiema$ cd libsvm-3.11
Tin:libsvm-3.11 eddiema$ ls
COPYRIGHT	Makefile.win	java		svm-predict.c	svm-train.c	svm.h
FAQ.html	README		matlab		svm-scale.c	svm.cpp		tools
Makefile	heart_scale	python		svm-toy		svm.def		windows
Tin:libsvm-3.11 eddiema$ cd python
Tin:python eddiema$ make
make -C .. lib
g++ -Wall -Wconversion -O3 -fPIC -c svm.cpp
g++ -shared -dynamiclib -Wl,-soname,libsvm.so.2 svm.o -o libsvm.so.2
ld: unknown option: -soname
collect2: ld returned 1 exit status
make[1]: *** [lib] Error 1
make: *** [lib] Error 2
Tin:python eddiema$ 

The error comes from my OS X's g++ not liking the -soname parameter.

I went to ...

http://stackoverflow.com/questions/4580789/cmake-mac-os-x-ld-unknown-option-soname

Who suggested a fix for a different project -- for my records, I chose the solution wherein the parameter "-soname" was changed to "-install_name" in the superdirectory Makefile on line 8 ...

lib: svm.o
	$(CXX) -shared -dynamiclib -Wl,-soname,libsvm.so.$(SHVER) svm.o -o libsvm.so.$(SHVER)
lib: svm.o
	$(CXX) -shared -dynamiclib -Wl,-install_name,libsvm.so.$(SHVER) svm.o -o libsvm.so.$(SHVER)

Retrying make in the python directory yielded success.

Tin:python eddiema$ make
make -C .. lib
g++ -shared -dynamiclib -Wl,-install_name,libsvm.so.2 svm.o -o libsvm.so.2
Tin:python eddiema$ 

I'll post an update and add an alias if there are more issues getting this to work with pybrain.

-- Notes wrt pybrain installation ...

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox