Satish Balay <[email protected]> writes:
There is no [easy] automatic way of figuring out this reduced link command that might work.
Almost all such problems are caused by shared libraries being broken or improperly linked on too many HPC systems. If shared libraries are used correctly, then using PETSc amounts to passing -lpetsc. If you call another library, you also link it directly (even if PETSc also links to it transitively). That's all. Note that almost all HPC machines are based on Linux and that shared libraries have had well-defined fully-functional semantics on Linux for 20+ years, so functionality is not a matter of a new implementation, but rather just not breaking something that works. Facilities and vendors need constant reminders that functional and properly-used shared libraries are important. As for PETSc, I actually attempt a simplified link line (e.g., in FindPETSc.cmake) and only fall back to the unwieldy beast when it fails. (This happens for static libraries, but also when shared libraries are foobared.)