[petsc-users] petsc rpath

Satish Balay balay at mcs.anl.gov
Wed Nov 24 10:19:16 CST 2010


On Wed, 24 Nov 2010, Satish Balay wrote:

> B1;2601;0cOn Wed, 24 Nov 2010, Jed Brown wrote:
> 
> > On Wed, Nov 24, 2010 at 16:26, Jens-Malte Gottfried <jmgottfried at web.de>wrote:
> > 
> > > I am trying to write a gentoo ebuild for petsc (my current work is
> > > already in the science overlay).
> > > Is there any possibility to disable writing the RPATH of the
> > > to-be-generated libpetsc.so?
> > > Currently, the library is built fine but RPATH is set to
> > >
> > >
> > > /usr/lib64:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4:/usr/x86_64-pc-linux-gnu/lib
> > > which is not neccessary. Before trying to patch the build system,
> > > perhaps there is a simple configure option which I did not find.
> > >
> > 
> > The standard build system does not provide an easy way to do this.  If you
> > are using petsc-dev, you use CMake (configure as usual, but then run make
> > from $PETSC_DIR/$PETSC_ARCH instead of from $PETSC_DIR).  The CMake build
> > files default to setting RPATH, but it is easy to set the cache variables to
> > disable RPATH.
> 
> Some of the above comes from 'gfortran -v' - which checkFortranLibraries() etc do..
> 
> For such known systems with known compatibility libraries [ and each
> language compiler can find each others libs] you can use:
> 
> [for c++ build]

I meant c build..

> -with-clib-autodetect=0 -with-fortranlib-autodetect=0 LIBS=-lgfortran
> 
> [for c++ build]
> -with-clib-autodetect=0 -with-cxxlib-autodetect=0 -with-fortranlib-autodetect=0 LIBS='-lstdc++ -lgfortran'
> 
> Wrt -rpath for -lpetsc, perhaps commenting out the following line in
> config/BuildSystem/config/setCompilers.py is sufficient:
> 
>     self.executeTest(self.checkSharedLinkerPaths)

Actually you need '-L' there - so the following change will remove -rpath

asterix:/home/balay/tmp/petsc-dist-test/config/BuildSystem>hg diff
diff -r 5fac76781491 config/setCompilers.py
--- a/config/setCompilers.py    Mon Sep 20 16:15:14 2010 -0500
+++ b/config/setCompilers.py    Wed Nov 24 10:12:46 2010 -0600
@@ -1188,7 +1188,7 @@
       self.pushLanguage(language)
       # test '-R' before '-rpath' as sun compilers [c,fortran] don't give proper errors with wrong options.
       if not Configure.isDarwin():      
-        testFlags = ['-Wl,-rpath,', '-R','-rpath ' , '-Wl,-R,']
+        testFlags = []
       else:
         testFlags = []
       # test '-R' before '-Wl,-rpath' for SUN compilers [as cc on linux accepts -Wl,-rpath, but  f90 & CC do not.
asterix:/home/balay/tmp/petsc-dist-test/config/BuildSystem>



Satish


More information about the petsc-users mailing list