R: [R] Use of libmath.a

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Jul 25 16:54:04 CEST 2000

On Tue, 25 Jul 2000, Federico Spinazzi wrote:

> >For example,
> >
> >> cc  -I/usr/local/lib/R/include -lmath test.c    ???
> I guess it should be
> > cc  test.c -I/usr/local/lib/R/include -lmath
> The order specified for object files (libraries are) on the compiler command
> line is IMPORTANT to the linker as it searches for symbols from left to
> right.

Yes, but almost every compiler has the source files last and puts their
compiled objects first in the call to ld. As this was an enquiry about
Solaris, that is certainly what Solaris' cc does.

The problems are

(1) libmath.a is linked against routines in the R executable R.bin,
    so you do need libRmath.a
(2) You need -lm on those systems which use it (including cc on Solaris).

as in my previous answer.

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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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