Boost logo

Ublas :

From: wedekind (wedekind_at_[hidden])
Date: 2007-07-30 11:08:15


Hello Georg,

>> What I've achieved so far is to compile lapack using MinGW.
>
>I did exactly the same.
>
>> Unfortunately
>> MinGW's fortran compiler g77 suffixes symbols with underscores. But the
>> C++ linker (from M$ Visual C++) expects the same symbols without these
>> underscores.
>
>The cause is not the linker, but the headers in the bindings that declare
>the fortran functions.
>
>> I have then compiled lapack (using g77) with
>> -fno-second-underscore or -fno-underscoring to no avail! My sample
>> application now successfully links but according to the "Dependency
>> Walker" tool from Visual Studio it does not depend on the lapack-dll and
>> crashes with a memory read exception on startup :( I guess the not
>> recommended underscoring-options have done more harm than good.
>
>Getting the dll stuff right is tricky, because AFAIK gcc and MSVC create
>dlls a bit differently. I simply used a static lib.
>
>> So my question is (after trying it nearly whole 2 days on myself
>> including extensive web-search): Is there a recommended way to build
>> lapack so that it can be used with the boost::numeric::bindings::lapack?
>
>It can be done the other way round: You can apply the patch I sent in
>http://lists.boost.org/MailArchives/ublas/2007/04/2056.php to the bindings.
>Then you can use g77 compiled fortran stuff from MSVC if you add the define
>BIND_FORTRAN_LOWERCASE_UNDERSCORE to your C++ project.
>
>I did not know about the -f options, I guess they should also work instead
>of the patch if you use a static lib.
>
>
>Georg
>

Thanks for your reply. Using the static lapack-lib is working now :)

Just for the record - How to build a static lapack lib to be used with a
MSVC C++ project:

* download lapack and extract it to <lapackDIR>
* copy INSTALL/make.inc.LINUX to <lapackDIR> and rename it to make.inc
* goto <lapackDIR>/BLAS/SRC and run mingw32-make.exe there (MinGW's bin-dir
should be in the PATH)
* goto $ lapackDIR/SRC and run mingw32-make.exe there (MinGW's bin-dir
should be in the PATH)
* copy <lapackDIR>/lapack_LINUX.a to <your/destination/path>/lapack.lib
* copy <lapackDIR>/blas_LINUX.a to <your/destination/path>/blas.lib
* copy <MinGW-dir>/lib/libg2c.a to <your/destination/path>/g2c.lib
* copy <MinGW-dir>/lib/gcc/mingw32/3.4.2/libgcc.a to
<your/destination/path>/gcc.lib
* link your MSVC-project to lapack.lib, blas.lib, gcc.lib and g2c.lib

Cheers!

Marco