Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#5664 closed defect (fixed)

Build fails on 1.11.x

Reported by: Mike Taves Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: ConfigBuild Version: 1.11.0
Severity: normal Keywords:
Cc:

Description

I can't seem to build the 1.11.x GDAL series on CentOS x64. For what it's worth, I don't have root access, so I use a prefix where I have permissions. On this system, I successfully compiled GDAL 1.10.1, released 2013/08/26, but have been unable to compile GDAL 1.11.0, or 1.11.1RC1. The later is used for the messages in this ticket.

Here are some commands, with excerpts of the outputs. Full configure and make outputs are attached.

$ cd /tmp
$ wget http://download.osgeo.org/gdal/1.11.1/gdal-1.11.1RC1.tar.gz
$ tar xfz gdal-1.11.1RC1.tar.gz
$ cd gdal-1.11.1
$ ./configure --prefix=/amp/gw/sw --with-python
...
GDAL is now configured for x86_64-unknown-linux-gnu

  Installation directory:    /amp/gw/sw
  C compiler:                gcc -g -O2 -DHAVE_SSE_AT_COMPILE_TIME
  C++ compiler:              g++ -g -O2 -DHAVE_SSE_AT_COMPILE_TIME
  LIBTOOL support:           yes

$ make
...
/bin/sh /tmp/gdal-1.11.1/libtool --mode=compile --tag=CXX g++ -g -O2 -DHAVE_SSE_AT_COMPILE_TIME  -Wall  -DHAVE_GEOS=1 -I/amp/gw/sw/include -I/tmp/gdal-1.11.1/port -I/tmp/gdal-1.11.1/gcore -I/tmp/gdal-1.11.1/alg -I/tmp/gdal-1.11.1/ogr -I/tmp/gdal-1.11.1/ogr/ogrsf_frmts -I/tmp/gdal-1.11.1/frmts -DOGR_ENABLED -I/tmp/gdal-1.11.1/port  -c -o ogrinfo.lo ogrinfo.cpp
libtool: compile:  g++ -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -DHAVE_GEOS=1 -I/amp/gw/sw/include -I/tmp/gdal-1.11.1/port -I/tmp/gdal-1.11.1/gcore -I/tmp/gdal-1.11.1/alg -I/tmp/gdal-1.11.1/ogr -I/tmp/gdal-1.11.1/ogr/ogrsf_frmts -I/tmp/gdal-1.11.1/frmts -DOGR_ENABLED -I/tmp/gdal-1.11.1/port -c ogrinfo.cpp  -fPIC -DPIC -o .libs/ogrinfo.o
ogrinfo.cpp: In function 'int main(int, char**)':
ogrinfo.cpp:306: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldCount'
ogrinfo.cpp:314: error: 'OGRGeomFieldDefn' was not declared in this scope
ogrinfo.cpp:314: error: 'poGFldDefn' was not declared in this scope
ogrinfo.cpp:315: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldDefn'
ogrinfo.cpp: In function 'void ReportOnLayer(OGRLayer*, const char*, const char*, OGRGeometry*)':
ogrinfo.cpp:425: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldIndex'
ogrinfo.cpp:427: error: no matching function for call to 'OGRLayer::SetSpatialFilter(int&, OGRGeometry*&)'
/amp/gw/sw/include/ogrsf_frmts.h:75: note: candidates are: virtual void OGRLayer::SetSpatialFilter(OGRGeometry*)
ogrinfo.cpp:446: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldCount'
ogrinfo.cpp:451: error: 'OGRGeomFieldDefn' was not declared in this scope
ogrinfo.cpp:451: error: 'poGFldDefn' was not declared in this scope
ogrinfo.cpp:452: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldDefn'
ogrinfo.cpp:470: error: no matching function for call to 'OGRLayer::GetExtent(int&, OGREnvelope*, int)'
/amp/gw/sw/include/ogrsf_frmts.h:96: note: candidates are: virtual OGRErr OGRLayer::GetExtent(OGREnvelope*, int)
ogrinfo.cpp:472: error: 'OGRGeomFieldDefn' was not declared in this scope
ogrinfo.cpp:472: error: 'poGFldDefn' was not declared in this scope
ogrinfo.cpp:473: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldDefn'
ogrinfo.cpp:492: error: 'OGRGeomFieldDefn' was not declared in this scope
ogrinfo.cpp:492: error: 'poGFldDefn' was not declared in this scope
ogrinfo.cpp:493: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldDefn'
ogrinfo.cpp:528: error: 'OGRGeomFieldDefn' was not declared in this scope
ogrinfo.cpp:528: error: 'poGFldDefn' was not declared in this scope
ogrinfo.cpp:529: error: 'class OGRFeatureDefn' has no member named 'GetGeomFieldDefn'
make[1]: *** [ogrinfo.lo] Error 1
make[1]: Leaving directory `/tmp/gdal-1.11.1/apps'
make: *** [apps-target] Error 2

Not really sure what the error actually is. The .libs/ directory has these files:

$ file .libs/*
.libs/libgdal.a:         current ar archive
.libs/libgdal.la:        symbolic link to `../libgdal.la'
.libs/libgdal.lai:       libtool library file
.libs/libgdal.so:        symbolic link to `libgdal.so.1.18.1'
.libs/libgdal.so.1:      symbolic link to `libgdal.so.1.18.1'
.libs/libgdal.so.1.18.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

