Opened 17 years ago

Closed 8 years ago

#1005 closed defect (fixed)

Proble with VSIStatBufL

Reported by: jdenisgiguere@… Owned by: Mateusz Łoskot
Priority: low Milestone: 1.5.0
Component: ConfigBuild Version: unspecified
Severity: normal Keywords: CPL mingw msys
Cc: warmerdam

Description (last modified by csfreebird)

Hi, I want to know how to declare this twice for bypassing this problem. I ran into the same problem when compiling GDAL source using clang 3.1.

../../port/cpl_conv.cpp:2464:21: error: variable has incomplete type 'VSIStatBufL' (aka '__stat64')
        VSIStatBufL sStatBuf;
                    ^
../../port/cpl_vsi.h:153:16: note: forward declaration of '__stat64'
typedef struct VSI_STAT64_T VSIStatBufL;
               ^
../../port/cpl_config.h:108:24: note: expanded from macro 'VSI_STAT64_T'
#  define VSI_STAT64_T __stat64

When I'm trying to compile gdal with mingw, I get the following error message :

make[1]: Entering directory `/c/opensource/gdal/port'
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_conv.o cpl_conv.cpp
mkdir .libs
 g++ -Wall -O2 -I../port -c cpl_conv.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_conv.o
cpl_conv.cpp: In function `void* CPLScanPointer(const char*, int)':
cpl_conv.cpp:936: warning: cast to pointer from integer of different size
 g++ -Wall -O2 -I../port -c cpl_conv.cpp -o cpl_conv.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_error.o cpl_error.cpp
 g++ -Wall -O2 -I../port -c cpl_error.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_error.o
 g++ -Wall -O2 -I../port -c cpl_error.cpp -o cpl_error.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_string.o cpl_string.cpp
 g++ -Wall -O2 -I../port -c cpl_string.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_string.o
 g++ -Wall -O2 -I../port -c cpl_string.cpp -o cpl_string.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cplgetsymbol.o cplgetsymbol.cpp
 g++ -Wall -O2 -I../port -c cplgetsymbol.cpp  -DDLL_EXPORT -DPIC -o
.libs/cplgetsymbol.o
 g++ -Wall -O2 -I../port -c cplgetsymbol.cpp -o cplgetsymbol.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_dir.o cpl_dir.cpp
 g++ -Wall -O2 -I../port -c cpl_dir.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_dir.o
 g++ -Wall -O2 -I../port -c cpl_dir.cpp -o cpl_dir.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_path.o cpl_path.cpp
 g++ -Wall -O2 -I../port -c cpl_path.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_path.o
 g++ -Wall -O2 -I../port -c cpl_path.cpp -o cpl_path.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_csv.o cpl_csv.cpp
 g++ -Wall -O2 -I../port -c cpl_csv.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_csv.o
 g++ -Wall -O2 -I../port -c cpl_csv.cpp -o cpl_csv.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_findfile.o cpl_findfile.cpp
 g++ -Wall -O2 -I../port -c cpl_findfile.cpp  -DDLL_EXPORT -DPIC -o
.libs/cpl_findfile.o
 g++ -Wall -O2 -I../port -c cpl_findfile.cpp -o cpl_findfile.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_minixml.o cpl_minixml.cpp
 g++ -Wall -O2 -I../port -c cpl_minixml.cpp  -DDLL_EXPORT -DPIC -o
.libs/cpl_minixml.o
 g++ -Wall -O2 -I../port -c cpl_minixml.cpp -o cpl_minixml.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_multiproc.o cpl_multiproc.cpp
 g++ -Wall -O2 -I../port -c cpl_multiproc.cpp  -DDLL_EXPORT -DPIC -o
