Opened 6 years ago

Closed 6 years ago

#4259 closed defect (worksforme)

PostGIS 2.5 unable to compile with GDAL 2.3

Reported by: nstires Owned by: pramsey
Priority: medium Milestone: PostGIS 2.5.2
Component: postgis Version: 2.5.x -- EOL
Keywords: postgis gdal Cc:

Description

I'm attempting to build PostGIS 2.5 with the GDAL 2.3 libraries. It seems to require GDALv1 however. I saw that there's GDALv2 support on Windows however. I was unable to find a previous ticket that referenced the same issue.

[root@build rpm]# cat /etc/centos-release
CentOS release 6.10 (Final)

[root@build rpm]# java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

[root@build rpm]# gdalinfo --version
GDAL 2.3.2, released 2018/09/21

[root@build rpm]# gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@build rpm]# g++ --version
g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

##################################################################

[root@build rpm]# ll /usr/lib
total 57444
drwxr-xr-x. 3 root root     4096 Sep 17 14:05 anaconda-runtime
drwxr-xr-x. 5 root root     4096 Sep 17 14:52 ConsoleKit
dr-xr-xr-x. 2 root root     4096 Sep 23  2011 games
drwxr-xr-x. 3 root root     4096 Jun 19 08:10 gcc
drwxr-xr-x. 2 root root     4096 May 10  2016 java
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.3.1
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.4.0
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.4.1
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.4.2
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.5.0
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.6.0
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.7.0
drwxr-xr-x. 2 root root     4096 May 10  2016 java-1.8.0
drwxr-xr-x. 2 root root     4096 May 10  2016 java-ext
drwxr-xr-x. 5 root root     4096 Sep 17 14:52 jvm
drwxr-xr-x. 2 root root     4096 May 10  2016 jvm-commmon
drwxr-xr-x. 5 root root     4096 Sep 17 14:52 jvm-exports
drwxr-xr-x. 5 root root     4096 Sep 17 14:52 jvm-private
-rw-r--r--. 1 root root 30521472 Oct 11 15:33 libgdal.a
-rwxr-xr-x. 1 root root   523008 Oct 11 15:33 libgdalalljni.so
lrwxrwxrwx. 1 root root       13 Nov 26 12:20 libgdalalljni.so.20 -> libgdaljni.so
lrwxrwxrwx. 1 root root       16 Nov 26 12:20 libgdaljni.so -> libgdalalljni.so
-rwxr-xr-x. 1 root root     1032 Oct 11 15:33 libgdal.la
lrwxrwxrwx. 1 root root       17 Nov 26 12:20 libgdal.so -> libgdal.so.20.4.2
lrwxrwxrwx. 1 root root       17 Nov 26 12:20 libgdal.so.20 -> libgdal.so.20.4.2
-rwxr-xr-x. 1 root root 15799072 Oct 11 15:33 libgdal.so.20.4.2
-rwxr-xr-x. 1 root root  5934696 Oct 11 15:33 libltidsdk.so
-rwxr-xr-x. 1 root root  5934696 Oct 11 15:33 libltidsdk.so.9
dr-xr-xr-x. 2 root root     4096 Sep 17 14:26 locale
drwxr-xr-x. 2 root root     4096 Nov 26 12:20 pkgconfig
drwxr-xr-x. 3 root root     4096 Aug 18  2016 python2.6
drwxr-xr-x. 4 root root     4096 Sep 17 14:29 rpm
drwxr-xr-x. 4 root root     4096 Sep 17 14:30 ruby
lrwxrwxrwx. 1 root root       30 Sep 17 14:26 sendmail -> /etc/alternatives/mta-sendmail
lrwxrwxrwx. 1 root root       24 Sep 17 14:26 sendmail.postfix -> ../sbin/sendmail.postfix
drwxr-xr-x. 2 root root     4096 Mar 22  2017 yum-plugins

##################################################################

