o17t H1H' S'k
o17t H1H' S'k

Reputation: 2744

installing liblinear in octave on windows

i am trying to install liblinear 1.91 in octave 3.6.2 on windows 7. octave is a clean mingw install without extra packages except for libsvm 3.12. please note libsvm installed without a problem by running make.m from octave. however when i try the same for liblinear i get:

../blas.o: In function dscal_': C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: multiple definition ofdscal_' ../blas.o:C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: first defined here ../blas.o: In function dscal_': C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: multiple definition ofdscal_' ../blas.o:C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: first defined here ../blas.o: In function dscal_': C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: multiple definition ofdscal_' ../blas.o:C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:35: multiple definition of TRON::info(char const*, ...)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:35: first defined here ...o: In functionTRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: multiple definition of TRON::TRON(function const*, double, int)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: first defined here ...o: In function~TRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: multiple definition of TRON::~TRON()' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:161: multiple definition ofTRON::trcg(double, double*, double*, doubl e*)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:161: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:57: multiple definition of TRON::tron(double*)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:57: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:224: multiple definition ofTRON::norm_inf(int, double*)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:224: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:234: multiple definition of TRON::set_print_string(void (*)(char const *))' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:234: first defined here ...o: In functionTRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: multiple definition of TRON::TRON(function const*, double, int)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: first defined here ...o: In function~TRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: multiple definition of TRON::~TRON()' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: first defined here train.o: In functiondo_cross_validation': C:\Octave\liblinear-1.91\matlab/train.c:86: undefined reference to cross_validation' train.o: In functionparse_command_line': C:\Octave\liblinear-1.91\matlab/train.c:212: undefined reference to set_print_string_function' train.o: In functionmexFunction': C:\Octave\liblinear-1.91\matlab/train.c:374: undefined reference to check_parameter' C:\Octave\liblinear-1.91\matlab/train.c:380: undefined reference todestroy_param' C:\Octave\liblinear-1.91\matlab/train.c:368: undefined reference to destroy_param' C:\Octave\liblinear-1.91\matlab/train.c:357: undefined reference todestroy_param' C:\Octave\liblinear-1.91\matlab/train.c:405: undefined reference to destroy_param' C:\Octave\liblinear-1.91\matlab/train.c:399: undefined reference totrain' C:\Octave\liblinear-1.91\matlab/train.c:403: undefined reference to free_and_destroy_model' ...o:tron.cpp:(.text+0x166): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x188): undefined reference to ddot_' ...o:tron.cpp:(.text+0x1da): undefined reference toddot_' ...o:tron.cpp:(.text+0x209): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x220): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x261): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x279): undefined reference toddot_' ...o:tron.cpp:(.text+0x2c5): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x2dd): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x368): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x387): undefined reference toddot_' ...o:tron.cpp:(.text+0x3aa): undefined reference to ddot_' ...o:tron.cpp:(.text+0x3c6): undefined reference toddot_' ...o:tron.cpp:(.text+0x440): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x46e): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x5df): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x754): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x78f): undefined reference to ddot_' ...o:tron.cpp:(.text+0x7ca): undefined reference toddot_' ...o:tron.cpp:(.text+0x828): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0xaf2): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x166): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x188): undefined reference toddot_' ...o:tron.cpp:(.text+0x1da): undefined reference to ddot_' ...o:tron.cpp:(.text+0x209): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x220): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x261): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x279): undefined reference to ddot_' ...o:tron.cpp:(.text+0x2c5): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x2dd): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x368): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x387): undefined reference to ddot_' ...o:tron.cpp:(.text+0x3aa): undefined reference toddot_' ...o:tron.cpp:(.text+0x3c6): undefined reference to ddot_' ...o:tron.cpp:(.text+0x440): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x46e): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x5df): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x754): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x78f): undefined reference toddot_' ...o:tron.cpp:(.text+0x7ca): undefined reference to ddot_' ...o:tron.cpp:(.text+0x828): undefined reference todnrm2_' ...o:tron.cpp:(.text+0xaf2): undefined reference to dnrm2_' collect2: ld returned 1 exit status warning: unable to find mkoctfile in expected location:C:\Octave\Octave3.6.2_gcc4.6.2\bin\mkoctfile-3.6.2' warning: mkoctfile exited with failure status ../blas.o: In function dscal_': C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: multiple definition ofdscal_' ../blas.o:C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: first defined here ../blas.o: In function dscal_': C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: multiple definition ofdscal_' ../blas.o:C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: first defined here ../blas.o: In function dscal_': C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: multiple definition ofdscal_' ../blas.o:C:\Octave\liblinear-1.91\matlab/../blas/dscal.c:4: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:35: multiple definition of TRON::info(char const*, ...)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:35: first defined here ...o: In functionTRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: multiple definition of TRON::TRON(function const*, double, int)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: first defined here ...o: In function~TRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: multiple definition of TRON::~TRON()' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:161: multiple definition ofTRON::trcg(double, double*, double*, doubl e*)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:161: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:57: multiple definition of TRON::tron(double*)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:57: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:224: multiple definition ofTRON::norm_inf(int, double*)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:224: first defined here ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:234: multiple definition of TRON::set_print_string(void (*)(char const *))' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:234: first defined here ...o: In functionTRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: multiple definition of TRON::TRON(function const*, double, int)' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:44: first defined here ...o: In function~TRON': C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: multiple definition of TRON::~TRON()' ...o:C:\Octave\liblinear-1.91\matlab/../tron.cpp:54: first defined here predict.o: In functiondo_predict': C:\Octave\liblinear-1.91\matlab/predict.c:71: undefined reference to get_nr_class' C:\Octave\liblinear-1.91\matlab/predict.c:81: undefined reference toget_nr_feature' C:\Octave\liblinear-1.91\matlab/predict.c:147: undefined reference to predict_probability' C:\Octave\liblinear-1.91\matlab/predict.c:155: undefined reference topredict_values' predict.o: In function mexFunction': C:\Octave\liblinear-1.91\matlab/predict.c:288: undefined reference tofree_and_destroy_model' C:\Octave\liblinear-1.91\matlab/predict.c:312: undefined reference to free_and_destroy_model' C:\Octave\liblinear-1.91\matlab/predict.c:295: undefined reference tocheck_probability_model' ...o:tron.cpp:(.text+0x166): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x188): undefined reference toddot_' ...o:tron.cpp:(.text+0x1da): undefined reference to ddot_' ...o:tron.cpp:(.text+0x209): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x220): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x261): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x279): undefined reference to ddot_' ...o:tron.cpp:(.text+0x2c5): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x2dd): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x368): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x387): undefined reference to ddot_' ...o:tron.cpp:(.text+0x3aa): undefined reference toddot_' ...o:tron.cpp:(.text+0x3c6): undefined reference to ddot_' ...o:tron.cpp:(.text+0x440): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x46e): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x5df): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x754): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x78f): undefined reference toddot_' ...o:tron.cpp:(.text+0x7ca): undefined reference to ddot_' ...o:tron.cpp:(.text+0x828): undefined reference todnrm2_' ...o:tron.cpp:(.text+0xaf2): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x166): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x188): undefined reference to ddot_' ...o:tron.cpp:(.text+0x1da): undefined reference toddot_' ...o:tron.cpp:(.text+0x209): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x220): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x261): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x279): undefined reference toddot_' ...o:tron.cpp:(.text+0x2c5): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x2dd): undefined reference todnrm2_' ...o:tron.cpp:(.text+0x368): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x387): undefined reference toddot_' ...o:tron.cpp:(.text+0x3aa): undefined reference to ddot_' ...o:tron.cpp:(.text+0x3c6): undefined reference toddot_' ...o:tron.cpp:(.text+0x440): undefined reference to daxpy_' ...o:tron.cpp:(.text+0x46e): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x5df): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0x754): undefined reference todaxpy_' ...o:tron.cpp:(.text+0x78f): undefined reference to ddot_' ...o:tron.cpp:(.text+0x7ca): undefined reference toddot_' ...o:tron.cpp:(.text+0x828): undefined reference to dnrm2_' ...o:tron.cpp:(.text+0xaf2): undefined reference todnrm2_' collect2: ld returned 1 exit status warning: unable to find mkoctfile in expected location: `C:\Octave\Octave3.6.2_gcc4.6.2\bin\mkoctfile-3.6.2' warning: mkoctfile exited with failure status

please help.

Upvotes: 1

Views: 1132

Answers (2)

user1759848
user1759848

Reputation: 243

I am using octave 3.6.2 with Visual Studio 2010.

I first followed the instructions here to get libsvm working: http://flyingpies.wordpress.com/2012/11/20/getting-libsvm-to-work-with-octave-on-windows/

To get liblinear compiled, run octave with visual studio environment variables (see link above), cd to the liblinear directory, and run these commands:

mex -c 'linear.cpp' 
mex -c 'tron.cpp' 
cd blas
mex -c 'daxpy.c' 
mex -c 'ddot.c' 
mex -c 'dnrm2.c' 
mex -c 'dscal.c'
cd ..\matlab 
mex -DMX_API_VER=0x07030000 -c linear_model_matlab.c -I..\\ 
mex -DMX_API_VER=0x07030000 train.c -I..\\ '..\tron.o' '..\linear.o' 'linear_model_matlab.o' '..\blas\daxpy.o' '..\blas\ddot.o' '..\blas\dnrm2.o' '..\blas\dscal.o' 
mex -DMX_API_VER=0x07030000 predict.c -I..\\ '..\tron.o' '..\linear.o' 'linear_model_matlab.o' '..\blas\daxpy.o' '..\blas\ddot.o' '..\blas\dnrm2.o' '..\blas\dscal.o' 
mex -DMX_API_VER=0x07030000 libsvmread.c 
mex -DMX_API_VER=0x07030000 libsvmwrite.c 

Upvotes: 1

o17t H1H' S'k
o17t H1H' S'k

Reputation: 2744

starting from the liblinear-1.91/matlab folder, this compiles for me:

cd ..
mex   -c linear.cpp
mex   -c tron.cpp
cd blas
mex   -c *.c
cd ../matlab
mex libsvmread.c
mex libsvmwrite.c
mex train.c linear_model_matlab.c ../linear.o ../tron.o ../blas/*.o
mex predict.c linear_model_matlab.c ../linear.o ../tron.o ../blas/*.o

Upvotes: 3

Related Questions