[GRASS-dev] compiling GRASS fails at configure, unable to locate GDAL library

Hi, I am trying to make a fresh install of GRASS master, something I do routinely about every week (on Ubuntu 14.04). This time however, when running .configure (see below), I get the error message that the gdal library cannot be found. However, it is there, and in fact nothing changed since the last successful install of GRASS. Any ideas?

./configure --prefix=/usr/local/grass7 --enable-64bit --with-libs=/lib64 --with-sqlite --with-odbc --with-cairo --with-geos --with-cxx=yes --with-gdal=/usr/local/bin/ --with-python=yes --with-wxwidgets=/usr/bin/wx-config --with-readline --with-freetype --with-freetype-includes=/usr/include/freetype2 --enable-largefile --with-motif --with-motif-includes=/usr/include --with-proj-share=/usr/share/proj --with-postgres --with-postgres-libs=/usr/include/postgresql/libpq --with-postgres-includes=/usr/include/postgresql --with-lapack --with-blas --with-opencl --with-pthread

Gives me

checking for gdal-config... /usr/local/bin/gdal-config
configure: error: *** Unable to locate GDAL library.
...
checking for gdal-config... /usr/local/bin/gdal-config
configure: error: *** Unable to locate GDAL library.

On Thu, Oct 29, 2015 at 10:49 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

Hi, I am trying to make a fresh install of GRASS master, something I do
routinely about every week (on Ubuntu 14.04).

...

--with-pthread

(not sure if you want that, see other discussions here)

...

checking for gdal-config... /usr/local/bin/gdal-config
configure: error: *** Unable to locate GDAL library.

As usual, check config.log for the problem.

Markus

On Thu, Oct 29, 2015 at 10:52 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 29, 2015 at 10:49 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
> Hi, I am trying to make a fresh install of GRASS master, something I do
> routinely about every week (on Ubuntu 14.04).
...
> --with-pthread

(not sure if you want that, see other discussions here)

Yes, because of that discussion I had added that to see if it would give
any problem. None that I have noticed by the way. I will probably remove it
though.

...
>> checking for gdal-config... /usr/local/bin/gdal-config
>> configure: error: *** Unable to locate GDAL library.

As usual, check config.log for the problem.

I do not really understand the log info, but I guess the below is the
relevant part?

configure:6098:9: warning: ignoring return value of 'GDALOpen', declared
with attribute warn_unused_result [-Wunused-result]
GDALOpen("foo", GA_ReadOnly);
         ^
