[R] mac osx, g95 package port problem

From: Joel Bremson <joel3000_at_gmail.com>
Date: Thu 23 Jun 2005 - 12:15:27 EST


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:

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'
** R
** data
** help

>>> Building/Updating help pages for package 'bpkg' Formats: text html latex example
estimate.model text html latex example
** building package indices ...
* DONE (bpkg)

call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
See section 'Generic functions and methods' of the 'Writing R Extensions' manual.
See section 'Generic functions and methods' of the 'Writing R Extensions' manual.
* checking replacement functions ... WARNING
Error: package/namespace load failed for 'bpkg' Call sequence:
2: stop(gettextf("package/namespace load failed for '%s'", libraryPkgName(package)),\

call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
In R, the argument of a replacement function which corresponds to the right hand side must be named 'value'.
* checking foreign function calls ... WARNING
Error: package/namespace load failed for 'bpkg' Call sequence:
2: stop(gettextf("package/namespace load failed for '%s'", libraryPkgName(package)),\

call. = FALSE, domain = NA)
1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE)
Execution halted
See section 'System and foreign language interfaces' of the 'Writing R Extensions' manual.
* checking Rd files ... OK

-----EOF---- Obviously, there is a package/namespace load filed. I looked at the mentioned R documentation and didn't find anything I thought relevant. Here is the NAMESPACE file for good measure. The package is called bpkg.



useDynLib(bpkg)
export(dummy,estimate.model,em2)
-----EOF-------------------

I have checked the bpkg.so file with nm and the symbols for all functions are present.

How can I get R to see the symbols for the package?

Regards,

Joel Bremson
Graduate Student
UC Davis

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 23 12:19:24 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:57 EST