mex compile error undefined reference to `wrapper_dgemm_'
Ältere Kommentare anzeigen
I'm trying to compile a C++ file using mex in MATLAB installed on Ubuntu 16.04
When I run
mex localwarp.cp
in the MATLAB shell, I get the following trace
Building with 'g++'.
/usr/bin/g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG "/home/vkvishal/Music/doc_render/localwarp.cpp" -o /tmp/mex_156483571340806_18084/localwarp.o
/usr/bin/g++ -c -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2018a/extern/include" -I"/usr/local/MATLAB/R2018a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O -DNDEBUG "/usr/local/MATLAB/R2018a/extern/version/cpp_mexapi_version.cpp" -o /tmp/mex_156483571340806_18084/cpp_mexapi_version.o
/usr/bin/g++ -pthread -Wl,--no-undefined -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2018a/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_156483571340806_18084/localwarp.o /tmp/mex_156483571340806_18084/cpp_mexapi_version.o -Wl,--as-needed -Wl,-rpath-link,/usr/local/MATLAB/R2018a/bin/glnxa64 -L"/usr/local/MATLAB/R2018a/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2018a/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2018a/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -o localwarp.mexa64
Error using mex
/tmp/mex_156483571340806_18084/localwarp.o: In function `bool
arma::auxlib::solve_square_fast<arma::Mat<double> >(arma::Mat<arma::Mat<double>::elem_type>&,
arma::Mat<arma::Mat<double>::elem_type>&, arma::Base<arma::Mat<double>::elem_type,
arma::Mat<double> > const&)':
localwarp.cpp:(.text._ZN4arma6auxlib17solve_square_fastINS_3MatIdEEEEbRNS2_INT_9elem_typeEEES7_RKNS_4BaseIS5_S4_EE[_ZN4arma6auxlib17solve_square_fastINS_3MatIdEEEEbRNS2_INT_9elem_typeEEES7_RKNS_4BaseIS5_S4_EE]+0x13a0):
undefined reference to `wrapper_dgesv_'
/tmp/mex_156483571340806_18084/localwarp.o: In function `void arma::glue_times::apply<double,
false, false, false, arma::Mat<double>, arma::Mat<double> >(arma::Mat<double>&,
arma::Mat<double> const&, arma::Mat<double> const&, double)':
localwarp.cpp:(.text._ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x3a1):
undefined reference to `wrapper_dgemm_'
localwarp.cpp:(.text._ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x54f):
undefined reference to `wrapper_dgemv_'
localwarp.cpp:(.text._ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb0ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x7d7):
undefined reference to `wrapper_dgemv_'
collect2: error: ld returned 1 exit status
I googled around and I suspect the error is due to erroneous linking of blas, lapack libraries. How to resolve this error ?
Antworten (1)
Try this:
mex -O localwarp.cp libmwlapack.lib libmwblas.lib
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!