[GRASS-dev] Error: undefined reference to `OGR_GT_Flatten' when compiling grass with GDAL

Dear GRASS developers,

I'm receiving errors when trying to compile GRASS from sources with GDAL support. I have searched the archives but was not successful. I'm glad for any help.

My minimal setup is like this:

>> uname -a

Linux [...] 3.11.10-25-desktop #1 SMP PREEMPT Wed Dec 17 17:57:03 UTC 2014 (8210f77) x86_64 x86_64 x86_64 GNU/Linux

>> ./configure --prefix $prefix --without-tiff --with-gdal=$prefix_opt/bin/gdal-config --with-proj-share=$prefix_opt/share/proj --with-proj-libs=$prefix_opt/lib --with-proj-includes=$prefix_opt/include --without-opengl --without-fftw --without-freetype

GRASS is now configured for: x86_64-unknown-linux-gnu

   Source directory: /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2
   Build directory: /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2
   Installation directory: ${prefix}/grass-7.0.2
   Startup script in directory:${exec_prefix}/bin
   C compiler: gcc -g -O2
   C++ compiler: c++ -g -O2
   Building shared libraries: yes
   OpenGL platform: none

   MacOSX application: no
   MacOSX architectures:
   MacOSX SDK:

   BLAS support: no
   C++ support: yes
   Cairo support: yes
   DWG support: no
   FFTW support: no
   FreeType support: no
   GDAL support: yes
   GEOS support: no
   LAPACK support: no
   Large File support (LFS): yes
   libLAS support: no
   MySQL support: no
   NetCDF support: no
   NLS support: no
   ODBC support: no
   OGR support: yes
   OpenCL support: no
   OpenGL support: no
   OpenMP support: no
   PNG support: yes
   POSIX thread support: no
   PostgreSQL support: no
   Readline support: no
   Regex support: yes
   SQLite support: yes
   TIFF support: no
   wxWidgets support: no
   X11 support: yes

>> make

[now only the last lines]

/usr/bin/install -c -m 644 GPL.TXT /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/GPL.TXT
/usr/bin/install -c -m 644 contributors.csv /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/contributors.csv
/usr/bin/install -c -m 644 contributors_extra.csv /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/contributors_extra.csv
/usr/bin/install -c -m 644 translators.csv /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/translators.csv
make[1]: Leaving directory `/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2'
make manifests
make[1]: Entering directory `/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2'
make[1]: Nothing to be done for `manifests'.
make[1]: Leaving directory `/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2'
GRASS GIS 7.0.2 r00000 compilation log
--------------------------------------------------
Started compilation: Tue Jan 5 16:37:22 CET 2016
--
Errors in:
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/display/d.path
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/display/d.vect
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/display/d.vect.chart
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/display/d.vect.thematic
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/g.copy
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/g.findfile
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/g.list
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/g.region
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/g.remove
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/g.rename
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/general/manage/lister
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/raster/r.carve
[...]
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.list
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.db.select
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.export
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.extract
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.import
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.what.strds
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.observe.strds
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/temporal/t.vect.univar
--
In case of errors please change into the directory with error and run 'make'.
If you get multiple errors, you need to deal with them in the order they
appear in the error log. If you get an error building a library, you will
also get errors from anything which uses the library.
--
Finished compilation: Tue Jan 5 16:41:53 CET 2016
make: *** [default] Error 1

Then I followed the advice:

  >>cd /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/display/d.path
>> make

: && gcc -L/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/lib -L/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/lib -Wl,--export-dynamic -Wl,-rpath-link,/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/lib -o /misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/bin/d.path OBJ.x86_64-unknown-linux-gnu/main.o OBJ.x86_64-unknown-linux-gnu/select.o -lgrass_display.7.0.2 -lgrass_vector.7.0.2 -lgrass_gis.7.0.2 -lm
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/lib/libgrass_vector.7.0.2.so: undefined reference to `OGR_GT_Flatten'
collect2: error: ld returned 1 exit status
make: *** [/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/bin/d.path] Error 1