/usr/bin/ld: warning: libgrass_vector.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_dig2.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_dgl.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_rtree.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_linkm.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_dbmiclient.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_dbmibase.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_raster.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_imagery.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_gproj.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_gis.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgrass_datetime.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/local/gdal/lib/libgdal.so: undefined reference to `Rast_map_type'
/usr/local/gdal/lib/libgdal.so: undefined reference to
`Rast_get_fp_color_rule'
...
...
/usr/local/gdal/lib/libgdal.so: undefined reference to
`Vect_new_line_struct'
collect2: error: ld returned 1 exit status
configure: failed program was:
#line 6095 "configure"
#include "confdefs.h"
#include <gdal.h>
int main() {
GDALOpen("foo", GA_ReadOnly);
; return 0; }
configure:6118: gcc -o conftest -g -O2 -I/usr/local/gdal/include
-Wl,--export-dynamic -L/lib64 conftest.c -L/usr/local/gdal/lib -lgdal
-lproj -lfreexl -lm -L/usr/lib -lgeos_c -lodbc -lodbcinst -lkmldom
-lkmlbase -lkmlengine -lkmlconvenience -lminizip -luriparser -lexpat
-ljasper -lnetcdf -lhdf5 -lmfhdf -ldf -logdi
-L/usr/local/grass7/grass-7.1.svn/lib -lgrass_vector -lgrass_dig2
-lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase
-lgrass_raster -lgrass_imagery -lgrass_gproj -lgrass_gmath -lgrass_gis
-lgrass_datetime -L/usr/lib -lpq -lz -lpthread -lm -lrt -ldl -lspatialite
-lsqlite3 -lpcre -L/usr/lib/x86_64-linux-gnu -lcurl -lxml2 1>&5
configure: In function 'main':
configure:6114:9: warning: ignoring return value of 'GDALOpen', declared
with attribute warn_unused_result [-Wunused-result]
GDALOpen("foo", GA_ReadOnly);
         ^
/usr/bin/ld: cannot find -lgrass_vector
/usr/bin/ld: cannot find -lgrass_dig2
/usr/bin/ld: cannot find -lgrass_dgl
/usr/bin/ld: cannot find -lgrass_rtree
/usr/bin/ld: cannot find -lgrass_linkm
/usr/bin/ld: cannot find -lgrass_dbmiclient
/usr/bin/ld: cannot find -lgrass_dbmibase
/usr/bin/ld: cannot find -lgrass_raster
/usr/bin/ld: cannot find -lgrass_imagery
/usr/bin/ld: cannot find -lgrass_gproj
/usr/bin/ld: cannot find -lgrass_gmath
/usr/bin/ld: cannot find -lgrass_gis
/usr/bin/ld: cannot find -lgrass_datetime
collect2: error: ld returned 1 exit status
configure: failed program was:
#line 6111 "configure"
#include "confdefs.h"
#include <gdal.h>
int main() {
GDALOpen("foo", GA_ReadOnly);
; return 0; }

Markus

On Thu, Oct 29, 2015 at 11:29 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

I do not really understand the log info, but I guess the below is the
relevant part?

configure:6098:9: warning: ignoring return value of 'GDALOpen', declared
with attribute warn_unused_result [-Wunused-result]
GDALOpen("foo", GA_ReadOnly);
         ^
/usr/bin/ld: warning: libgrass_vector.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)

...

/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/local/gdal/lib/libgdal.so: undefined reference to `Rast_map_type'
/usr/local/gdal/lib/libgdal.so: undefined reference to
`Rast_get_fp_color_rule'
...
...
/usr/local/gdal/lib/libgdal.so: undefined reference to
`Vect_new_line_struct'

Did you compile GDAL with GRASS GIS support?

If yes:
This is not recommended - instead use the GDAL-GRASS plugin to
disentangle them properly.

Markus

On 29-10-15 11:38, Markus Neteler wrote:

On Thu, Oct 29, 2015 at 11:29 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

I do not really understand the log info, but I guess the below is the
relevant part?

configure:6098:9: warning: ignoring return value of 'GDALOpen', declared
with attribute warn_unused_result [-Wunused-result]
  GDALOpen("foo", GA_ReadOnly);
          ^
/usr/bin/ld: warning: libgrass_vector.so, needed by
/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)

...

