From ripley at stats.ox.ac.uk  Wed Jul 30 16:40:22 2003
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed Jul 30 16:40:48 2003
Subject: [Rd] OpenBSD-alpha and R-1.7.1 problem
In-Reply-To: <87brvc8841.fsf@riesling.grape.apana.org.au>
Message-ID: <Pine.LNX.4.44.0307301535470.22155-100000@gannet.stats>

On 30 Jul 2003, Peter Rye wrote:

> >>>>> "Prof Ripley" == Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:
> 
>     Prof Ripley> On 29 Jul 2003, Peter Rye wrote:
>     >> I'm trying to get R running on OpenBSD/alpha.
>     >> 
>     >> I've applied some configure patches which I've previously sent to
>     >> the R-devel list to allow R to compile on an OpenBSD ELF platform
>     >> (which OpenBSD/alpha is, as the i386 port soon will be).
>     >> 
>     >> The patched source compiles without problems, and appears to run and
>     >> perform properly apart from two (possibly unrelated) problems.
>     >> 
>     >> 1) On startup there are complaints about mismatched symbol sizes
>     >> (see below). This error message comes from the OpenBSD ld.so, and
>     >> doesn't occur on OpenBSD/i386.
>     >> 
>     >> On further investigation this seems to occur when the modreg and ts
>     >> packages are loaded together. In both packages, the R_*MethodDef
>     >> arrays are declared globally rather than "static const". Changing
>     >> these declarations to static const results in the warning
>     >> disappearing. I think this is *probably* a correct fix. Am I missing
>     >> something or am I talking/writing garbage. The patch is
>     >> straightforward, I can send it to one of you if you wish - then
>     >> again perhaps it's not the right fix.
> 
>     Prof Ripley> It's OK for those arrays to be static, and I am adding
>     Prof Ripley> that to places where they are not (modreg, tools, ts)
> 
> Excellent. Further testing here seems to indicate that this is the cause of
> the warning on OpenBSD/alpha. These arrays presumably don't necessarily
> need to be "const" - correct?

Correct, and there is some danger of a compiler not liking `const'.  
Indeed, we tend to avoid `const' as it has been responsible for far more
than its share of compiler-related bugs.  (gcc 3.3 objected to one use of
const that Solaris cc accepted today.)

There were two more non-static declarations of such tables, in package eda 
and in src/main/registration.c.

-- 
Brian D. Ripley,                  ripley@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


[Rd] OpenBSD-alpha and R-1.7.1 problem
Prof Brian Ripley