Bug 43322 - compiling under Matlab with gfortran
Summary: compiling under Matlab with gfortran
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-10 15:33 UTC by Rosa Balbín
Modified: 2010-03-17 21:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rosa Balbín 2010-03-10 15:33:10 UTC
Mac> gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5646.1~2/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)

-------
Under Matlab 7.9.0.529 (R2009b)

>> mex -v prueba.f
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
   FILE = /Users/balbin/.matlab/R2009b/mexopts.sh
----------------------------------------------------------------
->    MATLAB                = /Applications/MATLAB_R2009b.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_R2009b.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_R2009b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    FC                    = gfortran
->    FC flags:
         FFLAGS             = -fexceptions -m64 -fbackslash
         FDEBUGFLAGS        = -g
         FOPTIMFLAGS        = -O
         FLIBS              = -L/Applications/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/../../.. -lgfortran -L/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/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_R2009b.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_R2009b.app/extern/include -I/Applications/MATLAB_R2009b.app/simulink/include -fexceptions -m64 -fbackslash  -DMX_COMPAT_32 -O  "prueba.f"

dyld: Library not loaded: /usr/local/lib/libmpfr.1.dylib
  Referenced from: /usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/f951
  Reason: Incompatible library version: f951 requires version 4.0.0 or later, but libmpfr.1.dylib provides version 3.0.0
gfortran: Internal error: Trace/BPT trap (program f951)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

    mex: compile of ' "prueba.f"' failed.

??? Error using ==> mex at 221
Unable to complete successfully.
----------------------

under darwin it works:

Mac> gfortran -v prueba.f
Driving: gfortran -mmacosx-version-min=10.6.2 -v prueba.f -lgfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/lto-wrapper
Target: x86_64-apple-darwin10.2.0
Configured with: /Developer/instaladores/gcc/configure --enable-languages=c,fortran
Thread model: posix
gcc version 4.5.0 20100309 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-shared-libgcc' '-mtune=generic'
 /usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/f951 prueba.f -ffixed-form -fPIC -quiet -dumpbase prueba.f -mmacosx-version-min=10.6.2 -mtune=generic -auxbase prueba -version -fintrinsic-modules-path /usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/finclude -o /var/folders/vo/vocAT36r2RWNJU+1YwQ30++++TM/-Tmp-//ccQKwi14.s
GNU Fortran (GCC) version 4.5.0 20100309 (experimental) (x86_64-apple-darwin10.2.0)
	compiled by GNU C version 4.5.0 20100309 (experimental), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.5.0 20100309 (experimental) (x86_64-apple-darwin10.2.0)
	compiled by GNU C version 4.5.0 20100309 (experimental), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-shared-libgcc' '-mtune=generic'
 as -arch x86_64 -force_cpusubtype_ALL -o /var/folders/vo/vocAT36r2RWNJU+1YwQ30++++TM/-Tmp-//ccrm3kY3.o /var/folders/vo/vocAT36r2RWNJU+1YwQ30++++TM/-Tmp-//ccQKwi14.s
COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/:/usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/:/usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/:/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/:/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/
LIBRARY_PATH=/opt/intel/Compiler/11.1/084/lib/:/opt/intel/Compiler/11.1/084/Frameworks/mkl/lib/em64t/:/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/:/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-shared-libgcc' '-mtune=generic'
 /usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.2 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/opt/intel/Compiler/11.1/084/lib -L/opt/intel/Compiler/11.1/084/Frameworks/mkl/lib/em64t -L/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0 -L/usr/local/lib/gcc/x86_64-apple-darwin10.2.0/4.5.0/../../.. /var/folders/vo/vocAT36r2RWNJU+1YwQ30++++TM/-Tmp-//ccrm3kY3.o -lgfortran -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind -lSystem
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-shared-libgcc' '-mtune=generic'
Mac> a.out
  
 Hola Mundo
Mac> cat prueba.f
	program prueba
c  para ver si funciona el compilador ifort y gfortran

		implicit none
      call system('echo `whoami` `date` '//
     +     '>> /Users/balbin/fortran_libs/prueba.usr') 


        write(*,*)' '
        write(*,*)'Hola Mundo'


	stop
	end
	

Mac> 

Thanks
Comment 1 Daniel Franke 2010-03-10 15:52:49 UTC
dyld: Library not loaded: /usr/local/lib/libmpfr.1.dylib
  Referenced from: /usr/local/libexec/gcc/x86_64-apple-darwin10.2.0/4.5.0/f951
  Reason: Incompatible library version: f951 requires version 4.0.0 or later,
but libmpfr.1.dylib provides version 3.0.0

And what's so difficult about this? Update mpfr and go?!

Besides, you seem to mix 3 versions, 4.0, 4.2.1 and 4.5.0 - get yourself sorted.
Comment 2 Paul Thomas 2010-03-17 21:07:49 UTC
As Daniel has indicated, this has nothing to do with gfortran.

Paul