Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6170 closed defect (fixed)

Conflicting declarations of struct DBFInfo

Reported by: Bas Couwenberg Owned by: warmerdam
Priority: normal Milestone: 2.1.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc: sebastic@…

Description

As reported by Michael Tautschnig in Debian Bug #750383, gdal can fail to build due to conflicting declarations of struct DBFInfo:

During a rebuild of all Debian packages in a clean sid chroot using cowbuilder and pbuilder) the build failed with the following error. Please note that we use our research compiler tool-chain (using tools from the cbmc package), which permits extended reporting on type inconsistencies at link time.

libtool: link: g++  -fPIC -DPIC -shared -nostdlib [...] -Wl,-z -Wl,relro -Wl,-Bsymbolic -Wl,--version-script -Wl,/srv/jenkins-slave/workspace/sid-goto-cc-gdal/gdal-1.10.1+dfsg/debian/gdal.ver   -pthread -Wl,-soname -Wl,libgdal.so.1 -o .libs/libgdal.so.1.17.1
/srv/jenkins-slave/workspace/sid-goto-cc-gdal/gdal-1.10.1+dfsg/ogr/ogrsf_frmts/o/.libs/iom_utilities.o: In function `iom_gettmpnam':
/srv/jenkins-slave/workspace/sid-goto-cc-gdal/gdal-1.10.1+dfsg/ogr/ogrsf_frmts/ili/iom/iom_utilities.cpp:238: warning: the use of `tempnam' is dangerous, better use `mkstemp'

error: conflicting function declarations "DBFOpen"
old definition in module avc_bin file dbfopen.h line 154
DBFInfo * DBFOpen(const char * pszDBFFile, const char * pszAccess);
new definition in module dbfopen file dbfopen.c line 366
DBFInfo * DBFOpen(const char * pszDBFFile, const char * pszAccess);

reason for conflict in types listed below (struct/struct):
composite type component counts differ (15/23)
struct {
  struct _IO_FILE * fp;
  signed int nRecords;
  signed int nRecordLength;
  signed int nHeaderLength;
  signed int nFields;
  signed int * panFieldOffset;
  signed int * panFieldSize;
  signed int * panFieldDecimals;
  char * pachFieldType;
  char * pszHeader;
  signed int nCurrentRecord;
  signed int bCurrentRecordModified;
  char * pszCurrentRecord;
  signed int bNoHeader;
  signed int bUpdated;
} DBFInfo
struct {
  SAHooks sHooks;
  signed int * fp;
  signed int nRecords;
  signed int nRecordLength;
  signed int nHeaderLength;
  signed int nFields;
  signed int * panFieldOffset;
  signed int * panFieldSize;
  signed int * panFieldDecimals;
  char * pachFieldType;
  char * pszHeader;
  signed int nCurrentRecord;
  signed int bCurrentRecordModified;
  char * pszCurrentRecord;
  signed int nWorkFieldLength;
  unsigned int <padding>;
  char * pszWorkField;
  signed int bNoHeader;
  signed int bUpdated;
  double dfDoubleField;
  signed int iLanguageDriver;
  unsigned int <padding>;
  char * pszCodePage;
} DBFInfo

GNUmakefile:41: recipe for target 'libgdal.la' failed
make[3]: *** [libgdal.la] Error 1
make[3]: Leaving directory '/srv/jenkins-slave/workspace/sid-goto-cc-gdal/gdal-1.10.1+dfsg'
GNUmakefile:51: recipe for target 'check-lib' failed
make[2]: *** [check-lib] Error 2

According to the comment at the top of avc/dbfopen.h it ought to be a copy of shape/shapefil.h - yet it seems shapefil.h has evolved since. The above conflict will inevitable cause problems if any of the fields are actually being accessed from within the code in the avc/ folder. This might not be happening right now, in which case the struct declaration should simply be removed from avc/dbfopen.h (merely replacing it with "typedef struct DBFInfo DBFInfo;" should do) to avoid any future breakage.

Change History (2)

comment:1 by Even Rouault, 8 years ago

Milestone: 2.1.0
Resolution: fixed
Status: newclosed

trunk r31106 "AVC: remove dbfopen.h, stripped down version of shapefil.h, that wasn't uptodate and just include shapefil.h instead (closes #6170)"

comment:2 by Even Rouault, 8 years ago

trunk r31107 "Fix AIG compilation after r31106 change (#6170)"

Note: See TracTickets for help on using tickets.