[R-SIG-Mac]compiling fortran code of contributed packages using absoft f77
and lnk
Papritz, Andreas
andreas.papritz@ito.umnw.ethz.ch
Mon, 28 May 2001 14:19:30 +0200
DeaR mac users
I tried to compile the fortran code of the "splancs" package using
Absoft's Fortran compiler f77 and combine the object files into a
shared library using Absoft's lnk. I could create the library without
any problem but
when I tried to access the library from R strange things happen.
I can load the modules contained in the library by the R's dyn.load().
But when I check whether a particular Fortran routine, say "areapl",
is accessible to R by using
> is.loaded(symbol.For("areapl"))
[1] FALSE
>
Strange enough if I test
> is.loaded(symbol.C("areapl"))
[1] TRUE
I get the answer that areapl is accessible as a C module.
From this I conclude that lnk gives the shared library some attribute
which makes R think that the library contains C code.
For contributed packages containing C code I did not experience any
problems, ie. acc and lnk created a shared library accessible to R
(e.g. I could install geoR, available from
http://www.maths.lancs.ac.uk/~ribeiro/geoR.html, on my G4).
Now my question is: how can I control that lnk creates a shared
library consisting of FORTRAN routines. Does anybody have a hint?
Andreas
For MPW/Absoft users I include the contents of the make file
### MAKEFILE PREAMBLE ###
TargetName = splancsLib
Makefile = # "{TargetName}".make
ObjDir_ppc = :
# Power Macintosh tools and default settings
f77_ppc = "{AbsoftTools}f77" -c
f77_ppc_opts =
# Object and resource files used for this build:
PPC_LIBS = �
"{AbsoftLibraries}libf90math.o" �
"{AbsoftLibraries}libfio" �
"{AbsoftLibraries}libfmath"
PPC_OBJECTS = �
"{ObjDir_ppc}areapl.o" �
"{ObjDir_ppc}cncvwt.o" �
"{ObjDir_ppc}dokhat.o" �
"{ObjDir_ppc}inpip.o" �
"{ObjDir_ppc}ipippa.o" �
"{ObjDir_ppc}iplace.o" �
"{ObjDir_ppc}k12hat.o" �
"{ObjDir_ppc}kernel3d.o" �
"{ObjDir_ppc}khvc.o" �
"{ObjDir_ppc}khvmat.o" �
"{ObjDir_ppc}krnnrm.o" �
"{ObjDir_ppc}krnqne.o" �
"{ObjDir_ppc}krnqrt.o" �
"{ObjDir_ppc}nndist.o" �
"{ObjDir_ppc}plarea.o" �
"{ObjDir_ppc}sekhat.o" �
"{ObjDir_ppc}sort.o" �
"{ObjDir_ppc}sort2.o" �
"{ObjDir_ppc}stkhat.o" �
"{ObjDir_ppc}stsecal.o" �
"{ObjDir_ppc}tribble.o" �
"{ObjDir_ppc}twodimmse.o" �
"{ObjDir_ppc}weight.o"
# Linkage rule
"{TargetName}" ŸŸ {PPC_OBJECTS} {makefile}
lnk -O -xm library -o "{TargetName}" -export "{TargetName}.x" �
{PPC_OBJECTS}
lnk -O -xm sharedLibrary -o "{TargetName}" -export "{TargetName}.x" �
{PPC_OBJECTS} {PPC_LIBS} -aliases {AbsoftLibraries}absoft_aliases �
"{AbsoftLibraries}absoft_init.o" �
"{AbsoftLibraries}ACLib.o" �
"{PPCLibraries}StdCRuntime.o" �
"{SharedLibraries}StdCLib" �
"{SharedLibraries}InterfaceLib"
# Compilation rules
"{ObjDir_ppc}areapl.o" Ÿ "areapl.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}areapl.o" areapl.f
"{ObjDir_ppc}cncvwt.o" Ÿ "cncvwt.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}cncvwt.o" cncvwt.f
"{ObjDir_ppc}dokhat.o" Ÿ "dokhat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}dokhat.o" dokhat.f
"{ObjDir_ppc}inpip.o" Ÿ "inpip.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}inpip.o" inpip.f
"{ObjDir_ppc}ipippa.o" Ÿ "ipippa.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}ipippa.o" ipippa.f
"{ObjDir_ppc}iplace.o" Ÿ "iplace.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}iplace.o" iplace.f
"{ObjDir_ppc}k12hat.o" Ÿ "k12hat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}k12hat.o" k12hat.f
"{ObjDir_ppc}kernel3d.o" Ÿ "kernel3d.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}kernel3d.o" kernel3d.f
"{ObjDir_ppc}khvc.o" Ÿ "khvc.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}khvc.o" khvc.f
"{ObjDir_ppc}khvmat.o" Ÿ "khvmat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}khvmat.o" khvmat.f
"{ObjDir_ppc}krnnrm.o" Ÿ "krnnrm.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}krnnrm.o" krnnrm.f
"{ObjDir_ppc}krnqne.o" Ÿ "krnqne.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}krnqne.o" krnqne.f
"{ObjDir_ppc}krnqrt.o" Ÿ "krnqrt.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}krnqrt.o" krnqrt.f
"{ObjDir_ppc}nndist.o" Ÿ "nndist.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}nndist.o" nndist.f
"{ObjDir_ppc}plarea.o" Ÿ "plarea.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}plarea.o" plarea.f
"{ObjDir_ppc}sekhat.o" Ÿ "sekhat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}sekhat.o" sekhat.f
"{ObjDir_ppc}sort.o" Ÿ "sort.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}sort.o" sort.f
"{ObjDir_ppc}sort2.o" Ÿ "sort2.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}sort2.o" sort2.f
"{ObjDir_ppc}stkhat.o" Ÿ "stkhat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}stkhat.o" stkhat.f
"{ObjDir_ppc}stsecal.o" Ÿ "stsecal.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}stsecal.o" stsecal.f
"{ObjDir_ppc}tribble.o" Ÿ "tribble.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}tribble.o" tribble.f
"{ObjDir_ppc}twodimmse.o" Ÿ "twodimmse.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}twodimmse.o" twodimmse.f
"{ObjDir_ppc}weight.o" Ÿ "weight.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}weight.o" weight.f
clean Ÿ
Delete -i "{TargetName}" {PPC_OBJECTS}
--
------------------------------------------------------------------------
Andreas Papritz, Institute of Terrestrial Ecology ETH Zurich,
Grabenstr. 3, CH-8952 Schlieren, Switzerland
phone +41 1 633 6072, fax +41 1 633 1123
------------------------------------------------------------------------