/usr/local/gdal/lib/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/local/gdal/lib/libgdal.so: undefined reference to `Rast_map_type'
/usr/local/gdal/lib/libgdal.so: undefined reference to
`Rast_get_fp_color_rule'
...
/usr/local/gdal/lib/libgdal.so: undefined reference to
`Vect_new_line_struct'

Did you compile GDAL with GRASS GIS support?

If yes:
This is not recommended - instead use the GDAL-GRASS plugin to
disentangle them properly.

Thanks Marcus for the feedback. Yes I did compile GDAL with GRASS support, mostly because using the GDAL-GRASS plugin has always been problematic, something I never have managed to solve, while compiling GDAL with GRASS GIS support always have worked without problem for me. But it has been a while I tried last, so I will try again, see if it works this time. Nevertheless, I am not sure I understand why compiling GRASS now suddenly doesn't work; as I mentioned, the only thing that has changed since the last time I compiled GRASS (about a week ago) is that I got a fresh download of the GRASS.

Markus

On Thu, Oct 29, 2015 at 12:03 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On 29-10-15 11:38, Markus Neteler wrote:

This is not recommended - instead use the GDAL-GRASS plugin to
disentangle them properly.

Thanks Marcus for the feedback. Yes I did compile GDAL with GRASS support,
mostly because using the GDAL-GRASS plugin has always been problematic,

... indeed it is asking for troubles :slight_smile:
That's why the plugin was developed.

something I never have managed to solve, while compiling GDAL with GRASS GIS
support always have worked without problem for me. But it has been a while I
tried last, so I will try again, see if it works this time.

Be sure to pick the right version, e.g.
http://download.osgeo.org/gdal/1.11.3/
--> gdal-grass-1.11.3.tar.gz

Markus

On Thu, Oct 29, 2015 at 12:10 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 29, 2015 at 12:03 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
> On 29-10-15 11:38, Markus Neteler wrote:
>> This is not recommended - instead use the GDAL-GRASS plugin to
>> disentangle them properly.
>
> Thanks Marcus for the feedback. Yes I did compile GDAL with GRASS
support,
> mostly because using the GDAL-GRASS plugin has always been problematic,

... indeed it is asking for troubles :slight_smile:
That's why the plugin was developed.

I know that is the idea. However, for me since I started to use GRASS 7 it
has been the other way around for me. Getting things to work with the
plugin has always provided me with much more (unsolvable) trouble than the
admittedly more cumbersome compiling GDAL with GRASS support route. The
last time I gave it a try was about half a year or bit more ago I think, so
perhaps things have improved since.

> something I never have managed to solve, while compiling GDAL with GRASS
GIS
> support always have worked without problem for me. But it has been a
while I
> tried last, so I will try again, see if it works this time.

Be sure to pick the right version, e.g.
http://download.osgeo.org/gdal/1.11.3/
--> gdal-grass-1.11.3.tar.gz

And in the meantime I realize what went wrong. It is indeed the kind of
trouble you were referring too. I usually do the following steps to make a
fresh install of GRASS:1) Get a fresh copy of the source files, 2) run
configure, 3) run make, 4) remove the old GRASS program folder in
/usr/local, 5) run make install.

For no particular reason, this time I started by removing the GRASS program
folder. Now, what I didn't realize is that during configuration of GRASS
there is a check whether GDAL is installed properly. It is, except that I
just removed the GRASS program folder. Because GDAL is compiled with GRASS
support, the check for a properly installed GDAL throws an error of GDAL
not finding GRASS.

Keeping the order as outlined above, removing the GRASS folder only just
before running 'make install' works.

I still agree I should try to use the GDAL-GRASS plugin instead of using
GDAL compiled with GRASS support. Will do that when I have a little bit
more time at hand.

Thanks for the feedback Marcus, appreciated.

Markus

On Thu, Oct 29, 2015 at 1:21 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On Thu, Oct 29, 2015 at 12:10 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 29, 2015 at 12:03 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
> On 29-10-15 11:38, Markus Neteler wrote:
>> This is not recommended - instead use the GDAL-GRASS plugin to
>> disentangle them properly.
>
> Thanks Marcus for the feedback. Yes I did compile GDAL with GRASS
> support,
> mostly because using the GDAL-GRASS plugin has always been problematic,

... indeed it is asking for troubles :slight_smile:
That's why the plugin was developed.

I know that is the idea. However, for me since I started to use GRASS 7 it
has been the other way around for me.

Yes - but it was simply not working, so that's no surprise...

Getting things to work with the plugin
has always provided me with much more (unsolvable) trouble than the
admittedly more cumbersome compiling GDAL with GRASS support route. The last
time I gave it a try was about half a year or bit more ago I think, so
perhaps things have improved since.

Probably yes:

September 2015
https://trac.osgeo.org/gdal/wiki/Release/1.11.3-News
--> Build (Unix)
    Support custom buildflags in GRASS plugin (#5850)
    GRASS 7.0.0 support (#5852)

[...]

I still agree I should try to use the GDAL-GRASS plugin instead of using
GDAL compiled with GRASS support. Will do that when I have a little bit more
time at hand.

Thanks for the feedback Marcus, appreciated.

You are welcome,

Markus