[R] mac osx, g95 package port problem

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 23 08:01:53 CEST 2005


This isn't really the appropriate list - r-sig-mac or perhaps r-devel.
See the posting guide.

The first problem is the -shared flag that somehow is being used, and as 
you use a Makefile it seems you have taken charge of that.  Looks like the 
Makefile you quote is not the one actually in use.

The next problem is that a dynamic library on MacOS X has extension 
.dylib, not .so.

On Wed, 22 Jun 2005, Joel Bremson wrote:

> Hi all,
>
> I have a working package for linux, including fortran 95 code compiled with
> g95,
> that I need to port to OS X. The package works on Linux and seems to load on
> the Mac,
> but when I try to run a function that calls C or Fortran I'm told that the
> symbol is not loaded.
>
> I'm developing via a shell account on an OS X system, I don't have access to
> a desktop.
> The set up is:
>
> R 2.1.0 Patched (2005-05-12).
> Darwin Kernel Version 8.1.0
> G95 (GCC 4.0.0 20050124 (experimental) (g95!) 06/20/05)
>
> Here is the Makefile:
>
> F90_FILES=\
> dbest_dbase_class.f90 \
> ...
> r_estimate.f90 \
>
> FORTRAN_FILES=\
> dgletc.f \
> ...
> mecdf.f
>
> C_FILES=init.c
>
> CFLAGS=-g -fPIC
>
> %.o: %.f90
> g95 -c -g $<
>
> %.o: %.f
> g95 -c -g $<
>
> %.o: %.c
> gcc -c -g $<
>
> bpkg.so: $(F90_FILES:%.f90=%.o) $(C_FILES:%.c=%.o) $(FORTRAN_FILES:%.f=%.o)
> g95 -L/Library/Frameworks -o $@ $^ -L/Library/Frameworks/R.framewo\
> rk/Resources
>
> -----end makefile------------------------
>
> Here is the relevant output of R CMD CHECK:
>
> * checking for working latex ...sh: line 1: latex: command not found
> NO
> * using log directory '/Users/jbremson/dev/bpkg.Rcheck'
> * using R version 2.1.0, 2005-05-12
> * checking for file 'bpkg/DESCRIPTION' ... OK
> * this is package 'bpkg' version '1.0-1'
> * checking if this is a source package ... OK
>
> * Installing *source* package 'bpkg' ...
> ** libs
> g95 -c -g dbest_dbase_class.f90
> g95 -c -g cm_class.f90
> ...
> gcc -c -g init.c
> init.c: In function 'R_g95_init':
> init.c:22: warning: incompatible implicit declaration of built-in function
> 'strdup'
> g95 -c -g dgletc.f
> g95 -c -g dglfgb.f
> g95 -c -g dglfg.f
>
> g95 -c -g dglfgb.f
> g95 -c -g dglfg.f
> g95 -c -g dmdc.f
> g95 -c -g mecdf.f
> g95 -shared -L/Library/Frameworks -o bpkg.so dbest_dbase_class.o cm_class.o
> bgw_cla\
> ss.o cm_mle_class.o pcm_dglg_o1.o cm_main.o r_estimate.o init.o dgletc.o
> dglfgb.o dg\
> lfg.o dmdc.o mecdf.o -L/Library/Frameworks/R.framework/Resources
> g95: unrecognized option '-shared'

[...]
>
> How can I get R to see the symbols for the package?

By supplying a valid DLL.

-- 
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-help mailing list