[Rd] compiling tests/Embedding

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 25 22:29:52 CEST 2006

What system is this?

It should work under gcc-3.3.4, as the issue is visibility attributes and 
they are not supposed to be supported on that compiler.  (I suspect from 
the message that this is not a version of gcc released by GNU, a common 
source of problems.)  I happen to have an i686 FC3 system with a gcc 3.3.5 
compiled from the GNU sources (to help track down a bug in code generated 
by that compiler), and that does work in tests/Embedding.

In src/main/context.c you will find

context.c:Rboolean attribute_hidden R_ToplevelExec(void (*fun)(void *), 
void *data)

and you need to remove 'attribute_hidden' and recompile.

(There is a known problem here with gcc >= 4.0.0, with this fix in the 
pre-2.3.1 sources.  We know that certain RedHat systems have gcc3's that 
support visibility, not always completely.)

On Thu, 25 May 2006, George Ostrouchov wrote:

> I am compiling the Embedding examples in the tests directory and get an
> undefined reference. I include the make output as well as grep'd output
> of nm on libR.so and compiler and arch information. Do I have an
> improperly built R shared library or is there a problem with the
> Embedding tests or something else I am not seeing?
> Thanks for any help!
> George
> ost at hawk0:/data5/ost/R/R-2.3.0/tests/Embedding> make
> ../../bin/R CMD LINK gcc -o Rtest Rtest.o embeddedRCall.o -L`cd ../.. &&
> /bin/pwd`/lib -lR
> gcc -o Rtest Rtest.o embeddedRCall.o
> -L/autofs/tewa_data5/ost/R/R-2.3.0/lib -lR -Wl,--rpath
> -Wl,/data5/ost/R/R-2.3.0/lib
> embeddedRCall.o(.text+0x1e): In function `Test_tryEval':
> /autofs/tewa_data5/ost/R/R-2.3.0/tests/Embedding/embeddedRCall.c:81:
> undefined reference to `R_ToplevelExec'
> collect2: ld returned 1 exit status
> make: *** [Rtest] Error 1
> ost at hawk0:/data5/ost/R/R-2.3.0/tests/Embedding> cd
> /autofs/tewa_data5/ost/R/R-2.3.0/lib
> ost at hawk0:/autofs/tewa_data5/ost/R/R-2.3.0/lib> nm libR.so | grep R_Top
> 000000000042c920 B R_Toplevel
> 000000000042cae8 B R_ToplevelContext
> 000000000007a7b0 t R_ToplevelExec
> ost at hawk0:/autofs/tewa_data5/ost/R/R-2.3.0/lib> gcc --version
> gcc (GCC) 3.3.4 (pre 3.3.5 20040809)
> Copyright (C) 2003 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> ost at hawk0:/autofs/tewa_data5/ost/R/R-2.3.0/lib> arch
> x86_64
> ost at hawk0:/autofs/tewa_data5/ost/R/R-2.3.0/lib>

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

More information about the R-devel mailing list