[R] compile error with C code and standalone R math C library

Faheem Mitha faheem at email.unc.edu
Sun Dec 14 06:51:09 CET 2003



On Sat, 13 Dec 2003, Dirk Eddelbuettel wrote:

> On Sat, Dec 13, 2003 at 07:44:46PM -0500, Faheem Mitha wrote:
> > I just went back to an old piece of C code. On trying to compile it with
> > the R math standalone C library I got the following error. Can anyone
> > enlighten me what I am doing wrong, if anything? C file (rr-sa.c) follows.
> >
> > I'm on Debian sarge. I'm running R version 1.8.1. Gcc is version
> > 3.3.1.
> [...]
> > faheem ~/co/rr/trunk>gcc -o rr rr-sa.c -lRmath -lm
> > /usr/lib/gcc-lib/i486-linux/3.3.2/../../../libRmath.so: undefined
> > reference to `Rlog1p'
> > collect2: ld returned 1 exit status
>
> The linker tells you that it cannot find object code for a function Rlog1p.
> So let's check:
>
> edd at chibud:~> grep Rlog1p /usr/include/Rmath.h
> edd at chibud:~> grep log1p /usr/include/Rmath.h
> double  log1p(double); /* = log(1+x) {care for small x} */
> edd at chibud:~>
>
> Turns out that there is none defined in Rmath.h, but log1p exists.  This may
> have gotten renamed since you first wrote your code.

Maybe I am being dense, but how is this my fault? I am not using either
Rlog1p or log1p in my code (as far as I can see).

Thanks for replying.

                                                             Faheem.




More information about the R-help mailing list