And to have cleaner list - specify the (appropriate) compiler libraries via 
LIBS option

balay@pj01:~/petsc$ mpif90 -show
gfortran -I/software/mpich-4.1.1/include -I/software/mpich-4.1.1/include 
-L/software/mpich-4.1.1/lib -lmpifort -Wl,-rpath -Wl,/software/mpich-4.1.1/lib 
-Wl,--enable-new-dtags -lmpi

balay@pj01:~/petsc$ ./configure --download-fblaslapack --download-hdf5 
--with-hdf5-fortran-bindings --download-metis --download-parmetis COPTFLAGS=-O3 
CXXOPTFLAGS=-O3 FOPTFLAGS=-O3 --with-debugging=0 LIBS="-lmpifort -lmpi 
-lgfortran -lstdc++"

balay@pj01:~/petsc$ grep ^PETSC_EXTERNAL_LIB_BASIC 
arch-linux-c-opt/lib/petsc/conf/petscvariables 
PETSC_EXTERNAL_LIB_BASIC = -Wl,-rpath,/home/balay/petsc/arch-linux-c-opt/lib 
-L/home/balay/petsc/arch-linux-c-opt/lib -lflapack -lfblas -lparmetis -lmetis 
-lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lm -lX11 -lquadmath -lmpifort 
-lmpi -lgfortran -lstdc++


Satish


On Tue, 14 May 2024, Satish Balay via petsc-users wrote:

> You can try using latest petsc version [3.21] - the list should be a bit more 
> cleaner with it.
> 
> balay@pj01:~/petsc$ ./configure --download-mpich --download-fblaslapack 
> --download-hdf5 --with-hdf5-fortran-bindings --download-metis 
> --download-parmetis COPTFLAGS=-O3 CXXOPTFLAGS=-O3 FOPTFLAGS=-O3 
> --with-debugging=0
> 
> balay@pj01:~/petsc$ grep ^PETSC_EXTERNAL_LIB_BASIC 
> arch-linux-c-opt/lib/petsc/conf/petscvariables 
> PETSC_EXTERNAL_LIB_BASIC = -Wl,-rpath,/home/balay/petsc/arch-linux-c-opt/lib 
> -L/home/balay/petsc/arch-linux-c-opt/lib 
> -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/13 
> -L/usr/lib/gcc/x86_64-redhat-linux/13 -lflapack -lfblas -lparmetis -lmetis 
> -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lm -lX11 -lmpifort -lmpi 
> -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath -lstdc++
> 
> Satish
> 
> On Tue, 14 May 2024, Runjian Wu wrote:
> 
> > First clarification, NO issues happened. I am just curious about the
> > duplicated libraries while I compile PFLOTRAN with PETSc.
> > 
> > PETSc version: 3.16.2
> > 
> > Configure Options: --configModules=PETSc.Configure
> > --optionsModule=config.compilerOptions --with-make-np=4 --with-cc=mpicc
> > --with-cxx=mpicxx --with-fc=mpif90 --download-fblaslapack=yes
> > --download-hdf5=/home/wurunjian/petsc_pkg/hdf5-1.12.1.tar.bz2
> > --download-hdf5-fortran-bindings=yes --download-metis=yes
> > --download-parmetis=yes --CFLAGS=-O3 --CXXFLAGS=-O3 --FFLAGS=-O3
> > --with-debugging=0
> > 
> > PETSC_EXTERNAL_LIB_BASIC =
> > -Wl,-rpath,/home/wurunjian/petsc/arch-linux2-c-opt/lib
> > -L/home/wurunjian/petsc/arch-linux2-c-opt/lib
> > -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/11
> > -L/usr/lib/gcc/x86_64-linux-gnu/11 -lflapack -lfblas -lhdf5hl_fortran
> > -lhdf5_fortran -lhdf5_hl -lhdf5 -lparmetis -lmetis -lm -lstdc++ -ldl
> > -lmpichfort -lmpich -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath
> > -lstdc++ -ldl
> > 
> > On Mon, May 13, 2024 at 9:34 PM Satish Balay <ba...@mcs.anl.gov> wrote:
> > 
> > > what version of PETSc? What configure command? What do you have for
> > > PETSC_EXTERNAL_LIB_BASIC?
> > >
> > > You can send configure.log for your build to petsc-maint
> > >
> > > Generally duplicates should not cause grief. [as one needs them to
> > > overcome circular dependencies].
> > >
> > > What issues are you seeing? [send relevant logs]
> > >
> > > If the duplicates are coming form "compiler library" detection part of
> > > configure - you can skip this part by listing the correct "compiler
> > > libraries"
> > >
> > > for ex: with gcc/gfortran:
> > >
> > > LIBS="-lgfortran -lstdc++"
> > >
> > > However -lgfortran could be required for gcc - but a duplicate for
> > > gfortran.
> > >
> > > Satish
> > >
> > > On Mon, 13 May 2024, Runjian Wu wrote:
> > >
> > > > Hi all,
> > > >
> > > > After I compiled PETSc, I found some duplicated libs in the variable
> > > > PETSC_EXTERNAL_LIB_BASIC, e.g., -lm, -lgfortran -lstdc++.  I am curious
> > > how
> > > > it happened and how to remove the duplicates?
> > > >
> > > > Thanks,
> > > >
> > > > Runjian Wu
> > > >
> > >
> > >
> > 
> 

Reply via email to