R-beta: trouble compiling 0.62.3 on SunOS 4.1.4: lgamma conflicts

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Sep 10 17:09:04 CEST 1998


Ben Bolker <ben at eno.princeton.edu> writes:

>   I've recently tried to get 0.62.3 up on our Suns (4.1.4, using gcc; I'm
> also having trouble with a Solaris 2.6 compile but I haven't given up hope
> on that one yet) -- the last compile I did was 0.61.1, which worked
> smoothly.
>  
>  Running
> 
>  ./configure --prefix=/usr/local/apps/R/R-0.62.3  [--with-g77]
>   (tried both with and without g77, eventually get to the same place),
> I get a conflict with the function lgamma being defined both in R and in
> the system's libm.a file: 
> 
> make
> [snip]
> cd main; make
> g77  -o R.binary arithmetic.o  [snip] version.o ../lib/libgraphics.a
> ../lib/libunix.a  ../lib/libappl.a  ../lib/libmath.a -lSM -lICE
> -L/usr/lib/X11 -lX11  -ldl -ltermcap -lm
> collect2: ld returned 2 exit status
> ld: /lib/libm.a(lgamma.o): _gamma: multiply defined
> ld: /lib/libm.a(lgamma.o): _lgamma: multiply defined
> *** Error code 1
> 
>   lgamma appears to be defined both in 
> 
>     ./src/nmath/lgamma.c  -> ./src/lib/libmath.a
> 
>    and in /lib/libm.a.
> 
> We have a fairly poorly configured system, but 0.61.1 compiled fine;
> that version appeared to have a corresponding ./src/math/lgamma.c that was
> compiled into ./src/lib/libmath.a, but didn't cause a conflict.
> 
>   Any ideas?  I hope I'm not being really foolish.

You're not. I think there was an earlier report on the same matter.
This time I'm copying it to the R-bugs archive.

The fundamental problem is that so few of us still have functional
SunOS4's left. I have one here, but there's no Fortran and it's
generally flaky in several other respects.

Many other systems e.g. Solaris have their own gamma functions, so it
isn't just the 'defined twice' that is the problem. Ordinarily, in
SunOS4, multiple definitions is not a problem. I certainly can't
reproduce the problem with simple C programs, e.g.

bash$ cat t.c
double lgamma(double x){return 0;}
main(){lgamma(1.0);}
bash$ gcc t.c
bash$ gcc t.c -lm
bash$ 

On the other hand the 'multiply defined' error mesg. comes from ld, so
clearly there's a check for it somewhere. One might suspect that g77
somehow is turning that check on. What happens if you use gcc as the
LDCMD in config.site?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list