[GRASS5] gdal-config --dep-libs

Should be `gdal-config --dep-libs` also added to GDAL_LIBS?
How is it possible that GRASS compiles without GDAL dep-libs?

Radim

Radim Blazek wrote:

Should be `gdal-config --dep-libs` also added to GDAL_LIBS?

Yes; although we need to check when that switch was added (it hasn't
always been there), and possibly update REQUIREMENTS.html accordingly.

How is it possible that GRASS compiles without GDAL dep-libs?

If GDAL is a shared library, it normally includes dependency
information, so linking against libgdal automatically pulls in the
dependencies.

If it's a static library, it won't work (this has been reported
previously on one of the GRASS lists; this may be the reason why that
switch was added).

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

Radim Blazek wrote:

Should be `gdal-config --dep-libs` also added to GDAL_LIBS?
How is it possible that GRASS compiles without GDAL dep-libs?

Radim,

gdal-config --dep-libs is a list of libraries that GDAL depends on.
If you were to link against the GDAL static library you would need
to also link against the dependent libs. However, the shared library
already holds the dependencies on these other libraries (or has statically
linked them in as appropriate) so you shouldn't normally need anything
but the -lgdal for dynamic linking.

Note, this holds true for Linux. There may be other platforms where shared
libraries don't keep track of their dependencies. I'm not sure.

Best regards,

--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent

Glynn Clements wrote:

Radim Blazek wrote:

Should be `gdal-config --dep-libs` also added to GDAL_LIBS?

Yes; although we need to check when that switch was added (it hasn't
always been there), and possibly update REQUIREMENTS.html accordingly.

How is it possible that GRASS compiles without GDAL dep-libs?

If GDAL is a shared library, it normally includes dependency
information, so linking against libgdal automatically pulls in the
dependencies.

If it's a static library, it won't work (this has been reported
previously on one of the GRASS lists; this may be the reason why that
switch was added).

http://xserve.flids.com/pipermail/gdal-dev/2004-February/004965.html
So it should be in 1.2.1?

My suggestion:

if test -n `gdal-config | grep 'dep-libs'` ; then
     GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
     GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS"
fi

Radim

Radim Blazek wrote:

>>Should be `gdal-config --dep-libs` also added to GDAL_LIBS?
>
>
> Yes; although we need to check when that switch was added (it hasn't
> always been there), and possibly update REQUIREMENTS.html accordingly.
>
>
>>How is it possible that GRASS compiles without GDAL dep-libs?
>
>
> If GDAL is a shared library, it normally includes dependency
> information, so linking against libgdal automatically pulls in the
> dependencies.
>
> If it's a static library, it won't work (this has been reported
> previously on one of the GRASS lists; this may be the reason why that
> switch was added).

http://xserve.flids.com/pipermail/gdal-dev/2004-February/004965.html
So it should be in 1.2.1?

My suggestion:

if test -n `gdal-config | grep 'dep-libs'` ; then
     GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
     GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS"
fi

Or:
  GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs 2>/dev/null`
  GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS"

If gdal-config doesn't understand the --dep-libs switch, it won't
write anything to stdout.

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