[petsc-dev] [petsc-users] automatic determination of which libraries petsc wants
Barry Smith
bsmith at mcs.anl.gov
Thu Jan 31 20:15:09 CST 2013
Thanks. I pushed this change.
Barry
On Jan 31, 2013, at 8:06 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
> On Thu, Jan 31, 2013 at 8:00 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> Jed, I made this change but it makes everything useless because
> pkg-config PETSc --libs
> -L/Users/barrysmith/Src/petsc-dev/arch-opt/lib -lpetsc
>
> how are people suppose to know what libraries to link against? Note that
>
> pkg-config PETSc --variable=Libs.private
> returns nothing so how the hey does one get this information?
>
> Add --static to the args.
>
> $ pkg-config --libs cairo
> -lcairo
> $ pkg-config --static --libs cairo
> -lcairo -lz -lgobject-2.0 -lffi -lglib-2.0 -pthread -lrt -lpcre -lpixman-1 -lfontconfig -lexpat -lfreetype -lz -lbz2 -lpng15 -lm -lz -lm -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp
>
>
> This is intentional. It allows rebuilding PETSc (e.g., adding new --download args) without needing to relink all the layers above PETSc. Libraries and applications that call PETSc and link only with -lpetsc should not acquire direct dependencies on everything that PETSc depends on. (Static libraries just don't have a way to manage transitive dependencies, so it all bubbles up to the top level, but you always have to relink everything there anyway, so there's no binary stability to gain.)
More information about the petsc-dev
mailing list