[R-sig-Geo] followup on rgdal - invalid alignment error
Roger.Bivand at nhh.no
Sat Sep 9 10:28:34 CEST 2006
On Fri, 8 Sep 2006, Scott W Mitchell wrote:
> On 8 Sep 2006, at 15:27, Roger Bivand wrote:
> > On Fri, 8 Sep 2006, Tim Keitt wrote:
> >> One possibility is that the size of the GDAL data type is not the
> >> same
> >> as the size of the R data type. This will definitely cause
> >> problems as
> >> allocation is done by R and the pointer is cast to void when
> >> passed to
> >> GDAL. My original C++ code simply assumes that both are 32-bit (or at
> >> least equivalent size), but things will break if they are different.
> >> (Roger -- you probably noticed the "fix me!" comments to myself in
> >> there -- that was what I was talking about.)
> > (about line 750 in src/gdal-bindings.cpp)
> > Yes, but this is an example that is run very often on i386 at
> > least, so
> > I'm not sure why it should show up now on an other-endian platform?
> > GDAL
> > knows about endian-ness, doesn't it? Without access to the specific
> > platform and build train, it would be difficult to debug?
> I can certainly provide access to a test system and/or follow
> instructions for testing if that would help. If you'll be in
> Lausanne next week, we could discuss this more there.
Yes, I'll be in Lausanne, which for those not aware of it, is a meeting
between and about software projects in "Free And Open Source Software for
Geoinformatics", http://www.foss4g2006.org/, all next week. The R/GRASS
interface is being presented in a workshop, together with rgdal and
friends, on Tuesday afternoon, 12 September.
> > What else do we
> > know about the platform? Is a G5 64-bit (ie. how big is an int)?
> Yes, G5 is 64 bit, but if I understand correctly, one needs to
> "request" this capability when compiling. I see that sizeof(int)
> returns a value of 4 if I run it on a G5 or a G4 (which is not 64
> Actually, looking a little deeper and reading the gcc man page, if I
> just compile with defaults, int is 4 and long is 4, but if I use -m64
> when compiling, int is still 4 but long is 8.
This seems to happen in config.h when R is built, and the details are I
think in the constants returned by .Machine. We can follow this up in
> The powerpc build uses the same flags as the i386 for 32/64 (from man
> Generate code for 32-bit or 64-bit environments of Darwin
> and SVR4
> targets (including GNU/Linux). The 32-bit environment
> sets int,
> long and pointer to 32 bits and generates code that runs
> on any
> PowerPC variant. The 64-bit environment sets int to 32
> bits and
> long and pointer to 64 bits, and generates code for
> PowerPC64, as
> for -mpowerpc64.
> Hope that helps,
> Scott W. Mitchell Scott_Mitchell at carleton.ca
> Geomatics and Landscape Ecology Research Laboratory
> Department of Geography and Environmental Studies
> Carleton University, B349 Loeb Building
> Ottawa, ON Canada K1S 5B6
> +1-613-520-2600 ext 2695
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo