This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

MEX interface + DAE solvers in Fortran + gnumex/cygwin/mingw


Hi,

I try to make a DAE solver work for my problems using the mex interface
between Fortran and MATLAB. That is, I installed gnumex, Cygwin, and
Mingw according to

http://gnumex.sourceforge.net/

and built the mex interface between fortran and MATLAB 6.5.1.

It turns out that it successfully compiles the test files yprimef.f and
yprimefg.f and runs it.

mex -f mexopts.bat -v -O -output yprime yprimef.f yprimefg.f
This is mex, Copyright 1984-2002 The MathWorks, Inc.
...
yprimef(1, 1:4)
ans =
   2.0000    8.9685    4.0000   -1.0947

I then have been trying to compile mex interfaces for RADAU, one of the
ODE/DAE solvers, from

http://www-m3.ma.tum.de/twiki/bin/view/Software/ODEWebHome#ODE_MEXfiles_Homepage

and its solvers from

http://www.unige.ch/~hairer/software.html

Similarly, I have problems compiling DASSL and a test set (Test Set for
IVP Solvers) from

http://pitagora.dm.uniba.it/~testset//instruc.htm

as can be seen below.

I guess it is a problem related to my mex interface configuration.

If you have an idea please let me know.

Thank you!

Hannes


Appendix 0: my mexopts.bat file


@echo off
rem C:\Documents and Settings\student\Application
Data\MathWorks\MATLAB\R13\mexopts.bat
rem Generated by gnumex.m script in c:\gnumex
rem gnumex version: 1.11
rem Compile and link options used for building MEX etc files with
rem the Mingw/Cygwin tools.  Options here are:
rem Mingw linking
rem Mex (*.dll) creation
rem Safe linking to temporary libraries
rem Language: Fortran
rem Compiling for pentium and above
rem Matlab version 6.5
rem
set MATLAB=C:\MATLAB~1
set GM_PERLPATH=C:\MATLAB~1\sys\perl\win32\bin\perl.exe
set GM_UTIL_PATH=c:\gnumex
set PATH=c:\mingw\bin;%PATH%
rem
rem Added libraries for linking
set GM_ADD_LIBS=-lg2c
rem
rem Type of file to compile (mex or engine)
set GM_MEXTYPE=mex
rem
rem Language for compilation
set GM_MEXLANG=f
rem
rem def files to be converted to libs
set GM_DEFS2LINK=libmx.def;libmex.def;libmat.def;_libmatlbmx.def;
rem
rem dlltool command line
set GM_DLLTOOL=c:\gnumex\mexdlltool -E --as c:\mingw\bin\as.exe
rem
rem compiler options; add compiler flags to compflags as desired
set NAME_OBJECT=-o
set COMPILER=gcc
set COMPFLAGS=-c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring
-fleading-underscore
set OPTIMFLAGS=-O3 -malign-double -fno-exceptions -mcpu=pentium
set DEBUGFLAGS=-g
rem
rem NB Library creation commands occur in linker scripts
rem
rem Linker parameters
set LINKER=%GM_PERLPATH% %GM_UTIL_PATH%\linkmex.pl
set LINKFLAGS=
set LINKOPTIMFLAGS=-s
set LINKDEBUGFLAGS=-g  -Wl,--image-base,0x28000000\n
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=-o %OUTDIR%%MEX_NAME%.dll
rem
rem Resource compiler parameters
set RC_COMPILER=%GM_PERLPATH% %GM_UTIL_PATH%\rccompile.pl  -o
%OUTDIR%mexversion.res
set RC_LINKER=


Appendix 1:compilation trial with RADAU and driver


mex -v -DFORTRANUPP -DFORTRANNOUNDER -f C:\mex\mexopts\mexopts.bat
-O -output VDPOL radau.f dr_radau.f
This is mex, Copyright 1984-2002 The MathWorks, Inc.

-> Options file specified on command line
----------------------------------------------------------------
->    Options file           = C:\ThesisWork_HG\mex\mexopts\mexopts.bat
     MATLAB                 = C:\MATLAB~1
->    COMPILER               = gcc
->    Compiler flags:
        COMPFLAGS           = -c -DMATLAB_MEX_FILE -mrtd -fcase-upper
-fno-underscoring -fleading-underscore
        OPTIMFLAGS          = -O3 -malign-double -fno-exceptions
-mcpu=pentium
        DEBUGFLAGS          = -g
        arguments           =  -DFORTRANUPP -DFORTRANNOUNDER
        Name switch         = -o
->    Pre-linking commands   =
->    LINKER                 = C:\MATLAB~1\sys\perl\win32\bin\perl.exe
c:\gnumex\linkmex.pl
->    Link directives:
        LINKFLAGS           =
        LINKFLAGSPOST       =
        Name directive      = -o VDPOL.dll
        File link directive =
        Lib. link directive =
        Rsp file indicator  =
->    Resource Compiler      = C:\MATLAB~1\sys\perl\win32\bin\perl.exe
c:\gnumex\rccompile.pl  -o mexversion.res
->    Resource Linker        =
----------------------------------------------------------------


