From ostrouchovg at ornl.gov  Fri May 26 18:35:47 2006
From: ostrouchovg at ornl.gov (George Ostrouchov)
Date: Fri, 26 May 2006 12:35:47 -0400
Subject: [Rd] compiling tests/Embedding
In-Reply-To: <44770610.2010802@wald.ucdavis.edu>
References: <44760E5B.4060608@ornl.gov>
	<Pine.LNX.4.64.0605252113210.20127@gannet.stats.ox.ac.uk>
	<44770610.2010802@wald.ucdavis.edu>
Message-ID: <44772E63.9070808@ornl.gov>

Thanks for helping me understand what is going on. Understanding is 
really my reason for the compile. I took the R_tryEval() route to fixing 
the problem.

I am running SuSE Linux 9.2 on that machine, which might support 
visibility under gcc3 as Brian points out.

Thanks again,
George

Duncan Temple Lang wrote:
>
> 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>
>>>
>>>
>>>
>>

-- 
George Ostrouchov
Statistics and Data Sciences Group
Computer Science and Mathematics Division
Oak Ridge National Laboratory
http://www.csm.ornl.gov/~ost

Register for the JRC 2006?
http://2006jointresearch.bus.utk.edu/
Conference starts June 6, 2006.



[Rd] compiling tests/Embedding
George Ostrouchov