Attachments (4)

configure11.1RC1.out (15.0 KB) - added by Mike Taves 7 years ago.
make1.11.1RC1.out.gz (54.1 KB) - added by Mike Taves 7 years ago.
make1.11.1RC1.out2.gz (53.0 KB) - added by Mike Taves 7 years ago.
make1.11.1RC1.out2.diff (26.0 KB) - added by Mike Taves 7 years ago.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by Mike Taves

Attachment: configure11.1RC1.out added

Changed 7 years ago by Mike Taves

Attachment: make1.11.1RC1.out.gz added

comment:1 Changed 7 years ago by Even Rouault

Are you sure there are not GDAL headers from a previous version in /amp/gw/sw/include ?

comment:2 Changed 7 years ago by Mike Taves

The prefix /amp/gw/sw currently has GDAL 10.1 and GEOS. So yes, it seems that the build fail is due to conflicting headers from different versions of GDAL.

The headers for GEOS in -I/amp/gw/sw/include are read before the local headers -I/tmp/gdal-1.11.1/port etc. Does it need to be in this order?

I suppose a workaround would be to manually uninstall the older version of GDAL, build, then install the new version.

comment:3 Changed 7 years ago by Even Rouault

Yes, there might be various issues if old headers are found in the include path. We might try fixing it, but it will be fragile, so you'd better remove any older headers from the include path.

comment:4 Changed 7 years ago by Mike Taves

Previous headers were removed like this:

$ rm /amp/gw/sw/include/gdal*
$ rm /amp/gw/sw/include/ogr*

It looks like #3435 is a good idea for this; consider it for 2.0.

Using same configure and make procedure as above, still fails with a different error. Attached make output and unified diff from previous. Here are the relevant lines near the end:

$ make
...
/bin/sh /tmp/gdal-1.11.1/libtool --mode=link    g++  gdalserver.lo  /tmp/gdal-1.11.1/libgdal.la
 -o gdalserver
libtool: link: g++ .libs/gdalserver.o -o .libs/gdalserver  /tmp/gdal-1.11.1/.libs/libgdal.so -L
/amp/gw/sw/lib -L/usr/lib64/ -L/usr/lib64 /amp/gw/sw/lib/libgeos_c.so /amp/gw/sw/lib/libgeos.so
 -lsqlite3 -lhdf5 -lpng -lpq -lpthread -lrt -ldl -lpcre -lcurl -lxml2 -lz  -Wl,-rpath -Wl,/amp/
gw/sw/lib
/bin/sh /tmp/gdal-1.11.1/libtool --mode=compile --tag=CXX g++ -g -O2 -DHAVE_SSE_AT_COMPILE_TIME
  -Wall  -DHAVE_GEOS=1 -I/amp/gw/sw/include -I/tmp/gdal-1.11.1/port -I/tmp/gdal-1.11.1/gcore -I
/tmp/gdal-1.11.1/alg -I/tmp/gdal-1.11.1/ogr -I/tmp/gdal-1.11.1/ogr/ogrsf_frmts -I/tmp/gdal-1.11
.1/frmts -DOGR_ENABLED -I/tmp/gdal-1.11.1/port  -c -o gdal_translate.lo gdal_translate.cpp
libtool: compile:  g++ -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -DHAVE_GEOS=1 -I/amp/gw/sw/inclu
de -I/tmp/gdal-1.11.1/port -I/tmp/gdal-1.11.1/gcore -I/tmp/gdal-1.11.1/alg -I/tmp/gdal-1.11.1/o
gr -I/tmp/gdal-1.11.1/ogr/ogrsf_frmts -I/tmp/gdal-1.11.1/frmts -DOGR_ENABLED -I/tmp/gdal-1.11.1
/port -c gdal_translate.cpp  -fPIC -DPIC -o .libs/gdal_translate.o
In file included from gdal_translate.cpp:34:
/tmp/gdal-1.11.1/gcore/gdal_priv.h:116: error: expected ';' before 'CPL_NULL_TERMINATED'
make[1]: *** [gdal_translate.lo] Error 1
make[1]: Leaving directory `/tmp/gdal-1.11.1/apps'
make: *** [apps-target] Error 2

Do I need to clean out /amp/gw/sw/lib/libgdal.* too?

Changed 7 years ago by Mike Taves

Attachment: make1.11.1RC1.out2.gz added

Changed 7 years ago by Mike Taves

Attachment: make1.11.1RC1.out2.diff added

comment:5 Changed 7 years ago by Even Rouault

Try also "rm /amp/gw/sw/include/cpl*.h"

comment:6 Changed 7 years ago by Mike Taves

The build succeeded with that one. So in summary, to upgrade major release versions, the commands were:

export prefix=/amp/gw/sw
rm ${prefix}/include/gdal*.h
rm ${prefix}/include/ogr*.h
rm ${prefix}/include/cpl*.h

You can close this ticket, unless you want to try reordering the includes to list local headers before external headers (i.e. the order of -I/...).

comment:7 Changed 7 years ago by Even Rouault

Component: defaultConfigBuild
Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r27976 "Unix build: make sure \$(GDAL_INCLUDE) is first to avoid being confused by GDAL headers of a previous version elsewhere in the include path (#5664)"

comment:8 Changed 6 years ago by Even Rouault

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.