[Rd] gfortran Makefile for windows
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Sep 28 11:43:55 CEST 2005
I am unaware that gfortran or gcc4 exist as a MinGW binary for Windows.
You mention Cygwin, but that is not a supported platform for R.
There is a g95 binary for Windows.
You can find how to link on Windows from the sources: most of the rules
are in src/gnuwin32/MkRules. I suspect all you need is to set
pkgname-DLLLIBS appropriately.
I don't see that you need a Makefile: a Makevars file would suffice and
avoid your hardcoding so many OS-specific features. In any case it seems
to me that in general you need to link against the Fortran libraries: you
may get away with it on MacOS, but you will not on Windows.
Support for F95 files is planned for R 2.3.0, but depends on being able to
differentiate F77 and F95 sources where needed (most platforms).
Meanwhile we will try to add an example to the R-admin manual for 2.2.0.
On Wed, 28 Sep 2005, Joel Bremson wrote:
> Hi all,
>
> (Originally posted to r-help)
Congratulations: you have now read the posting guide and selected an
appropriate list! Perhaps soon you will get the part about not sending
HTML mail?
Seriously, there is a posting guide, and it asks you to do your homework
before posting. Please show us the courtesy of doing so.
> I'm porting a package that I've worked on for OS X to Windows.
> The package is written in F95 so I need to compile it with gfortran
> and link it with gcc4.
>
> I've been trying to build an R with gcc4 without luck so far. If there is
> a binary of such a thing info would be appreciated.
>
> This package requires a Makefile. My question is, how can I find out
> (or what is), the link command?
>
> Here is the OS X Makefile:
>
>
> RLIB_LOC=${R_HOME}
>
> F90_FILES=\
> class_data_frame.f90 \
> class_old_dbest.f90 \
> class_cm_data.f90 \
> class_cm.f90 \
> class_bgw.f90 \
> class_cm_mle.f90 \
> cme.f90
>
>
> FORTRAN_FILES=\
> dgletc.f \
> dglfgb.f\
> dglfg.f\
> dmdc.f\
> mecdf.f
>
>
> %.o: %.f90
> gfortran -c -g $<
>
> %.o: %.f
> gfortran -c -g $<
>
> bpkg.so: $(F90_FILES:%.f90=%.o) $(FORTRAN_FILES:%.f=%.o)
> gcc -Wall -bundle -flat_namespace -undefined suppress -L/sw/lib
> -L/usr/local/lib -o $@ $^ \
> -L$(RLIB_LOC)/lib -lR
>
> ###EOF####
>
> The -L lib dirs are not correct. On a *nix platform I would do something
> like this
>
> sh -x R CMD SHLIB ...
>
> to get at the R internal link information but I can't get that to work on
> Cygwin.
>
> Regards,
>
> Joel
>
> --
> Joel Bremson
> Graduate Student
> Institute for Transportation Studies - UC Davis
> http://etrans.blogspot.com
>
> [[alternative HTML version deleted]]
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list