Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
mex compile of matrixMultiply.c in MATLAB/R2012a/extern/examples/refbook fails

Subject: mex compile of matrixMultiply.c in MATLAB/R2012a/extern/examples/refbook fails

From: shome

Date: 13 Feb, 2013 10:33:10

Message: 1 of 3

In /usr/local/MATLAB/R2012a/extern/examples/refbook there are a few c files.all compiled with command mex filename.c except files with blas or lapak headers.One such example is shown below:

>> mex matrixMultiply.c

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
         currently supported with MEX is "4.4.6".
         For a list of currently supported compilers see:
         http://www.mathworks.com/support/compilers/current_release/

In file included from matrixMultiply.c:19:0:
/usr/local/MATLAB/R2012a/extern/include/blas.h:595:0: warning: "dgemm" redefined [enabled by default]
matrixMultiply.c:15:0: note: this is the location of the previous definition
matrixMultiply.o: In function `mexFunction':
matrixMultiply.c:(.text+0xf7): undefined reference to `dgemm_'
collect2: ld returned 1 exit status

    mex: link of ' "matrixMultiply.mexa64"' failed.

> In mex_helper at 36
  In mex at 204
Error using mex (line 206)
Unable to complete successfully.

Kindly advise

Subject: mex compile of matrixMultiply.c in MATLAB/R2012a/extern/examples/refbook fails

From: James Tursa

Date: 13 Feb, 2013 16:33:15

Message: 2 of 3

"shome" wrote in message <kffq56$j3$1@newscl01ah.mathworks.com>...
> In /usr/local/MATLAB/R2012a/extern/examples/refbook there are a few c files.all compiled with command mex filename.c except files with blas or lapak headers.One such example is shown below:
>
> >> mex matrixMultiply.c
>
> Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
> currently supported with MEX is "4.4.6".
> For a list of currently supported compilers see:
> http://www.mathworks.com/support/compilers/current_release/
>
> In file included from matrixMultiply.c:19:0:
> /usr/local/MATLAB/R2012a/extern/include/blas.h:595:0: warning: "dgemm" redefined [enabled by default]
> matrixMultiply.c:15:0: note: this is the location of the previous definition
> matrixMultiply.o: In function `mexFunction':
> matrixMultiply.c:(.text+0xf7): undefined reference to `dgemm_'
> collect2: ld returned 1 exit status
>
> mex: link of ' "matrixMultiply.mexa64"' failed.
>
> > In mex_helper at 36
> In mex at 204
> Error using mex (line 206)
> Unable to complete successfully.
>
> Kindly advise

You may need to explicitly point it to the BLAS library. E.g.,

mex -lmwblas matrixMultiply.c

James Tursa

Subject: mex compile of matrixMultiply.c in MATLAB/R2012a/extern/examples/refbook fails

From: shome

Date: 13 Feb, 2013 16:58:13

Message: 3 of 3

Thanks James, your suggestion worked.

"James Tursa" wrote in message <kfgf8b$ehq$1@newscl01ah.mathworks.com>...
> "shome" wrote in message <kffq56$j3$1@newscl01ah.mathworks.com>...
> > In /usr/local/MATLAB/R2012a/extern/examples/refbook there are a few c files.all compiled with command mex filename.c except files with blas or lapak headers.One such example is shown below:
> >
> > >> mex matrixMultiply.c
> >
> > Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
> > currently supported with MEX is "4.4.6".
> > For a list of currently supported compilers see:
> > http://www.mathworks.com/support/compilers/current_release/
> >
> > In file included from matrixMultiply.c:19:0:
> > /usr/local/MATLAB/R2012a/extern/include/blas.h:595:0: warning: "dgemm" redefined [enabled by default]
> > matrixMultiply.c:15:0: note: this is the location of the previous definition
> > matrixMultiply.o: In function `mexFunction':
> > matrixMultiply.c:(.text+0xf7): undefined reference to `dgemm_'
> > collect2: ld returned 1 exit status
> >
> > mex: link of ' "matrixMultiply.mexa64"' failed.
> >
> > > In mex_helper at 36
> > In mex at 204
> > Error using mex (line 206)
> > Unable to complete successfully.
> >
> > Kindly advise
>
> You may need to explicitly point it to the BLAS library. E.g.,
>
> mex -lmwblas matrixMultiply.c
>
> James Tursa

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us