[gdal-dev] ogr problems with MapInfo

Daniel Morissette dmorissette at mapgears.com
Wed Oct 6 09:33:33 EDT 2010


Taking this thread back to the list.

The problem here seems to be that the stat() calls fail because the
samba share uses large (64 bit) inode values which are too large for the
32 bit st_ino member of the stat struct.

I have found two possible solutions on the Web, but didn't test either one:

1- Compile your code (all your code and custom libs and not just the
main.c program) with -D_FILE_OFFSET_BITS=64 to enable large file
support. This seems to be the accepted way to fix a program without
changing any code, see for instance http://www.suse.de/~aj/linux_lfs.html

2- One can possibly work around the issue by mounting the smb share with
the "nounix,noserverino" options as suggested here:
http://stackoverflow.com/questions/2438890/cc1plus-error-include-value-too-large-for-defined-data-type-when-compiling-wit


Now, according to http://trac.osgeo.org/gdal/wiki/LargeFileSupport
GDAL/OGR already enables large file support if your OS supports it .
Obviously that did not work in this case.

Question to Frank and other devs: Is it that a specific configure option
has to be used to enable large file support, or that the MITAB source
MUST be updated to use VSIL* calls everywhere?

(I fear it's the latter, but I thought I'd take a chance anyway)

Daniel


Sebastian E. Ovide wrote:
> gis at mapserver:~/data/tmp$ /home/gis/src/mitab-1.7.0/mitab/test_stat
> /home/gis/data/tmp/CA_AbandonedMine.TAB
> VSIStat(/home/gis/data/tmp/CA_AbandonedMine.TAB) = -1 (Value too large
> for defined data type)
> stat(/home/gis/data/tmp/CA_AbandonedMine.TAB) = -1 (Value too large for
> defined data type)
> 
> gis at mapserver:~/data/tmp$ /home/gis/src/mitab-1.7.0/mitab/test_stat
> /home/gis/data/tmp/CA_AbandonedMine_.tab
> VSIStat(/home/gis/data/tmp/CA_AbandonedMine_.tab) = -1 (Value too large
> for defined data type)
> stat(/home/gis/data/tmp/CA_AbandonedMine_.tab) = -1 (Value too large for
> defined data type)
> 
> 
> On Tue, Oct 5, 2010 at 2:39 PM, Daniel Morissette
> <dmorissette at mapgears.com <mailto:dmorissette at mapgears.com>> wrote:
> 
>     Oh, it seems that I missed one character when I copied the little
>     program. The first line should be:
> 
>     #include "cpl_vsi.h"
> 
> 
> 
>     Sebastian E. Ovide wrote:
>     > gis at mapserver:~/src/mitab-1.7.0/mitab$ make test_stat
>     > c++ -c -I../ogr -I. -I.. -I../cpl  -fPIC --no-rtti -fno-exceptions -g
>     > -Wall -DDEBUG -DCPL_LSB test_stat.cpp -o test_stat.o
>     > test_stat.cpp:1: error: expected constructor, destructor, or type
>     > conversion before string constant
>     > make: *** [test_stat.o] Error 1
>     >
>     >
>     > On Thu, Sep 30, 2010 at 3:09 PM, Daniel Morissette
>     > <dmorissette at mapgears.com <mailto:dmorissette at mapgears.com>
>     <mailto:dmorissette at mapgears.com <mailto:dmorissette at mapgears.com>>>
>     wrote:
>     >
>     >     (Taking this off-list, we'll summarize on the list later)
>     >
>     >     Sebastian E. Ovide wrote:
>     >     > done... didn't work...
>     >     >
>     >     > Copied on the same SMB folder with undercase names... both
>     ogrinfo and
>     >     > tab2tab failed.
>     >     > Copied the same files to a local folder and both ogrinfo and
>     tab2tab
>     >     > succeeded...
>     >     >
>     >     > same errors....
>     >     >
>     >
>     >     It may be that stat() is failing for some reason. Can you
>     please test
>     >     with the following little program, save it as test_stat.cpp in the
>     >     mitab-1.x/mitab/ source directory:
>     >
>     >     ---------- mitab-1.x/mitab/test_stat.cpp ---------
>     >     include "cpl_vsi.h"
>     >
>     >     int main(int argc, char *argv[])
>     >     {
>     >        VSIStatBuf  sStatBuf;
>     >        struct stat stat_buf;
>     >        int status;
>     >
>     >        if (argc != 2)
>     >        {
>     >            printf("Usage: %s <filename>\n", argv[0]);
>     >            return -1;
>     >        }
>     >
>     >        status = VSIStat(argv[1], &sStatBuf);
>     >        printf("VSIStat(%s) = %d (%s)\n", argv[1], status ,
>     >     status?strerror(errno):"" );
>     >
>     >        status = stat(argv[1], &stat_buf);
>     >        printf("stat(%s) = %d (%s)\n", argv[1], status,
>     >     status?strerror(errno):"" );
>     >
>     >     }
>     >     -----------------------------------------------
>     >
>     >     And then add the following target (lines) at the end of the
>     GNUmakefile
>     >     in that directory:
>     >
>     >     ---------- mitab-1.x/mitab/GNUmakefile ---------
>     >
>     >     test_stat: test_stat.o $(LIBS)
>     >            $(CXX) $(LFLAGS) -o test_stat test_stat.o $(LIBS) -lm
>     >     -----------------------------------------------
>     >     (Note that the second line start with a real TAB character,
>     not spaces)
>     >
>     >     ... and build it using 'make test_stat'
>     >
>     >     ... and finally try running it against one of your files. e.g.
>     >
>     >      ./test_stat /home/gis/data/tmp/CA_AbandonedMine.MAP
>     >
>     >     and also against the version with lowercase extension:
>     >
>     >      ./test_stat /home/gis/data/tmp/CA_AbandonedMine.map
>     >
>     >     ... and let's see what output we get.
>     >
>     >     Daniel
>     >     --
>     >     Daniel Morissette
>     >     http://www.mapgears.com/
>     >
>     >
>     >
>     >
>     > --
>     > Sebastian E. Ovide
>     >
>     >
>     >
> 
> 
>     --
>     Daniel Morissette
>     http://www.mapgears.com/
> 
> 
> 
> 
> -- 
> Sebastian E. Ovide
> 
> 
> 
> 


-- 
Daniel Morissette
http://www.mapgears.com/


More information about the gdal-dev mailing list