[root@build postgis25-2.5.1]# ./configure --with-pgconfig=/usr/pgsql-9.6/bin/pg_config
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld
checking if the linker (/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /opt/rh/devtoolset-2/root/usr/bin/nm -B
checking the name lister (/opt/rh/devtoolset-2/root/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... gawk
checking command to parse /opt/rh/devtoolset-2/root/usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... (cached) /bin/grep
checking for cpp... /opt/rh/devtoolset-2/root/usr/bin/cpp
checking if gcc supports -Wall... yes
checking if gcc supports -Wmissing-prototypes... yes
checking if gcc supports -ffloat-store... yes
checking if gcc supports --exclude-libs... yes
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for bison... bison -y
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for vasprintf... yes
checking for asprintf... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking whether isfinite is declared... yes
checking whether isfinite is declared... yes
checking for perl... /usr/bin/perl
checking for xsltproc... /usr/bin/xsltproc
checking for convert... no
configure: WARNING: ImageMagick does not seem to be installed. Documentation cannot be built
checking for dblatex... no
configure: WARNING: dblatex is not installed so PDF documentation cannot be built
checking for xmllint... /usr/bin/xmllint
checking CUnit/CUnit.h usability... no
checking CUnit/CUnit.h presence... no
checking for CUnit/CUnit.h... no
configure: WARNING: could not locate CUnit required for unit tests
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking for libiconv_open in -liconv... no
checking for iconv_open in -lc... yes
checking for iconvctl... no
checking for libiconvctl... no
Using user-specified pg_config file: /usr/pgsql-9.6/bin/pg_config
checking PostgreSQL version... PostgreSQL 9.6.11
checking libpq-fe.h usability... yes
checking libpq-fe.h presence... yes
checking for libpq-fe.h... yes
checking for PQserverVersion in -lpq... yes
checking for xml2-config... /usr/bin/xml2-config
checking libxml/tree.h usability... yes
checking libxml/tree.h presence... yes
checking for libxml/tree.h... yes
checking libxml/parser.h usability... yes
checking libxml/parser.h presence... yes
checking for libxml/parser.h... yes
checking libxml/xpath.h usability... yes
checking libxml/xpath.h presence... yes
checking for libxml/xpath.h... yes
checking libxml/xpathInternals.h usability... yes
checking libxml/xpathInternals.h presence... yes
checking for libxml/xpathInternals.h... yes
checking for xmlInitParser in -lxml2... yes
checking for geos-config... /usr/bin/geos-config
checking GEOS version... 3.5.0
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking for initGEOS in -lgeos_c... yes
checking for sfcgal-config... no
checking whether make sets $(MAKE)... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for ld used by GCC... /opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld -m elf_x86_64
checking if the linker (/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld -m elf_x86_64) is GNU ld... yes
checking for shared library run path origin... /bin/sh: build-aux/config.rpath: No such file or directory
done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
checking for pj_get_release in -lproj... yes
checking json/json.h usability... yes
checking json/json.h presence... yes
checking for json/json.h... yes
checking for json_object_get in -ljson-c... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for PROTOBUFC... no
checking pcre.h usability... yes
checking pcre.h presence... yes
checking for pcre.h... yes
TOPOLOGY: Topology support requested
RASTER: Raster support requested
checking for gdal-config... /usr/bin/gdal-config
checking GDAL version... 2.3.2
checking for OGR enabled... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking ogr_api.h usability... yes
checking ogr_api.h presence... yes
checking for ogr_api.h... yes
checking cpl_conv.h usability... yes
checking cpl_conv.h presence... yes
checking for cpl_conv.h... yes
checking for library containing GDALAllRegister... no
configure: error: could not find GDAL

Attachments (1)

config.log (257.8 KB ) - added by nstires 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Algunenano, 6 years ago

It seems to require GDALv1 however.

Not at all. In Travis (https://travis-ci.org/postgis/postgis/) you can see it building against multiple releases of Gdal (1.1, 2.2 and 2.3).

That step is trying to link against gdal using the flags provided by gdal-config. Please check that the output of gdal-config matches what's installed in your system:

$ gdal-config --cflags
-I/usr/include
$ gdal-config --libs
-L/usr/lib -lgdal

If that's correct, please check the output of config.log for the compiler error message.

by nstires, 6 years ago

Attachment: config.log added

comment:2 by nstires, 6 years ago

Thanks for getting back to me @Algunenano!

I've attached the config.log. I do have the aforementioned output from gdal-config:

[root@build postgis25-2.5.1]# gdal-config --cflags
-I/usr/include
[root@build postgis25-2.5.1]# gdal-config --libs
-L/usr/lib64 -lgdal

One thing of note: the lib path is set to lib64, but they actually reside within /usr/lib. I've also built the gdal packages, is this a build flag?

Last edited 6 years ago by nstires (previous) (diff)

comment:3 by Algunenano, 6 years ago

One thing of note: the lib path is set to lib64, but they actually reside within /usr/lib. I've also built the gdal packages, is this a build flag?

Most likely your /usr/lib64 just points to /usr/lib:

$ ls -al /usr/lib64
lrwxrwxrwx 1 root root 3 ago 21 16:21 /usr/lib64 -> lib

The problem appears to reside in your GDAL installation. From the log:

configure:17642: gcc -o conftest -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/include  conftest.c -L/usr/lib64 -lgdal >&5
/usr/lib/libgdal.so: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
/usr/lib/libgdal.so: undefined reference to `std::_Hash_bytes(void const*, unsigned long, unsigned long)'
/usr/lib/libgdal.so: undefined reference to `std::__detail::_List_node_base::_M_unhook()'
/usr/lib/libgdal.so: undefined reference to `std::__detail::_Prime_rehash_policy::_M_next_bkt(unsigned long) const'
/usr/lib/libgdal.so: undefined reference to `std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
/usr/lib/libgdal.so: undefined reference to `std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned long, unsigned long) const'
/usr/lib/libgdal.so: undefined reference to `std::string::back()'
collect2: error: ld returned 1 exit status
configure:17642: $? = 1
configure: failed program was:

You might be mixing gcc or libstdc++ releases so you'll need to find how to sort it out.

comment:4 by robe, 6 years ago

Resolution: worksforme
Status: newclosed

Closing this out as it seems specific to the user setup and not a PostGIS specific issue.

Note: See TracTickets for help on using tickets.