Installing libsvm3.0 on Mac OS X (10.6.6) running MATLAB R2010b (7.11)

59 views (last 30 days)
Hi all,
I'm running Mac OS X (Snow Leopard 10.6.6) and Matlab R2010b (7.11.0.584). I'm trying to install a package called libsvm (http://www.csie.ntu.edu.tw/~cjlin/libsvm/). I've tried running make at the terminal but I keep getting some cryptic errors and don't know how to deal with them. Below are the contents of Makefile
### This Makefile is used under Linux
#MATLABDIR ?= /usr/local/matlab
### for Mac
MATLABDIR ?= /Applications/MATLAB_R2010b.app
CXX ?= g++
#CXX = g++-4.1
CFLAGS = -Wall -Wconversion -O3 -fPIC -I$(MATLABDIR)/extern/include
MEX = $(MATLABDIR)/bin/mex
MEX_OPTION = CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS)" CXXFLAGS\#"$(CFLAGS)"
# comment the following line if you use MATLAB on 32-bit computer
MEX_OPTION += -largeArrayDims
MEX_EXT = $(shell $(MATLABDIR)/bin/mexext)
OCTAVEDIR ?= /usr/include/octave
OCTAVE_MEX = env CC=$(CXX) mkoctfile
OCTAVE_MEX_OPTION = --mex
OCTAVE_MEX_EXT = mex
OCTAVE_CFLAGS = -Wall -O3 -fPIC -I$(OCTAVEDIR)
all: matlab
matlab: binary
octave:
@make MEX="$(OCTAVE_MEX)" MEX_OPTION="$(OCTAVE_MEX_OPTION)" \
MEX_EXT="$(OCTAVE_MEX_EXT)" CFLAGS="$(OCTAVE_CFLAGS)" \
binary
binary: svmpredict.$(MEX_EXT) svmtrain.$(MEX_EXT) libsvmread.$(MEX_EXT) libsvmwrite.$(MEX_EXT)
svmpredict.$(MEX_EXT): svmpredict.c svm.h svm.o svm_model_matlab.o
$(MEX) $(MEX_OPTION) svmpredict.c svm.o svm_model_matlab.o
svmtrain.$(MEX_EXT): svmtrain.c svm.h svm.o svm_model_matlab.o
$(MEX) $(MEX_OPTION) svmtrain.c svm.o svm_model_matlab.o
libsvmread.$(MEX_EXT): libsvmread.c
$(MEX) $(MEX_OPTION) libsvmread.c
libsvmwrite.$(MEX_EXT): libsvmwrite.c
$(MEX) $(MEX_OPTION) libsvmwrite.c
svm_model_matlab.o: svm_model_matlab.c svm.h
$(CXX) $(CFLAGS) -c svm_model_matlab.c
svm.o: svm.cpp svm.h
$(CXX) $(CFLAGS) -c svm.cpp
clean:
rm -f *~ *.o .mex *.obj
###
When I type make in the terminal, I get this error message:
/Applications/MATLAB_R2010b.app/bin/mex CC#g++ CXX#g++ CFLAGS#"-Wall -Wconversion -O3 -fPIC -I/Applications/MATLAB_R2010b.app/extern/include" CXXFLAGS#"-Wall -Wconversion -O3 -fPIC -I/Applications/MATLAB_R2010b.app/extern/include" -largeArrayDims svmpredict.c svm.o svm_model_matlab.o
ld64-62.1 failed: library not found for -lgcc_s.10.5
collect2: ld returned 1 exit status
mex: link of ' "svmpredict.mexmaci64"' failed.
make: *** http://svmpredict.mexmaci64 Error 1
I notice that it says library not found for -lgcc_s.10.5. What does this mean and how could I possibly fix it?
LIBSVM also comes with a make.m script for running it within matlab. However when I run it there a whole bunch of errors (I'm only showing the first 7) like this:
svm.cpp:1:18: error: math.h: No such file or directory
svm.cpp:2:19: error: stdio.h: No such file or directory
svm.cpp:3:20: error: stdlib.h: No such file or directory
svm.cpp:4:19: error: ctype.h: No such file or directory
svm.cpp:5:19: error: float.h: No such file or directory
svm.cpp:6:20: error: string.h: No such file or directory
svm.cpp:7:20: error: stdarg.h: No such file or directory
mex: compile of ' "svm.cpp"' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
Error in ==> make at 5
mex -O -c svm.cpp

Answers (2)

Walter Roberson
Walter Roberson on 25 Jan 2011
You do not have g++ fully installed, or possibly not installed at all. You also do not have a C compiler fully installed.
Have you installed XCode from your Snow Leopard installation CDs? It does not install by default.

Michael
Michael on 26 Jan 2011
Brilliant! Installing XCode allows it to install properly. Thanks so much for the help.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!