Using levmar 2.6 with Visual Studio

On my previous post, I posted how to compile levmar 2.5 with visual studio 2010. Since the procedure mentioned there is not enough to compile levmar 2.6, I write how to solve the compilation issue even though the chips is written on levmar FAQ.

  1. link error of LAPACK lib files
    CmakeLists.txt of levmar 2.6 assumes that you put all lapack related .lib files into one directory. In Cmake GUI, it’s called LAPACKBLAS_DIR that is pre-defined as ‘/usr/lib’. If you compile clapack by yourself, the lib files are generated in different directories not in a directory. To use original CmakeLists.txt, you should put the .lib files into one directory and set LAPACKBLAS_DIR on Cmake GUI. Then, link problem should be solved.
  2. Link error related to sgemm and dgemm
    You may face another link error with the generated solution file. The error is like:
    levmar.lib(misc.obj) : error LNK2019: unresolved external symbol _sgemm_ referenced in function _slevmar_trans_mat_mat_mult
    levmar.lib(misc.obj) : error LNK2019: unresolved external symbol _dgemm_ referenced in function _dlevmar_trans_mat_mat_mult

    This problem is mentioned in levmar FAQ 27. Following the FAQ, I could compile levmar and run the example program. What I did was:

    1. Uncomment the line 31 of ”#define LM_BLAS_PREFIX f2c_”.
    2. Comment out the line 37 of “#define LM_BLAS_SUFFIX _
    3. Uncomment the line 35 of “#define LM_BLAS_SUFFIX”.

    Next, I compiled levmar with HAVE_LAPACK option. Then, the compilation was successfully done.

  3. Necessary .h file and .lib files
    After that, I could compile the expfit.c with some modification. What I did was to specify the include file “levmar.h” and library files “blas.lib”, “lapack.lib”, “tmglib.lib”, “libf2c.lib”, and “levmar.lib”.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s