From duncan at wald.ucdavis.edu  Fri May 26 15:43:44 2006
From: duncan at wald.ucdavis.edu (Duncan Temple Lang)
Date: Fri, 26 May 2006 06:43:44 -0700
Subject: [Rd] compiling tests/Embedding
In-Reply-To: <Pine.LNX.4.64.0605252113210.20127@gannet.stats.ox.ac.uk>
References: <44760E5B.4060608@ornl.gov>
	<Pine.LNX.4.64.0605252113210.20127@gannet.stats.ox.ac.uk>
Message-ID: <44770610.2010802@wald.ucdavis.edu>


In addition to the compiler issues, the test should also be changed.
It should use R_tryEval() directly rather than Test_tryEval().  The test 
preceeds the existence
of that exported routine that was motivated by the same
usage that gave rise to this test.

I'll commit an update when I get a few minutes.

  D.

Prof Brian Ripley wrote:
> 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
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
>> 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>
>>
>>
>>
>



[Rd] compiling tests/Embedding
Duncan Temple Lang