Skip to content

Comments

GDAL GRASS driver: add rpath to Makefile.in#5503

Merged
rouault merged 1 commit intoOSGeo:masterfrom
metzm:gdal-grass
Apr 18, 2022
Merged

GDAL GRASS driver: add rpath to Makefile.in#5503
rouault merged 1 commit intoOSGeo:masterfrom
metzm:gdal-grass

Conversation

@metzm
Copy link
Contributor

@metzm metzm commented Mar 24, 2022

What does this PR do?

Add -Wl,-rpath,<path> to Makefile.in of the GDAL GRASS driver. This is supposed to be a generic solution replacing the Debian patch.

The reason for this PR, as well as the Debian patch, is that GRASS shared libraries are in a non-standard location that is usually not in the common list of directories with shared libraries, also not in /etc/ld.so.conf.d/* and not in LD_LIBRARY_PATH.

@rouault
Copy link
Member

rouault commented Mar 24, 2022

CC @sebastic

@sebastic
Copy link
Contributor

I'd rather see GRASS getting its act together and use FHS compliant paths for everything it installs thereby removing the need to set RUNPATH [1].

This is a simpler change that we've carried in the Debian package since before I got involved, but it's not a solution in itself.

As mentioned in the grass-dev thread [2], GRASS itself doesn't set RUNPATH causing drivers loaded via gdal-grass to fail when trying to load the NEEDED libraries.

@metzm
Copy link
Contributor Author

metzm commented Mar 25, 2022

I see. In this case this PR, just like the Debian patch, does not help.

A solution, as long as GRASS libraries are in non-standard directories, would be to create something like /etc/ld.so.conf.d/grass.conf if possible, but this is beyond my Makefile skills. Simply adding

echo "@GRASS_GISBASE@/lib" > /etc/ld.so.conf.d/grass.conf

to the install: section is probably not save.

@sebastic
Copy link
Contributor

Adding a non-standard library path to ld.so.conf is a violation of Debian policy as also mentioned in the thread on grass-dev:

https://lists.osgeo.org/pipermail/grass-dev/2022-February/095606.html

For an acceptable solution either GRASS needs to set RUNPATH to find its libraries in non-standard paths (then gdal-grass can do the same), or it needs to install the libraries in standard paths (and gdal-grass won't need RUNPATH either).

@metzm
Copy link
Contributor Author

metzm commented Mar 25, 2022

A pity. The GRASS startup mechanisms do set RUNPATH to find the GRASS libraries, but since the gdal-grass plugin is a library, I don't see how the gdal-grass plugin can set RUNPATH such that GRASS libraries find other GRASS libraries.

Therefore the only solution for the time being seems to be that users set LD_LIBRARY_PATH themselves before using the gdal-grass plugin.

@sebastic
Copy link
Contributor

/usr/bin/grass sets LD_LIBRARY_PATH to find the libraries in non-standard paths, if the GRASS build sets RUNPATH on the binaries and libraries the LD_LIBRARY_PATH work around won't be needed any more either.

@metzm
Copy link
Contributor Author

metzm commented Mar 25, 2022

With GRASS PR 2280 and this PR, the GDAL-GRASS plugin works without any further modifications to LD_LIBRARY_PATH or /etc/ld.so.conf.d/.

@stale
Copy link

stale bot commented Apr 16, 2022

The GDAL project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 21 days and is being automatically marked as "stale". If you think this pull request should be merged, please check - that all unit tests are passing - that all comments by reviewers have been addressed - that there is enough information for reviewers, in particular

  • link to any issues which this pull request fixes
  • add a description of workflows which this pull request fixes
  • add screenshots if applicable
  • that you have written unit tests where possible In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request. If there is no further activity on this pull request, it will be closed in a week.

@stale stale bot added the stale label Apr 16, 2022
@neteler
Copy link
Member

neteler commented Apr 17, 2022

@rouault @sebastic can this PR be merged?

@stale stale bot removed the stale label Apr 17, 2022
@sebastic
Copy link
Contributor

It's more useful now that GRASS sets RUNPATH.

@rouault rouault merged commit 21b34ff into OSGeo:master Apr 18, 2022
@neteler
Copy link
Member

neteler commented Apr 22, 2022

@rouault Can this please be added to the upcoming GDAL 3.4.3? Thanks

@rouault
Copy link
Member

rouault commented Apr 22, 2022

ok I'm doing it, but it should be the responsibility of contributors to ensure they have backported their changes ahead of release time (tagging their pull requests with the "backport release/XXXX" label)

@neteler
Copy link
Member

neteler commented Apr 22, 2022

Thanks and sorry about not being aware of this procedure so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants