Build Petsc with Shared Libraries

Sean Farley sean.michael.farley at
Wed Jul 18 11:11:36 PDT 2012

> The libraries have not been linked correctly. I assume the first line in
> otool -L /opt/local/lib/petsc/lib/libpetsc.dylib contains the
> worksrcdir, which causes this issue when linking against it.
> Please file a bug so the maintainer can fix this.

The PETSc portfile is very wrong, particularly with the prefix
install. I've been meaning to submit a diff but for the time being,
here my own PETSc portfile that I use:

Notable things that need to be fixed in the MacPorts version:

* don't use both --with-c-support and --with-c++-support
* unnecessary to use --with-python
* don't use --with-pic
* don't use --with-mpi=1
* don't pass ${destroot} to --prefix
* don't pass mpi compiler wrappers to --with-{cc,cxx}; just use
--with-mpi-dir=${prefix} (the correct compilers will be used based on
* don't ever mess with blas/lapack options
* don't pass things to --LIB

If the devs at macports want, they could update metis, parmetis,
blacs, scalapck, mumps, ml, and SuiteSparse to my ports located at
bitbucket; they are the same ones that are used for
--download-{metis,parmetis,blacs,scalapack,mumps,ml,umfpack} and, as a
bonus, are all updated to the latest versions.

More information about the macports-users mailing list