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
> to the bindings.
>Then you can use g77 compiled fortran stuff from MSVC if you add the define
>I did not know about the -f options, I guess they should also work instead
>of the patch if you use a static lib.

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/ to <lapackDIR> and rename it to
* 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
* link your MSVC-project to lapack.lib, blas.lib, gcc.lib and g2c.lib