From rhurlin at gwdg.de  Tue May 15 19:05:44 2012
From: rhurlin at gwdg.de (Rainer Hurling)
Date: Tue, 15 May 2012 19:05:44 +0200
Subject: [Rd] R-devel on FreeBSD: new C99 functions don't build
Message-ID: <4FB28CE8.5010303@gwdg.de>

About April 25th, there had been some changes within R-devel's 
src/nmath/pnbeta.c (and probably some other relevant places) and now 
building R-devel on FreeBSD 10.0-CURRENT (amd64) with gcc-4.6.4 and 
math/R-devel (selfmade forked port from math/R) fails like this:

[..snip..]
mkdir /usr/ports/math/R-devel/work/R-devel/bin/exec
gcc46 -std=gnu99     -I../../src/extra   -I. -I../../src/include 
-I../../src/include -I/usr/local/include -DHAVE_CONFIG_H  -fopenmp -fpic 
    -O2 -pipe -O2 -fno-strict-aliasing -pipe -msse3 
-Wl,-rpath=/usr/local/lib/gcc46 -c Rmain.c -o Rmain.o
gcc46 -std=gnu99 -export-dynamic -fopenmp -L/usr/local/lib 
-Wl,-rpath=/usr/local/lib/gcc46 -o R.bin Rmain.o -L../../lib -lR -lRblas
../../lib/libR.so: undefined reference to `log1pl'
collect2: ld returned 1 exit status
*** [R.bin] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel/src/main.
*** [R] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel/src/main.
*** [R] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel/src.
*** [R] Error code 1
Stop in /usr/ports/math/R-devel/work/R-devel.
*** [do-build] Error code 1
Stop in /usr/ports/math/R-devel.
*** [build] Error code 1
Stop in /usr/ports/math/R-devel.
===>>> make failed for math/R-devel


It seems, that at least one new C99 function (log1pl) is introduced in 
R-devel, see

src/nmath/pnbeta.c:l95
return (double) (log_p ? log1pl(-ans) : (1 - ans));

for which there is only a declaration in FreeBSDs math.h, but no full 
implementation in libm (see http://wiki.freebsd.org/MissingMathStuff).

Is there any chance to get at least rudimentary replacement functions in 
R-devel for systems with missing or defective C99 math functions?

(For example, in the similar case of log1p(), see the RMATH_HAVE_LOG1P 
and RMATH_HAVE_WORKING_LOG1P bits in the configure script, 
src/include/Rmath.h0.in, and src/nmath/log1p.c; thanks to b.f. for 
pointing me out to this).

Thanks for any help,
Rainer Hurling


CC'ed to b.f. as the maintainer of the math/R port on FreeBSD.



[Rd] R-devel on FreeBSD: new C99 functions don't build
Rainer Hurling