[petsc-users] Can't initialize petsc from within application code

Klaus Burkart k_burkart at yahoo.com
Tue Nov 20 06:12:08 CST 2018


Hello,

I am trying to initialize petsc from within application code but I keep getting the following error.

symbol lookup error: /home/klaus/OpenFOAM/klaus-5.0/platforms/linux64GccDPInt32Opt/lib/libmyPCG2.so: undefined symbol: PetscInitialize

The code is just:

    PetscInitialize(0,0,PETSC_NULL,PETSC_NULL);
    //PetscPrintf(PETSC_COMM_WORLD,"Hello World\n");
    PetscFinalize();

includes are:

#include <petsc.h>
#include <petscksp.h>

There are no compile errors.

.bashrc petsc related content is:
export PETSC_DIR=/home/klaus/OpenFOAM/ThirdParty-5.0/petsc-3.9.3
export PETSC_ARCH=/arch-linux2-c-debug
export PETSC_LIBDIR=$PETSC_DIR/arch-linux2-c-debug/lib


I am also linking:
    -I$(PETSC_DIR)/include \
    -I$(PETSC_DIR)/arch-linux2-c-debug/include
and
    -L$(PETSC_LIBDIR) -lpetsc

I assume something else needs to be linked but can't work out what's missing.

Any idea?


Klaus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181120/2414c61f/attachment.html>


More information about the petsc-users mailing list