Wednesday, March 3, 2010

The errors and solutions when compiling the levmar with lapack

Well, there are a lot of errors. I google a lot to find solutions, and I add them here. Good for newbies.

Q1. undefined reference to `MAIN__'
S: add '-u MAIN_' in the GCC part of Makefile

Q2. undefined symbol: _gfortran_concat_string
S: add '-gfortran' in the GCC part of Makefile

Q3. misuse the command matlab mex with the command mex from pdfTeXK.
S: replace 'mex' by whole directory '/where your matlab is/bin/mex' in Makefile

Q4. multiple definition of `xerbla_'
S: set 'LAPACKBLASLIBS_PATH=/usr/lib/atlas' in the Makefile of matlab subfolder


羅小住 said...

nice to know you ~........................................

Daniel said...

Hi - are you still into levmar and Matlab mex? I just can't get the stuff compiled to a working mex file.

I use levmar 2.5 Matlab 7.11 under Ubuntu 10.04. Compilation runs with
>> mex -DHAVE_LAPACK -I.. -O -L../ -L/usr/lib levmar.c -llevmar -llapack -lblas -lf2c

but upon trying to test it, I see
/usr/lib/ undefined symbol: MAIN__.

Any advice or comments? Your suggestions are welcome.

Greetings from Karlsruhe.

GuoLiang Liu said...

Hi, Daniel, I did this work long time ago, and I even hardly remember how things were going.
However, you could try the suggestion I have wrote: append '-u MAIN_' in the GCC part of Makefile. In your case, you can append it with mex. Just have a try. Good luck.

Daniel said...

Thanks for the suggestion. It compiled with no problems under Ubuntu 10.04 32bit but the error with 64 still persists.
I will update if I find a way to get around this.