[GRASS-dev] cannot build gdal-grass

Hi

gdal-grass 1.4.3 refuses to build against GDAL 1.5.2 r14751 and GRASS 6.4 r31801.

Details:

$ $ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
/usr/local/grass-6.4.svn/lib
/usr/local/qgis/lib

$ sudo ldconfig

$ ./configure --prefix=/usr/local --with-grass=/usr/local/grass-6.4.svn
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
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 ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for ranlib... ranlib
checking for g++ -shared ... yes
checking for gdal-config... /usr/local/bin/gdal-config
using /usr/local/lib/gdalplugins as GDAL shared library autoload directory
checking for G_asprintf in -lgrass_gis... no
configure: error: --with-grass=/usr/local/grass-6.4.svn requested, but
libraries not found! Perhaps you need to set LD_LIBRARY_PATH to include
/usr/local/grass-6.4.svn/lib

That's strange, because:

$ cd /usr/local/grass-6.4.svn/lib

$ nm libgrass_gis.so | grep G_asprintf
0000000000013da0 T G_asprintf

and

$ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
/usr/local/grass-6.4.svn/lib
/usr/local/qgis/lib

What could be wrong? This used to work couple of days ago.

Debian testing amd64.

Maciek

--
Maciej Sieczka
www.sieczka.org

Maciej Sieczka wrote:

gdal-grass 1.4.3 refuses to build against GDAL 1.5.2 r14751 and GRASS
6.4 r31801.

checking for G_asprintf in -lgrass_gis... no
configure: error: --with-grass=/usr/local/grass-6.4.svn requested, but
libraries not found! Perhaps you need to set LD_LIBRARY_PATH to include
/usr/local/grass-6.4.svn/lib

What could be wrong? This used to work couple of days ago.

Look in config.log for the actual error message.

When configure says that a library is "not found", it means that it
couldn't link against it. There are a whole load of reasons why that
might be the case.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements pisze:

Maciej Sieczka wrote:

gdal-grass 1.4.3 refuses to build against GDAL 1.5.2 r14751 and
GRASS 6.4 r31801.

checking for G_asprintf in -lgrass_gis... no configure: error:
--with-grass=/usr/local/grass-6.4.svn requested, but libraries not
found! Perhaps you need to set LD_LIBRARY_PATH to include /usr/local/grass-6.4.svn/lib

What could be wrong? This used to work couple of days ago.

Look in config.log for the actual error message.

Right.

Here's the relevant part I guess:

configure:2939: checking for G_asprintf in -lgrass_gis
configure:2969: gcc -o conftest -O2 conftest.c -lgrass_gis
-L/usr/local/grass-6.4.svn/lib -lgrass_I -lgrass_vask -lgrass_gmath
-lgrass_gis -lgrass_datetime -lgrass_gproj -lgrass_vect -lgrass_dbmibase
-lgrass_dbmiclient -lgrass_dgl -lgrass_dig2 -lgrass_rtree -lgrass_linkm
-L/usr/local/lib -lgdal >&5
/usr/bin/ld: cannot find -lgrass_I
collect2: ld returned 1 exit status
configure:2975: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #ifdef __cplusplus
| extern "C" void exit (int) throw ();
| #endif
| #define USE_GNUCC 1
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char G_asprintf ();
| int
| main ()
| {
| G_asprintf ();
| ;
| return 0;
| }
configure:3001: result: no
configure:3015: error: --with-grass=/usr/local/grass-6.4.svn requested,
but libraries not found! Perhaps you need to set LD_LIBRARY_PATH to
include /usr/local/grass-6.4.svn/lib?

When configure says that a library is "not found", it means that it couldn't link against it. There are a whole load of reasons why that might be the case.

Any hints?

Maciek

--
Maciej Sieczka
www.sieczka.org

Maciej Sieczka wrote:

>> gdal-grass 1.4.3 refuses to build against GDAL 1.5.2 r14751 and
>> GRASS 6.4 r31801.
>>
>> checking for G_asprintf in -lgrass_gis... no configure: error:
>> --with-grass=/usr/local/grass-6.4.svn requested, but libraries not
>> found! Perhaps you need to set LD_LIBRARY_PATH to include
>> /usr/local/grass-6.4.svn/lib
>>
>> What could be wrong? This used to work couple of days ago.

> Look in config.log for the actual error message.

Right.

Here's the relevant part I guess:

/usr/bin/ld: cannot find -lgrass_I

Ah. The imagery library isn't called libgrass_I any more; it's now
called libgrass_imagery.

It was changed at the same time that I moved the clustering code to a
separate library. However, I didn't realise that it had been
back-ported to 6.4.

You can probably get around the problem by adding a symlink, e.g.:

  ln -s libgrass_imagery.so /usr/local/grass-6.4.svn/lib/libgrass_I.so

--
Glynn Clements <glynn@gclements.plus.com>

On Mon, Jun 23, 2008 at 1:38 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:

Maciej Sieczka wrote:

>> gdal-grass 1.4.3 refuses to build against GDAL 1.5.2 r14751 and
>> GRASS 6.4 r31801.
>>
>> checking for G_asprintf in -lgrass_gis... no configure: error:
>> --with-grass=/usr/local/grass-6.4.svn requested, but libraries not
>> found! Perhaps you need to set LD_LIBRARY_PATH to include
>> /usr/local/grass-6.4.svn/lib
>>
>> What could be wrong? This used to work couple of days ago.

> Look in config.log for the actual error message.

Right.

Here's the relevant part I guess:

/usr/bin/ld: cannot find -lgrass_I

Ah. The imagery library isn't called libgrass_I any more; it's now
called libgrass_imagery.

It was changed at the same time that I moved the clustering code to a
separate library. However, I didn't realise that it had been
back-ported to 6.4.

Obviously we cannot change a library name in 6.x as it is
hardcoded here:
http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/grass/pkg/configure.in#L126

I have reverted the name change in 6.4.svn.
Maciej, it should work again if you use 6.x.

One day, however, the plugin and GRASS 7 need a library name sync or some
condition in above indicated GDAL file.

Markus