So the error seem to be related to GDAL. I checked:

  >>cat $prefix_opt/bin/gdal-config

#!/bin/sh
CONFIG_LIBS="-L/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib -lgdal"
CONFIG_DEP_LIBS=" -lfreexl -L/usr/lib64 -lgeos_c -lsqlite3 -lodbc -lodbcinst -lexpat -lxerces-c -lpthread -L/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib -lopenjp2 -L/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt -L/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib -ljasper -lgif -ljpeg -L/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib -ltiff -lpng -L/usr/lib/postgresql92/lib64 -lpq -lz -lpthread -lm -lrt -ldl -lpcre -lcurl "
CONFIG_PREFIX="/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt"
CONFIG_CFLAGS="-I/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/include"
CONFIG_DATA="/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/share/gdal"
CONFIG_VERSION="2.0.1"
CONFIG_OGR_ENABLED=yes
CONFIG_FORMATS="gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b nitf bmp pcidsk airsar rs2 ilwis rmf leveller sgi srtmhgt idrisi gsg ingr ers jaxapalsar dimap gff cosar pds adrg coasp tsx terragen blx msgn til r northwood saga xyz hf2 kmlsuperoverlay ctg e00grid zmap ngsgeoid iris map wcs wms plmosaic grib bsb openjpeg jpeg2000 gif jpeg png pcraster rik ozi pdf rasterlite mbtiles postgisraster arg"
usage()

Which looks ok. I compiled gdal with success like this:

./configure --prefix $prefix_opt \
--with-python=yes --with-openjpeg=$prefix_opt --with-jasper=$prefix_opt \
--with-libtiff=$prefix_opt --without-libtool \
--with-hdf4=no --with-hdf5=no --with-netcdf=no \
--with-geotiff=internal \
--without-grass

Any ideas on how to proceed debugging? Now I'm lost.

Kind Regards, André Hollstein

--
Dr. André Hollstein
Sektion 1.4 Fernerkundung
Tel.: +49 (0)331/288-28969
Fax: +49 (0)331/288-28969
E-Mail: andre.hollstein@gfz-potsdam.de
___________________________________

Helmholtz-Zentrum Potsdam
Deutsches GeoForschungsZentrum GFZ
Stiftung des öff. Rechts Land Brandenburg
Telegrafenberg, 14473 Potsdam
Haus 17, Raum 20.23

Hi,

2016-01-05 16:59 GMT+01:00 Andre Hollstein <andre.hollstein@gfz-potsdam.de>:

/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86_64-unknown-linux-gnu/lib/libgrass_vector.7.0.2.so:
undefined reference to `OGR_GT_Flatten'
collect2: error: ld returned 1 exit status

probably more versions of GDAL installed on your system (check
/usr/lib and /usr/local/lib)? Add also
/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib to
your /etc/ld.so.conf and run `sudo ldconfig`. Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

-L/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x
86_64-unknown-linux-gnu/lib
-L/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.
x86_64-unknown-linux-gnu/lib -Wl,--export-dynamic
-Wl,-rpath-link,/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/gras
s-7.0.2/dist.x86_64-unknown-linux-gnu/lib -o
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86
_64-unknown-linux-gnu/bin/d.path OBJ.x86_64-unknown-linux-gnu/main.o
OBJ.x86_64-unknown-linux-gnu/select.o -lgrass_display.7.0.2
-lgrass_vector.7.0.2 -lgrass_gis.7.0.2 -lm
/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86
_64-unknown-linux-gnu/lib/libgrass_vector.7.0.2.so: undefined reference to
`OGR_GT_Flatten'
collect2: error: ld returned 1 exit status
make: ***
[/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x8
6_64-unknown-linux-gnu/bin/d.path] Error 1

It could mean that you are compiling against GDAL 2.0 headers, but the linking
is done against GDAL 1.X instead.

