Compiling FORTRAN on maci64 architecture

  • Follow


I have some routines that I use for a long time (already got them compiled), but now I need to compile them for the 64 bits Mac architecture. I already lost 2 or 3 days, but I can not make it work. Can some please help me?

----------------------------------------------------------------
-> options file specified on command line:
   FILE = ./mexopts_gfortran.sh
----------------------------------------------------------------
->    MATLAB                = /Applications/MATLAB_R2010a.app
->    CC                    = gcc-4.0
->    CC flags:
         CFLAGS             = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5  -fexceptions
         CDEBUGFLAGS        = -g
         COPTIMFLAGS        = -O2 -DNDEBUG
         CLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    CXX                   = g++-4.0
->    CXX flags:
         CXXFLAGS           = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
         CXXDEBUGFLAGS      = -g
         CXXOPTIMFLAGS      = -O2 -DNDEBUG
         CXXLIBS            = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    FC                    = gfortran
->    FC flags:
         FFLAGS             = -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form
         FDEBUGFLAGS        = -g
         FOPTIMFLAGS        = -O
         FLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/lib/gcc/x86_64-apple-darwin10/4.5.0/../../.. -lgfortran -L/usr/local/lib/gcc/x86_64-apple-darwin10/4.5.0 -lgfortranbegin
         arguments          =  -DMX_COMPAT_32
->    LD                    = gcc-4.0
->    Link flags:
         LDFLAGS            = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010a.app/extern/lib/maci64/fexport.map
         LDDEBUGFLAGS       = -g
         LDOPTIMFLAGS       = -O
         LDEXTENSION        = .mexmaci64
         arguments          = 
->    LDCXX                 = 
->    Link flags:
         LDCXXFLAGS         = 
         LDCXXDEBUGFLAGS    = 
         LDCXXOPTIMFLAGS    = 
         LDCXXEXTENSION     = 
         arguments          = 
----------------------------------------------------------------

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "refpropm.f90"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/SETUP.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/UTILITY.for"

../FORTRAN/UTILITY.for:1218.72:

          if (ABS(iprnterr).ge.3)  pause                                
                                                                        1
Warning: Deleted feature: PAUSE statement at (1)
-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/TRNSP.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/TRNS_VIS.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/TRNS_TCX.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/TRNS_ECS.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/SETUP2.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/SAT_SUB.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/REALGAS.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/PROP_SUB.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/MIX_HMX.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/MIX_AGA8.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/IDEALGAS.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/FLSH_SUB.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/FLASH2.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_STN.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_PR.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_PH0.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_MLT.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_FEQ.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_ECS.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_DE.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_CPP.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_BWR.for"

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -m64 -x f95-cpp-input -fexceptions -cpp -ffixed-form  -DMX_COMPAT_32 -g  "./FORTRAN/CORE_ANC.for"

-> gcc-4.0 -g -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010a.app/extern/lib/maci64/fexport.map -o  "refpropm.mexmaci64"  refpropm.o SETUP.o UTILITY.o TRNSP.o TRNS_VIS.o TRNS_TCX.o TRNS_ECS.o SETUP2.o SAT_SUB.o REALGAS.o PROP_SUB.o MIX_HMX.o MIX_AGA8.o IDEALGAS.o FLSH_SUB.o FLASH2.o CORE_STN.o CORE_PR.o CORE_PH0.o CORE_MLT.o CORE_FEQ.o CORE_ECS.o CORE_DE.o CORE_CPP.o CORE_BWR.o CORE_ANC.o  -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/lib/gcc/x86_64-apple-darwin10/4.5.0/../../.. -lgfortran -L/usr/local/lib/gcc/x86_64-apple-darwin10/4.5.0 -lgfortranbegin

Undefined symbols:
  "_mxcopyreal8toptr_", referenced from:
      _mexfunction_ in refpropm.o
      _mexfunction_ in refpropm.o
      _mexfunction_ in refpropm.o
      _mexfunction_ in refpropm.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

    mex: link of ' "refpropm.mexmaci64"' failed.
0
Reply Tiago 6/4/2010 2:56:04 AM

On 4 Jun, 04:56, "Tiago " <timacar...@hotmail.com> wrote:
> I have some routines that I use for a long time (already got them compile=
d), but now I need to compile them for the 64 bits Mac architecture. I alre=
ady lost 2 or 3 days, but I can not make it work. Can some please help me?
.....
> Undefined symbols:
> =A0 "_mxcopyreal8toptr_", referenced from:
> =A0 =A0 =A0 _mexfunction_ in refpropm.o
> =A0 =A0 =A0 _mexfunction_ in refpropm.o
> =A0 =A0 =A0 _mexfunction_ in refpropm.o
> =A0 =A0 =A0 _mexfunction_ in refpropm.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
>
> =A0 =A0 mex: link of ' "refpropm.mexmaci64"' failed.

The problem seems obvious: The linker can't find any object code
for  mxCopyReal8ToPtr, which is a lbrary MEX code. This, in turn,
points to either a problem with the MEX library on your platform,
which would be a question for matlab tech support, or a problem
with your compiler directives that might have confused the linker.

The approach:

1) Write a minimum mex file that accesses the offending function,
   mxCopyReal8ToPtr, and see if the problem occurs.

2) If 'no' start troubleshooting to find out what is different
   in your large system, and what might have thrown the linker
   off its track.

3) If 'yes' submit this minimum example to matlab tech support,
   as there is a problem with the mex library.

Rune
0
Reply Rune 6/4/2010 9:15:28 AM


Have you figured this out ? I'm having a similar problem. 
0
Reply christopher.beattie.ctr (2) 5/26/2011 10:23:02 PM

"Christopher" wrote in message <irmjs6$coe$1@newscl01ah.mathworks.com>...
> Have you figured this out ? I'm having a similar problem. 

I would consider downloading f2c from www.netlib.org and first converting the fortran function to C code. You can then write a mex gateway function which calls the appropriate code.

I found working with C mex files generally much easier in matlab as the compiler support is much superior.
0
Reply r.crozier (85) 5/27/2011 10:22:07 AM

3 Replies
210 Views

(page loaded in 0.081 seconds)

Similiar Articles:




7/18/2012 10:13:29 PM


Reply: