[petsc-users] problem linking to petsc

Arun Persaud apersaud at lbl.gov
Fri Aug 5 14:55:28 CDT 2022


Hello

I'm trying to compile a plasma simulation package (in fortran + mpi) 
that uses PETSC and HYPRE.

I'm running on linux (opensuse tumbleweed) and using the distribution 
provided compilers and openmpi4 packages.

I git cloned petsc and then compiled with the following commands


./configure --prefix=/home/arun 
--with-mpi-dir=/usr/lib64/mpi/gcc/openmpi4 
--with-hypre-lib="-L/usr/lib64/mpi/gcc/openmpi4/lib64 -lHYPRE" 
--with-hypre-include=/usr/lib64/mpi/gcc/openmpi4/include/hypre/ 
--download-fblaslapack

make PETSC_DIR=/home/arun/src/petsc PETSC_ARCH=arch-linux-c-debug all

make PETSC_DIR=/home/arun/src/petsc PETSC_ARCH=arch-linux-c-debug install

And this worked without errors, but when I try to use the petsc library 
to compile and link the simulation package, I'm getting:

pic2d_CurProblemValues.f90:(.text+0x11e5d): undefined reference to 
`petscinitialize_'
collect2: error: ld returned 1 exit status
make: *** [Makefile:50: edipic2d] Error 1


pic2d_CurProblemValues.f90 seems to have the same code included that is 
given in the howto on how to use PETSC.

also, if I check the shared library, I get the following:

arun at apersaud:~/src/petsc> nm arch-linux-c-debug/lib/libpetsc.so |grep 
-i petscinit
00000000003531e6 t PetscInitFortran_Private
000000000032e9ac T PetscInitialize
0000000002bc82e8 B PetscInitializeCalled
000000000032c22d t PetscInitialize_Common
0000000000354ac3 T petscinitialized_
0000000000327d71 T PetscInitialized
00000000001213e5 t PetscInitialize_DynamicLibraries
000000000035389d T petscinitializef_
0000000000353e38 T petscinitializefortran_
0000000000353cd2 T PetscInitializeFortran
00000000003279a8 T PetscInitializeNoArguments
0000000000327138 T PetscInitializeNoPointers
00000000000fd2ce T __petscsys_MOD_petscinitializenoarguments
00000000000fd313 T __petscsys_MOD_petscinitializenohelp
00000000000fd3e9 T __petscsys_MOD_petscinitializewithhelp

which seems to indicate that the initialize function "petscinitialize_" 
is missing.

Is there a compiler flag I need to set to or a configure flag when 
compiling petsc?

Not sure where things are going wrong here and how to debug this.

Any suggestions would be appreciated.

Thanks

Arun



More information about the petsc-users mailing list