[R] update (Re: loading compiled C++ code as shared library)

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Jul 25 09:08:28 CEST 2002


On Wed, 24 Jul 2002, Faheem Mitha wrote:

> On Wed, 24 Jul 2002, Faheem Mitha wrote:
>
> >
> > Dear People,
> >
> > Over the last few days I've been writing C++ to compile as a shared
> > library (previously I have always used C). Not entirely to my surprise, I
> > am getting errors. Specifically, when I try to load the shared library, I
> > get
> >
> > Error in dyn.load(x, as.logical(local), as.logical(now)) :
> > 	unable to load shared library
> > "/home/faheem/research/thesis/sim/ms/ms.so":
> >   /home/faheem/research/thesis/sim/ms/ms.so: undefined symbol:
> > __gxx_personality_v0
>
> This appears to have something to do with my compile options (see below).
> Just doing "R CMD SHLIB ms.cc -o ms.so" does not give the error. Anyone
> have any idea what might be causing this?

I suspect you are using g++-3.1 with R compiled with gcc < 3.0.  You often
can't mix-and-match versions of gcc across major revision levels, and you
certainly can't use gcc 3.1 on C++ code and mix it with earlier versions as
there is a C++ ABI change.

R's configure does compatibility checks when it selects the C, C++ and
Fortran compilers.  If you change your compilers it is a good idea to
rebuild R (and I'm pretty sure I had to when changing from gcc 2.95.3 to
3.x).

> > Note of course I'm compiling with a C++ compiler (g++)
> >
> > 	MAKEFLAGS='CXX=\ g++-3.1 PKG_CXXFLAGS=\ -Wall\ -pedantic\ -Werror\
> > -Wshadow ' R CMD SHLIB ms.cc -o ms.so

-- 
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