[Rd] Compiling "R Embedded" examples
Mauron Laurent (KETR 31)
laurent.mauron at credit-suisse.com
Tue Mar 22 18:20:02 CET 2005
Your suggestion to use Rmain.c led to the solution.
The compilation of Rmain.c worked ok. I had a look at Rmain.c and found this reference to MAIN__
/* Declarations to keep f77 happy */
int MAIN_(int ac, char **av) {return 0;}
int MAIN__(int ac, char **av) {return 0;}
int __main(int ac, char **av) {return 0;}
Adding those lines to Rtest.c did the trick.
I am still puzzled by this problem. The fortran compiler I was using is g77 from gcc3.3.2.
$ g77 -v
Reading specs from /app/gcc_3.3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs
Configured with: ../configure --prefix=/app/gcc_3.3.2 --with-local-prefix=/app/gcc_3.3.2 --enable-threads --enable-version-specific-runtime-libs : (reconfigured) ../configure --prefix=/app/gcc_3.3.2 --with-local-prefix=/app/gcc_3.3.2 --enable-threads --enable-version-specific-runtime-libs
Thread model: posix
gcc version 3.3.2
Anyway, it works now. Thanks a lot for your help!
Laurent
-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: 22 March 2005 16:52
To: Mauron Laurent (KETR 31)
Cc: 'r-devel at stat.math.ethz.ch'
Subject: RE: [Rd] Compiling "R Embedded" examples
On Tue, 22 Mar 2005, Mauron Laurent (KETR 31) wrote:
> Thanks for your suggestion. I re-compiled R-2.0.1 with gcc 3.3.2. but
> got exactly the same problem.
(Which problem is not described in this message and the stated URL is
invalid. Searching suggests it is related to MAIN__.)
> I am very puzzled because the compilation of R is ok. Is there any piece
> of code that was succesfully compiled on my setup that could be used as
> an example of embedding R in C/C++ (tcltk for example?).
No. Only R.bin is in any way similar to the embedded examples: tcltk is
run from R, not R from tcltk.
Solaris 8, gcc 3.4.3 works for me.
Note that MAIN__ is defined in Rmain.c, and that is part of R.bin and not
libR.so. You could try copying it is to Rtest.c to see if this helps.
What you have not told us is the Fortran that you are using. That is
likely to be the clue. Try a current gcc AND g77 -- gcc is a Compiler
Collection, not just a C compiler.
> $gcc -v
> Reading specs from /app/gcc_3.3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs
> Configured with: ../configure --prefix=/app/gcc_3.3.2 --with-local-prefix=/app/gcc_3.3.2 --enable-threads --enable-version-specific-runtime-libs : (reconfigured) ../configure --prefix=/app/gcc_3.3.2 --with-local-prefix=/app/gcc_3.3.2 --enable-threads --enable-version-specific-runtime-libs
> Thread model: posix
> gcc version 3.3.2
>
> -----Original Message-----
> From: Duncan Temple Lang [mailto:duncan at wald.ucdavis.edu]
> Sent: 21 March 2005 20:01
> To: Mauron Laurent (KETR 31)
> Cc: 'r-devel at stat.math.ethz.ch'
> Subject: Re: [Rd] Compiling "R Embedded" examples
>
>
> Mauron Laurent (KETR 31) wrote:
>> Hi,
>>
>> I haven't made any progress regarding compiling the "R embedding"
>> example ( http://tolstoy.newcastle.edu.au/R/devel/05/03/0143.htm ) and
>> I am running out of ideas.
>>
>> I would be very grateful if someone could give me some reference or
>> pointers where to look. In other words, how would you attack the
>> problem if you were in the same situation?
>
>
> I would install a different version of gcc (e.g. gcc-3.3.3) as that works on
> one of the Solaris machines I use.
>
> SunOS 5.8 Generic_117000-05 sun4u sparc SUNW,Ultra-5_10
>
>
> On that machine, all works fine.
--
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