--> "gcc -DFORTRANUPP -DFORTRANNOUNDER -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -oradau.obj -O3 -malign-double -fno-exceptions -mcpu=pentium radau.f"


--> "gcc -DFORTRANUPP -DFORTRANNOUNDER -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -odr_radau.obj -O3 -malign-double -fno-exceptions -mcpu=pentium dr_radau.f"


--> "C:\MATLAB~1\sys\perl\win32\bin\perl.exe c:\gnumex\linkmex.pl -o VDPOL.dll -s radau.obj dr_radau.obj "

Cannot export MEXFUNCTION: symbol not defined
radau.obj(.text+0x1fba):radau.f: undefined reference to `DECOMR'
radau.obj(.text+0x20c6):radau.f: undefined reference to `DECOMC'
radau.obj(.text+0x242f):radau.f: undefined reference to `SLVRAR'
radau.obj(.text+0x26aa):radau.f: undefined reference to `ESTRAV'
radau.obj(.text+0x3693):radau.f: undefined reference to `SLVRAR'
radau.obj(.text+0x37d0):radau.f: undefined reference to `SLVRAI'
radau.obj(.text+0x3ed9):radau.f: undefined reference to `ESTRAV'
radau.obj(.text+0x4c47):radau.f: undefined reference to `SLVRAR'
radau.obj(.text+0x4d84):radau.f: undefined reference to `SLVRAI'
radau.obj(.text+0x52c4):radau.f: undefined reference to `ESTRAV'
radau.obj(.text+0x5e03):radau.f: undefined reference to `SLVRAD'
radau.obj(.text+0x6191):radau.f: undefined reference to `ESTRAD'

C:\MATLAB6P5\BIN\WIN32\MEX.PL: Error: Link of 'VDPOL.dll' failed.

??? Error using ==> mex
Unable to complete successfully



Appendix 2:compilation trial with DASSL and test set

mex -f C:\mex\mexopts\mexopts.bat -v -O -output VDPOL dassld.f
vdpol.f dassla.f ddassl.f report.f
This is mex, Copyright 1984-2002 The MathWorks, Inc.

-> Options file specified on command line
----------------------------------------------------------------
->    Options file           = C:\ThesisWork_HG\mex\mexopts\mexopts.bat
     MATLAB                 = C:\MATLAB~1
->    COMPILER               = gcc
->    Compiler flags:
        COMPFLAGS           = -c -DMATLAB_MEX_FILE -mrtd -fcase-upper
-fno-underscoring -fleading-underscore
        OPTIMFLAGS          = -O3 -malign-double -fno-exceptions
-mcpu=pentium
        DEBUGFLAGS          = -g
        arguments           =
        Name switch         = -o
->    Pre-linking commands   =
->    LINKER                 = C:\MATLAB~1\sys\perl\win32\bin\perl.exe
c:\gnumex\linkmex.pl
->    Link directives:
        LINKFLAGS           =
        LINKFLAGSPOST       =
        Name directive      = -o VDPOL.dll
        File link directive =
        Lib. link directive =
        Rsp file indicator  =
->    Resource Compiler      = C:\MATLAB~1\sys\perl\win32\bin\perl.exe
c:\gnumex\rccompile.pl  -o mexversion.res
->    Resource Linker        =
----------------------------------------------------------------


--> "gcc -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -odassld.obj -O3 -malign-double -fno-exceptions -mcpu=pentium dassld.f"


--> "gcc -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -ovdpol.obj -O3 -malign-double -fno-exceptions -mcpu=pentium vdpol.f"


--> "gcc -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -odassla.obj -O3 -malign-double -fno-exceptions -mcpu=pentium dassla.f"


--> "gcc -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -oddassl.obj -O3 -malign-double -fno-exceptions -mcpu=pentium ddassl.f"


--> "gcc -c -DMATLAB_MEX_FILE -mrtd -fcase-upper -fno-underscoring -fleading-underscore -oreport.obj -O3 -malign-double -fno-exceptions -mcpu=pentium report.f"

report.f: In subroutine `GETINP':
report.f:94: warning:
       +                 driver(:lnblnk(driver)),'.f'
                                 1
report.f:201: (continued):
       +        fullnm(:lnblnk(fullnm)),
                        2
Same name `LNBLNK' used for global at (2) and intrinsic at (1) [info -f
g77 M INTGLOB]
report.f: Outside of any program unit:
report.f:201: warning:
       +        fullnm(:lnblnk(fullnm)),
                        1
report.f:660: (continued):
        integer function lnblnk(string)
                         2
Same name `LNBLNK' used for global at (2) and intrinsic at (1) [info -f
g77 M INTGLOB]

--> "C:\MATLAB~1\sys\perl\win32\bin\perl.exe c:\gnumex\linkmex.pl -o
VDPOL.dll  -s  dassld.obj  vdpol.obj  dassla.obj  ddassl.obj  report.obj "

Cannot export MEXFUNCTION: symbol not defined

C:\MATLAB6P5\BIN\WIN32\MEX.PL: Error: Link of 'VDPOL.dll' failed.

??? Error using ==> mex
Unable to complete successfully






-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]