.libs/cpl_multiproc.o
cpl_multiproc.cpp: In function `void CPLCleanupTLS()':
cpl_multiproc.cpp:689: warning: unused variable 'i'
 g++ -Wall -O2 -I../port -c cpl_multiproc.cpp -o cpl_multiproc.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_list.o cpl_list.cpp
 g++ -Wall -O2 -I../port -c cpl_list.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_list.o
 g++ -Wall -O2 -I../port -c cpl_list.cpp -o cpl_list.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_getexecpath.o cpl_getexecpath.cpp
 g++ -Wall -O2 -I../port -c cpl_getexecpath.cpp  -DDLL_EXPORT -DPIC -o
.libs/cpl_getexecpath.o
 g++ -Wall -O2 -I../port -c cpl_getexecpath.cpp -o cpl_getexecpath.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cplstring.o cplstring.cpp
 g++ -Wall -O2 -I../port -c cplstring.cpp  -DDLL_EXPORT -DPIC -o .libs/cplstring.o
 g++ -Wall -O2 -I../port -c cplstring.cpp -o cplstring.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_vsisimple.o cpl_vsisimple.cpp
 g++ -Wall -O2 -I../port -c cpl_vsisimple.cpp  -DDLL_EXPORT -DPIC -o
.libs/cpl_vsisimple.o
 g++ -Wall -O2 -I../port -c cpl_vsisimple.cpp -o cpl_vsisimple.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_vsil.o cpl_vsil.cpp
 g++ -Wall -O2 -I../port -c cpl_vsil.cpp  -DDLL_EXPORT -DPIC -o .libs/cpl_vsil.o
 g++ -Wall -O2 -I../port -c cpl_vsil.cpp -o cpl_vsil.o >/dev/null 2>&1
/bin/sh.exe ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_vsi_mem.o cpl_vsi_mem.cpp
 g++ -Wall -O2 -I../port -c cpl_vsi_mem.cpp  -DDLL_EXPORT -DPIC -o
.libs/cpl_vsi_mem.o
cpl_vsi_mem.cpp: In member function `virtual int
VSIMemFilesystemHandler::Stat(const char*, VSIStatBufL*)':
cpl_vsi_mem.cpp:395: error: invalid application of `sizeof' to incomplete type
`VSIStatBufL' 
cpl_vsi_mem.cpp:399: error: invalid use of undefined type `struct stat64'
cpl_vsi.h:216: error: forward declaration of `struct stat64'
cpl_vsi_mem.cpp:400: error: invalid use of undefined type `struct stat64'
cpl_vsi.h:216: error: forward declaration of `struct stat64'
cpl_vsi_mem.cpp:404: error: invalid use of undefined type `struct stat64'
cpl_vsi.h:216: error: forward declaration of `struct stat64'
cpl_vsi_mem.cpp:405: error: invalid use of undefined type `struct stat64'
cpl_vsi.h:216: error: forward declaration of `struct stat64'
make[1]: *** [cpl_vsi_mem.o] Error 1
make[1]: Leaving directory `/c/opensource/gdal/port'
make: *** [port-target] Error 2

I'm using cvs snapshot from 2005-11-23 14h45 (time is approx) and MSYS :

MSYS 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown; targ=MINGW32
GNU bash, version 2.04.0(1)-release (i686-pc-msys); ENV=.profile
GNU Make version 3.79.1,Built for i686-pc-msys; MAKE_MODE=unix
gcc.exe (GCC) 3.4.2 (mingw-special); targ=MINGW32
GNU ld version 2.15.91 20040904
   789320 Tue Mar 16 18:32:49 2004 /bin/msys-1.0.dll
    52064 Thu Jan 02 13:05:27 2003 /bin/msysltdl-3.dll
   135680 Tue Mar 16 18:32:48 2004 /bin/make.exe
    88064 Tue Sep 21 08:15:22 2004 /mingw/bin/gcc.exe
   642048 Sat Sep 04 23:45:44 2004 /mingw/bin/ld.exe

Change History (10)

comment:4 by warmerdam, 15 years ago

Cc: warmerdam added
Component: GDAL_RasterConfigBuild
Description: modified (diff)
Keywords: mingw msys added
Milestone: 1.5.0
Owner: changed from warmerdam to Mateusz Łoskot
Priority: highlow
Severity: majornormal

Mateusz,

For 1.5.0 I'd like to review mingw/msys build problems, and see what we can do to resolve them. If this still occurs it is likely because the large api is not enabled, and thus there is no type for VSIStatBufL. In this case we likely ought to typedef it to be VSIStatBuf.

But it is also possible this was already corrected.

comment:5 by Mateusz Łoskot, 15 years ago

Description: modified (diff)
Status: newassigned

comment:6 by Ari Jolma, 15 years ago

I've seen this problem, and fixing it was simple although I didn't understand what was going on. cpl_vsi.h had to be changed a bit to declare VSIStatBufL twice(!) - also outside a #ifdef which should have been included. Anyway, I don't see it anymore in the newer versions of with the newer gcc/preprocessor in MinGW.

comment:7 by Mateusz Łoskot, 15 years ago

Keywords: CPL added

comment:8 by Mateusz Łoskot, 15 years ago

Ari,

Does it mean this problem does not occur anymore under newer MinGW? If it's true, then we could close this ticket and I could avoid maintaining new compilation environment for a while :-)

comment:9 by Ari Jolma, 15 years ago

I have not seen this for awhile so I assume it is fixed.

Ari

comment:10 by Mateusz Łoskot, 15 years ago

Resolution: fixed
Status: assignedclosed

Ari, thanks for confirmation. I'm closing this bug as fixed.

Jean-Denis, please reopen if you will find the problem still exists.

in reply to:  6 comment:11 by csfreebird, 9 years ago

Description: modified (diff)
Resolution: fixed
Status: closedreopened

Replying to ajolma:

I've seen this problem, and fixing it was simple although I didn't understand what was going on. cpl_vsi.h had to be changed a bit to declare VSIStatBufL twice(!) - also outside a #ifdef which should have been included. Anyway, I don't see it anymore in the newer versions of with the newer gcc/preprocessor in MinGW.

comment:12 by Ari Jolma, 9 years ago

I've not compiled GDAL with MinGW for a long time and I'm not sure what the solution was exactly and how good it actually was. I'm sorry.

comment:13 by Jukka Rahkonen, 8 years ago

Resolution: fixed
Status: reopenedclosed

Detailed story about building GDAL 1.9.1 with MinGW is attached to ticket #4624.

Note: See TracTickets for help on using tickets.