I guess the OGR_GT_Flatten dependency must comes from the resolution of GDAL
2.0 "#define wkbFlatten(x) OGR_GT_Flatten((OGRwkbGeometryType)(x))" from
ogr_core.h.

--
Spatialys - Geospatial professional services
http://www.spatialys.com

Hi,

Am 05.01.2016 um 17:19 schrieb Martin Landa:

probably more versions of GDAL installed on your system (check
/usr/lib and /usr/local/lib)? Add also
/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib to
your /etc/ld.so.conf and run `sudo ldconfig`. Ma

this is the case. I intend to build the software without needing root rights. Any ideas on how to force the usage of the right gdal libraries?

Also Even Rouault seems to think that different versions are causing problems:

Am 05.01.2016 um 17:26 schrieb Even Rouault:

/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86
_64-unknown-linux-gnu/lib/libgrass_vector.7.0.2.so: undefined reference to
`OGR_GT_Flatten'
collect2: error: ld returned 1 exit status
make: ***
[/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x8
6_64-unknown-linux-gnu/bin/d.path] Error 1

It could mean that you are compiling against GDAL 2.0 headers, but the linking
is done against GDAL 1.X instead.

I guess the OGR_GT_Flatten dependency must comes from the resolution of GDAL
2.0 "#define wkbFlatten(x) OGR_GT_Flatten((OGRwkbGeometryType)(x))" from
ogr_core.h.

What can I do apart from?

--with-gdal=$prefix_opt/bin/gdal-config

Best, André

--
Dr. André Hollstein
Sektion 1.4 Fernerkundung
Tel.: +49 (0)331/288-28969
Fax: +49 (0)331/288-28969
E-Mail: andre.hollstein@gfz-potsdam.de
___________________________________

Helmholtz-Zentrum Potsdam
Deutsches GeoForschungsZentrum GFZ
Stiftung des öff. Rechts Land Brandenburg
Telegrafenberg, 14473 Potsdam
Haus 17, Raum 20.23

Hi,

Am 05.01.2016 um 17:19 schrieb Martin Landa:

probably more versions of GDAL installed on your system (check
/usr/lib and /usr/local/lib)? Add also
/misc/fluo6/andre/projekte/custom_gfz_python/python_GFZ/opt/lib to
your /etc/ld.so.conf and run `sudo ldconfig`. Ma

this is the case. I intend to build the software without needing root
rights. Any ideas on how to force the usage of the right gdal libraries?

Also Even Rouault seems to think that different versions are causing
problems:

Am 05.01.2016 um 17:26 schrieb Even Rouault:

/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x86
_64-unknown-linux-gnu/lib/libgrass_vector.7.0.2.so: undefined reference to
`OGR_GT_Flatten'
collect2: error: ld returned 1 exit status
make: ***
[/misc/fluo6/andre/projekte/custom_gfz_python/tmp/grass/grass-7.0.2/dist.x8
6_64-unknown-linux-gnu/bin/d.path] Error 1

It could mean that you are compiling against GDAL 2.0 headers, but the linking
is done against GDAL 1.X instead.

I guess the OGR_GT_Flatten dependency must comes from the resolution of GDAL
2.0 "#define wkbFlatten(x) OGR_GT_Flatten((OGRwkbGeometryType)(x))" from
ogr_core.h.

What can I do apart from?

--with-gdal=$prefix_opt/bin/gdal-config

Best, André

--
Dr. André Hollstein
Sektion 1.4 Fernerkundung
Tel.: +49 (0)331/288-28969
Fax: +49 (0)331/288-28969
E-Mail: andre.hollstein@gfz-potsdam.de
___________________________________

Helmholtz-Zentrum Potsdam
Deutsches GeoForschungsZentrum GFZ
Stiftung des öff. Rechts Land Brandenburg
Telegrafenberg, 14473 Potsdam
Haus 17, Raum 20.23

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev