[petsc-dev] Configure LD flags

Smith, Barry F. bsmith at mcs.anl.gov
Sun Sep 15 13:58:54 CDT 2019



> On Sep 15, 2019, at 4:11 AM, Stefano Zampini via petsc-dev <petsc-dev at mcs.anl.gov> wrote:
> 
> I don't understand the separation of concerns for the configure variables LDFLAGS LIBS

  Nor do the rest of us. They probably need even more specialization.

> 
> Also, are LDFLAGS for the shared linker only, or for creating the final executable
> How one can specify flags for the shared linker that are not used for creating the dynamic executable (and viceversa)?

  I think we've survived with common LDFLAGS LIBS for all these years (survived, but maybe not thrived) 

  We might need/want to have two sets. LDFLAGS/LIBS_EXECUTABLE and LDFLAGS/LIBS_LIBRARY (better names?)


> 
> This is because, with Cray wrappers, we need to pass LDFLAGS=-dynamic at configure time.
> Then, when configuring HYPRE, LDFLAGS are passed and used for the shared linker, resulting in an error when creating libHYPRE.so
> 
> cc -shared -o libHYPRE.so ...a bunch of .o files.... ...libraries.... -dynamic
> 
> The -dynamic at the end makes cc think it is creating an executable,  and fail for missing main.\

   Here I think the short time fix is to filter the LDFLAGS before passing to the hypre package (we do lots of this filtering already for packages, but probably not as consistently as we should, it is ad hoc based on what works). If hypre simultaneously needs LDFLAGS to both contain -dynamic and not then that is either a bug in hypre's configure or we are not digging deeply into the hypre configure arguments to set the correct specialized ones.


> 
> -- 
> Stefano



More information about the petsc-dev mailing list