Re: [Rd] R, Macports and C++ streams

From: Ernest Turro <ernest.turro_at_ic.ac.uk>
Date: Thu, 31 Jul 2008 19:16:33 +0100

On 31 Jul 2008, at 10:29, Kjell Konis wrote:

> Ernest,
>
> Is it possible to provide a reproducible example of your crash?

Yes. R on macports depends on gcc43, which is causing the problems. The best thing would be to make the port not depend on gcc43, and instead depend on apple-supplied gcc (if this is possible). Alternatively, the macports gcc43 build script should be fixed (e.g. by looking at Apple's script, if available). Reproducible example:

Download and install gcc43 from Macports

cat - > foo.txt
Blah
Blah
^D

cat - > foo.cc
#include <stdio.h>
#include <fstream>
extern "C" {

   void foo() {

     char bar;
     std::ifstream ifs("foo.txt");
     std::ofstream ofs("foo2.txt");
     ifs >> bar;
     ofs << bar;

   }
}
^D

cat - > foo.R
dyn.load("foo.so")
.C("foo")
^D

# Crash:
g++-mp-4.3 -shared -fPIC foo.cc -o foo.so R --vanilla < foo.R

# Don't crash:
g++-4.2 -shared -fPIC foo.cc -o foo.so
R --vanilla < foo.R

>
>
> Kjell
>
>
> On Jul 30, 2008, at 6:32 PM, Ernest Turro wrote:
>
>>
>> On 30 Jul 2008, at 15:46, Simon Urbanek wrote:
>>
>>>
>>> On Jul 30, 2008, at 9:45 , Ernest Turro wrote:
>>>
>>>> Dear all,
>>>>
>>>> R on Macports relies on GCC 4.3 to build packages. I find that
>>>> packages with shared objects that use C++ streams crash R if
>>>> they're compiled using Macports' gcc43, but work fine if compiled
>>>> in exactly the same way using Apple-supplied GCC 4.2. Has anyone
>>>> here had the same issue/know what is causing this problem?
>>>>
>>>
>>> Using compilers from MacPorts and similar suites (Darwin ports, Fink
>>> etc.) is strongly discouraged (and outright not supported by the
>>> CRAN binary) since they have been known to be badly broken in the
>>> past and when whenever tested so far they were incomplete and
>>> incompatible. You have to re-compile R yourself with those tools
>>> (and you're entirely on your own) if you really want to use them.
>>> CRAN binaries work only with Apple's gcc branches, if you want to
>>> use anything else, you have to follow the unix R instructions and
>>> compile everything from sources.
>>
>> Dear Kjell,
>>
>> As you can see above, your R port on Macports appears to be broken
>> and
>> has a reputation of having been broken for a while. I for one have
>> experienced odd problems as described above. To avoid further issues
>> with unsuspecting Macports users, perhaps it would be good to pull
>> the
>> port from the repository until a decent level of reliability can be
>> provided ?
>>
>> Cheers,
>>
>> Ernest
>>
>>>
>>>
>>> Cheers,
>>> Simon
>>>
>>
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 31 Jul 2008 - 18:25:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Aug 2008 - 02:36:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive