Prev: ginput on a curve
Next: Alignment of strings
From: Peter Williert on 22 May 2010 05:25 Hello, First of all: I don't have any knowlegde about C :( I want to create a MEX-file of LEVMAR. I have already compiled the LEVMAR, LAPACK, BLAS, F2C libraries with CMAKE and MS Visual Studio (using this tutorial: http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html#build). Now I'm trying to create levmar.mexw32 with MATLAB R2009b. I have used this command: >> mex -DHAVE_LAPACK -I.. -O -LC:\ levmar.c -llevmar -llapack -lblas -lf2c And I get the following error message: -------------------------------------- lcc preprocessor error: ..\levmar.h:29 levmar.c:27 Macro redefinition of HAVE_LAPACK 1 errors, 0 warnings C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Compile of 'levmar.c' failed. ??? Error using ==> mex at 221 Unable to complete successfully. -------------------------------------- I don't know what this mean. Any help would be appreciated. Regards, PW
From: James Tursa on 22 May 2010 12:15 "Peter Williert" <ibase25(a)gmx.net> wrote in message <ht87tr$89n$1(a)fred.mathworks.com>... > Hello, > > First of all: I don't have any knowlegde about C :( > > I want to create a MEX-file of LEVMAR. I have already compiled the LEVMAR, LAPACK, BLAS, F2C libraries with CMAKE and MS Visual Studio (using this tutorial: http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html#build). > > Now I'm trying to create levmar.mexw32 with MATLAB R2009b. I have used this command: > > >> mex -DHAVE_LAPACK -I.. -O -LC:\ levmar.c -llevmar -llapack -lblas -lf2c > > And I get the following error message: > -------------------------------------- > lcc preprocessor error: ..\levmar.h:29 levmar.c:27 Macro redefinition of HAVE_LAPACK > 1 errors, 0 warnings > > C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Compile of 'levmar.c' failed. The -DHAVE_LAPACK option sets a macro called HAVE_LAPACK. Looks like there already was one defined based on the message. Try compiling without the explicit definition. e.g., mex -I.. -O -LC:\ levmar.c -llevmar -llapack -lblas -lf2c James Tursa
From: Peter Williert on 23 May 2010 05:50 Thank you for your answer, James. I have uncomment to line in levmar.h (29): #define HAVE_LAPACK With LCC I get the error msg: ---------------------------------- Writing library for levmar.mexw32 Axb.obj .text: undefined reference to '__imp__free' Axb.obj .text: undefined reference to '_dgeqrf_' Axb.obj .text: undefined reference to '__ftol2_sse' Axb.obj .text: undefined reference to '__imp____iob_func' Axb.obj .text: undefined reference to '__imp__exit' Axb.obj .text: undefined reference to '_dorgqr_' Axb.obj .text: undefined reference to '_dtrtrs_' Axb.obj .text: undefined reference to '_dpotrf_' Axb.obj .text: undefined reference to '_dpotrs_' Axb.obj .text: undefined reference to '_dgetrf_' Axb.obj .text: undefined reference to '_dgetrs_' Axb.obj .text: undefined reference to '_dgesvd_' Axb.obj .text: undefined reference to '_dsytrf_' Axb.obj .text: undefined reference to '_dsytrs_' Axb.obj .text: undefined reference to '_sgeqrf_' Axb.obj .text: undefined reference to '_sorgqr_' Axb.obj .text: undefined reference to '_strtrs_' Axb.obj .text: undefined reference to '_spotrf_' Axb.obj .text: undefined reference to '_spotrs_' Axb.obj .text: undefined reference to '_sgetrf_' Axb.obj .text: undefined reference to '_sgetrs_' Axb.obj .text: undefined reference to '_sgesvd_' Axb.obj .text: undefined reference to '_ssytrf_' Axb.obj .text: undefined reference to '_ssytrs_' lm.obj .text: undefined reference to '__imp___finite' lmblec.obj .text: undefined reference to '___security_cookie' lmblec.obj .text: undefined reference to '@__security_check_cookie@4' lmlec.obj .text: undefined reference to '_sgeqp3_' lmlec.obj .text: undefined reference to '_strtri_' lmlec.obj .text: undefined reference to '_dgeqp3_' lmlec.obj .text: undefined reference to '_dtrtri_' misc.obj .text: undefined reference to '_sgemm_' misc.obj .text: undefined reference to '_spotf2_' misc.obj .text: undefined reference to '_dgemm_' misc.obj .text: undefined reference to '_dpotf2_' C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'levmar.mexw32' failed. ---------------------------------- With Open Watcom I get the following error msg: ---------------------------------- Open Watcom Linker Version 1.8 Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. Error! E3033: directive error near 'C:\LEVMAR-2.5\levmar.lib' C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'levmar.mexw32' failed. ??? Error using ==> mex at 221 Unable to complete successfully. ---------------------------------- Here is my levmar.lib file (Windows7 32-bit, created with MS Visual Studio 10 Express): http://ifile.it/egpjb67/levmar-lib.zip LEVMAR 2.5: http://www.ics.forth.gr/~lourakis/levmar/levmar-2.5.tgz This library seems to be correct. Here are the results of lmdemo.exe: ---------------------------------- Covariance of the fit: 0.00483514 -0.00162445 -0.000548114 -0.00162445 0.000546079 0.000184356 -0.000548114 0.000184356 6.22705e-005 Results for Meyer's (reformulated) problem: Levenberg-Marquardt returned 214 in 214 iter, reason 2 Solution: 2.481778 6.181346 3.502236 Minimization info: 1308.25 8.79459e-005 6.18202e-008 6.25475e-031 1960.95 214 2 281 22 215 ---------------------------------- I'm really desperate :( I have tried to create the levmar-MEX-file for 2 days. I need this for an nonlinear least square optimiztaion (with box constraints) in MATLAB. I don't have the optimizitaion toolbox. I have tried LMFnlsq (http://www.mathworks.com/matlabcentral/fileexchange/17534), but this is unconstrained. The second point is the speed, I think that a MEX file will be faster... I'm really glad for any help. Regard, PW
From: Peter Williert on 23 May 2010 06:23 PROBLEM SOLVED! :) I have used as compiler: Microsoft Visual C++ 2008 SP1. Now it works. lmdemo.m runs without error. Here is the MEX file: http://ifile.it/y23mip0/levmar-mexw32.zip (Libraries used for compilation: CLAPACK, BLAS, F2C with MS Visual Studio 10 Express) If you want full performance, you should compile it on your machine (and use i.e. GotoBLAS). PW
From: Peter Williert on 24 May 2010 08:51 To use this mexw32 file above you have to put the blas und clapack dll from http://www.stanford.edu/~vkl/code/libs.html in windwos/system32.
|
Pages: 1 Prev: ginput on a curve Next: Alignment of strings |