[Rd] call fortran in R

stefano iacus jago at mclink.it
Fri Aug 5 23:07:18 CEST 2005


Sebastien,

if you want to use the R binary from CRAN, then you should assume gcc  
3.3 and g77 3.4.2 (which comes with the installer for this reason).
You can force gcc to default to 3.3 using sudo gcc_select 3.3
and sudo gg_select 4.0 to restore the new compiler.


If you want to use gcc 4.0 and gfortran, then you need to rebuild  
ALSO R from sources.
If you are developing a package you probably want to build R from r- 
devel sources (we have recently fixed some configuration issues).

I suggest you to read R for Mac OS X FAQ and also http:// 
wiki.urbanek.info/index.cgi?TigeR

stefano


On 05/ago/05, at 21:38, Sébastien Durand wrote:

> I am starting to get confused,
>
> What should I used to make sure I got the corrected and most recent
> setup that will allow me to correctly compile and run fortran routine
> under R.2.1.1
>
> Please note that I am using the last version of MAC OS X, TIGER which
> is 10.4.2
>
> And that I have presently installed Developer tools (XCODE), 2.2.
>
>
> For your own information what I have presently installed is :
>
> Double-G5:~ sebas$ gfortran -v
> Using built-in specs.
> Target: powerpc-apple-darwin8.1.0
> Configured with: ../gcc-4.1-20050611/configure --enable-threads=posix
> --enable-languages=c++,f95
> Thread model: posix
> gcc version 4.1.0 20050611 (experimental)
>
> Double-G5:~ sebas$ gcc -v
> Using built-in specs.
> Target: powerpc-apple-darwin8
> Configured with: /private/var/tmp/gcc/gcc-5026.obj~19/src/configure --
> disable-checking --prefix=/usr --mandir=/share/man --enable-
> languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/
> s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --
> build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --
> target=powerpc-apple-darwin8
> Thread model: posix
>
> gcc version 4.0.0 (Apple Computer, Inc. build 5026)
> Double-G5:~ sebas$ g77 -v
> Reading specs from /usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2/
> specs
> Configured with: ../gcc/configure --enable-threads=posix --enable-
> languages=f77 --disable-shared --enable-static
> Thread model: posix
> gcc version 3.4.2
>
> Thanks in advance
>
>
>
>
>> please don't mix gcc 4.0 and g77. Also don't mix R binary which is
>> gcc-3.3/g77-3.4.2 with gcc4 or gfortran.
>> stefano
>>
>> On 04/ago/05, at 17:25, Sébastien Durand wrote:
>>
>>
>>
>>> Dear all,
>>>
>>> Since the command you ask me to type doesn't show anything
>>> Here some more information, on my system and on the foo.so
>>> compiled file
>>>
>>> I am using g77 version 3.4.4  Configured with: ../gcc/configure --
>>> enable-threads=posix --enable-languages=f77
>>>
>>> I am using gcc version 4.0.0 20041026 (Apple Computer, Inc. build
>>> 4061)
>>>          Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/
>>> configure --disable-checking --prefix=/usr --mandir=/share/man --
>>> enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^ 
>>> [cg][^
>>> +.-]*$/s/$/-4.0/
>>>          --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --
>>> build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --
>>> target=powerpc-apple-darwin8
>>>
>>> I don't know if this can be of any help to you but there is again  
>>> how
>>> I compile the foo.f
>>>
>>> Double-G5:~ sebas$ R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.f
>>>          g77   -fno-common  -g -O2 -c /Users/sebas/Desktop/
>>> Fortan_kmeans/kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/
>>> kmeans3.o
>>>          gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/
>>> local/lib -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/
>>> sebas/Desktop/Fortan_kmeans/kmeans3.o  -L/usr/local/lib/gcc/powerpc-
>>> apple-darwin6.8/3.4.2 -lg2c -lSystem -framework R
>>>
>>>
>>> There is all the info about the foo.so file using nm -a option
>>> instead of -g:
>>>
>>>
>>> Double-G5:~ sebas$ nm -a ~/Desktop/Fortan_kmeans/kmeans3.so
>>> 00000fe4 - 01 0114 SLINE
>>> 00000fb0 - 01 0000    SO
>>> 00000fd8 - 01 010d SLINE
>>> 00000fdc - 01 010e SLINE
>>> 00000fe0 - 01 010f SLINE
>>> 00000fec - 01 0116 SLINE
>>> 00000fe8 - 01 0115 SLINE
>>> 00001000 - 01 0000    SO
>>> 00001000 - 01 011b SLINE
>>> 00000ffc - 01 011a SLINE
>>> 00000ff8 - 01 0119 SLINE
>>> 00000fb4 - 01 0104 SLINE
>>> 00000fb8 - 01 0105 SLINE
>>> 00000fbc - 01 0106 SLINE
>>> 00000fc0 - 01 0107 SLINE
>>> 00000fc4 - 01 0108 SLINE
>>> 00000ff4 - 01 0118 SLINE
>>> 00000fc8 - 01 0109 SLINE
>>> 00000fcc - 01 010a SLINE
>>> 00000fd0 - 01 010b SLINE
>>> 00000fd4 - 01 010c SLINE
>>> 00000ff0 - 01 0117 SLINE
>>> 00000fb0 - 01 0000   SOL /SourceCache/Csu/Csu-57//
>>> 00000fb0 - 01 0000   SOL /SourceCache/Csu/Csu-57/bundle1.s
>>> 00000fb0 - 01 0000   SOL /SourceCache/Csu/Csu-57/bundle1.s
>>> 00000fb0 - 01 0000   SOL /SourceCache/Csu/Csu-57/bundle1.s
>>> 00000fb0 - 01 0000    SO /Users/sebas/
>>> 00000fb0 - 01 0000    SO /Users/sebas/Desktop/Fortan_kmeans/ 
>>> kmeans3.f
>>> 00000fb0 - 01 0000   SOL <built-in>
>>> 00000fb0 - 01 0000   SOL <command line>
>>> 00000fe0 t __dyld_func_lookup
>>> 00000fe0 - 01 0113   FUN __dyld_func_lookup:F3
>>> 00000000 - 00 0000  LSYM __g77_f2c_address:t(0,10)=*(0,11)=@s8;r
>>> (0,11);-128;127;
>>> 00000000 - 00 0000  LSYM __g77_f2c_complex:t(0,7)=R3;8;0;
>>> 00000000 - 00 0000  LSYM __g77_f2c_doublecomplex:t(0,6)=R3;16;0;
>>> 00000000 - 00 0000  LSYM __g77_f2c_doublereal:t(0,8)=r(0,0);8;0;
>>> 00000000 - 00 0000  LSYM __g77_f2c_flag:t(0,3)=r
>>> (0,3);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM __g77_f2c_ftnint:t(0,1)=r
>>> (0,1);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM __g77_f2c_ftnlen:t(0,2)=r
>>> (0,2);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM __g77_f2c_integer:t(0,12)=r
>>> (0,12);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM __g77_f2c_logical:t(0,4)=r
>>> (0,4);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM __g77_f2c_longint:t(0,5)=@s64;r(0,5);
>>> 001000000000000000000000;000777777777777777777777;
>>> 00000000 - 00 0000  LSYM __g77_f2c_real:t(0,9)=r(0,0);4;0;
>>> 00000000 t __mh_bundle_header
>>> 00000000 - 00 0000  LSYM byte:t(0,26)=@s8;r(0,26);-128;127;
>>> 00000000 - 00 0000  LSYM char:t(0,46)=@s8;r(0,46);0;255;
>>> 00000000 - 00 0000  LSYM char:t2=r2;0;127;
>>> 00000000 - 00 0000  LSYM complex double:t(0,31)=R3;16;0;
>>> 00000000 - 00 0000  LSYM complex float:t(0,32)=R3;8;0;
>>> 00000000 - 00 0000  LSYM complex int:t(0,33)=s8real:(0,34)=r
>>> (0,34);-2147483648;2147483647;,0,32;imag:(0,34),32,32;;
>>> 00000000 - 00 0000  LSYM complex long double:t(0,30)=R3;16;0;
>>> 00000000 - 00 0000  LSYM complex:t(0,14)=R3;8;0;
>>> 00000000 - 00 0000  LSYM double complex:t(0,13)=R3;16;0;
>>> 00000000 - 00 0000  LSYM double precision:t(0,15)=r(0,0);8;0;
>>> 00000000 - 00 0000  LSYM double:t(0,36)=r(0,34);8;0;
>>> 00001000 d dyld__mh_bundle_header
>>> 00001008 s dyld_func_lookup_pointer
>>> 00001004 s dyld_lazy_symbol_binding_entry_point
>>> 00000fb0 t dyld_stub_binding_helper
>>> 00000fb0 - 01 0103   FUN dyld_stub_binding_helper:F3
>>> 00000000 - 00 0000  LSYM float:t(0,37)=r(0,34);4;0;
>>> 00000000 - 00 0000   OPT gcc2_compiled.
>>> 00000000 - 00 0000  LSYM int:t(0,34)
>>> 00000000 - 00 0000  LSYM int:t1=r1;-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM integer4:t(0,22)=@s64;r(0,22);
>>> 001000000000000000000000;000777777777777777777777;
>>> 00000000 - 00 0000  LSYM integer:t(0,28)=r
>>> (0,28);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM logical2:t(0,19)=@s8;r(0,19);-128;127;
>>> 00000000 - 00 0000  LSYM logical3:t(0,18)=@s16;r(0,18);-32768;32767;
>>> 00000000 - 00 0000  LSYM logical4:t(0,17)=@s64;r(0,17);
>>> 001000000000000000000000;000777777777777777777777;
>>> 00000000 - 00 0000  LSYM logical:t(0,20)=r
>>> (0,20);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM long double:t(0,35)=r(0,34);8;0;
>>> 00000000 - 00 0000  LSYM long int:t(0,45)=r
>>> (0,45);-2147483648;2147483647;
>>> 00000000 - 00 0000  LSYM long long int:t(0,42)=@s64;r(0,42);
>>> 001000000000000000000000;000777777777777777777777;
>>> 00000000 - 00 0000  LSYM long long unsigned int:t(0,41)=@s64;r 
>>> (0,41);
>>> 000000000000000000000000;001777777777777777777777;
>>> 00000000 - 00 0000  LSYM long unsigned int:t(0,43)=r(0,43);
>>> 000000000000000000000000;000000000000037777777777;
>>> 00000000 - 00 0000  LSYM real:t(0,16)=r(0,0);4;0;
>>> 00000000 - 00 0000  LSYM short int:t(0,40)=@s16;r 
>>> (0,40);-32768;32767;
>>> 00000000 - 00 0000  LSYM short unsigned int:t(0,39)=@s16;r(0,39);
>>> 0;65535;
>>> 00000000 - 00 0000  LSYM signed char:t(0,11)
>>> 00000000 - 00 0000  LSYM unsigned byte:t(0,25)=@s8;r(0,25);0;255;
>>> 00000000 - 00 0000  LSYM unsigned char:t(0,38)=@s8;r(0,38);0;255;
>>> 00000000 - 00 0000  LSYM unsigned int:t(0,44)=r(0,44);
>>> 000000000000000000000000;000000000000037777777777;
>>> 00000000 - 00 0000  LSYM unsigned word:t(0,23)=@s16;r(0,23);0;65535;
>>> 00000000 - 00 0000  LSYM unsigned4:t(0,21)=@s64;r(0,21);
>>> 000000000000000000000000;001777777777777777777777;
>>> 00000000 - 00 0000  LSYM unsigned:t(0,27)=r(0,27);
>>> 000000000000000000000000;000000000000037777777777;
>>> 00000000 - 00 0000  LSYM void:t(0,29)=(0,29)
>>> 00000000 - 00 0000  LSYM void:t3=3
>>> 00000000 - 00 0000  LSYM word:t(0,24)=@s16;r(0,24);-32768;32767;
>>> 00000fb0 - 01 0000    SO {standard input}
>>> Double-G5:~ sebas$
>>>
>>> S.
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>>>
>>>
>>
>>
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



More information about the R-devel mailing list