question on static binaries

Satish Balay balay at mcs.anl.gov
Wed Sep 13 10:26:59 CDT 2006


Its best to install PETSc on each cluster you need to use. 

However building PETSc binaries as static [and copying over to a
different cluster] should be possible.

There could be issues depending upon the library dependencies you
might have - and the compiler you use. There could also be issues with
MPI impls installed on each of these clusters [i.e MPI installed on
one cluster might not be appropriate for the other one]

If there are no MPI/other portability issues - either of the following
should work:

  1) With gcc - you can try using the link option '-static' and see if
the binary gets created. If not - look at the error messsage and see
what libraries are not a available as static.

For example - the following works for me [with a bunch of warnings]
on linux with gcc/g77

make ex2 LDFLAGS=-static PCC_LINKER_LIBS='-lm -lg2c'


2) If there are missing .a files preventing the above to work - you
can make sure the PETSc [and other package libraries] are built static
only - and create the executable. The do the following to get the list
of sharedlibraries required:

ldd executable 

Copy the executable to the remote machine - and invoke the same
command on the remote machine to get a list of 'missing shared
libraries'. Now copy these sharedlibs as well to the remote-machine -
and add the PATH to LD_LIBRARY_PATH - and then run the binary.

Satish


On Wed, 13 Sep 2006, Randall Mackie wrote:

> This may be a silly question, but is it possible to compile my PETSc program
> and build a static
> binary that will run on another cluster, or is it necessary to recompile my
> program on each
> cluster on which I want to run it?
> 
> Randy
> 
> 




More information about the petsc-users mailing list