[R-sig-Geo] followup on rgdal - invalid alignment error

Scott W Mitchell Scott_Mitchell at carleton.ca
Sat Sep 9 02:58:29 CEST 2006


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.

> 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  
bit)...

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.

The powerpc build uses the same flags as the i386 for 32/64 (from man  
gcc):

        -m32
        -m64
            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



------
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




More information about the R-sig-Geo mailing list