Question

I'm trying to get Arpack and Arpack++ to work in Windows 7 with Visual Studio 2010, and use swig to make an interface that can be used with C#. This is basically to create a benchmark against which I will measure all further attempts at solving eigenvector problems with C#, but first I need this to work.

I have managed to compile Arpack using this guide, albeit with slight alterations since g77 is no longer the Fortran compiler that comes with MinGW, instead we get gfortran. Further changes to ARmake.inc included commenting out the -cg89 option, which generated an error (I do not know which purpose this filled with g77, but gfortran does not accept it).

Following the guide further, thinking "at least it's compiled now, with or without option." I continued to dllwrap. However, the -lg2c option was not accepted, since the library file libg2cis not included in the newer version of MinGW. If I try without the option, I get errors about undefined references from some of my .o and corresponding .f-files. What library files should I use? Am I doing something else glaringly wrong?

Était-ce utile?

La solution

I found the key seems to be use gfortran instead of dllwrap. Here's the whole process I used after installing MinGW and msys

1) Run the post install script and make sure it doesn't complain about missing gcc, etc. If it does, install those packages.

msys\1.0\postinstall\pi.bat

2) Extract ARPACK files and the patch into msys\1.0\home\yourname\ARPACK

3) Edit ARmake.inc and change the FC and FFLAGS lines to:

FC      = gfortran
#FFLAGS = -O -cg89

4) Edit UTIL/second.f and replace everything with this. This prevents an error about ETIME. Not sure what it does but it's suggested by http://blog.csdn.net/guillotine007/article/details/8636647

  SUBROUTINE SECOND( T )

  REAL       T

  CALL CPU_TIME(T)

  RETURN

  END

5) Compile to .o files

make lib

6) Use gfortran instead of dllwrap to link and create the dll

gfortran -shared BLAS/*.o LAPACK/*.o SRC/*.o UTIL/*.o -o arpack_win32.dll

7) The resulting dll depends on 3 other dlls: libgcc_s_dw2-1.dll, libgfortran-3.dll, libquadmath-0.dll which you can get from the MinGW installation.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top