[petsc-users] Configuring PETSc to use a relative RPATH with $ORIGIN

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Mon Feb 24 10:07:27 CST 2025


Hello,

We would like to make the libraries generated from PETSc compilation and 
installation more easily relocatable. Currently, we work around this 
limitation by using LD_LIBRARY_PATH in the environment and manually 
modifying the RPATH recorded in the libraries to remove it.

Recently, we discovered an interesting approach: during the build 
process, we can set a relative RPATH using the $ORIGIN variable, which 
corresponds to the directory containing the library. This allows 
libpetsc.so dependencies to be referenced relatively instead of 
absolutely, making the library "movable" without requiring 
LD_LIBRARY_PATH modifications. We can also apply the same approach to 
our binaries.

To avoid manually modifying the libraries after their creation, we were 
wondering if there is a way to configure PETSc to use a relative RPATH 
with $ORIGIN directly?

I looked through PETSc's configuration options and files but couldn't 
find anything mentioning $ORIGIN, and very little related to RPATH.

A SPACK newbie question: is this achievable with SPACK?

Thanks in advance for your help!

Eric

-- 
Eric Chamberland, ing., M. Ing
Professionnel de recherche
GIREF/Université Laval
(418) 656-2131 poste 41 22 42



More information about the petsc-users mailing list