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

Stefano Zampini stefano.zampini at gmail.com
Tue Nov 20 06:20:09 CST 2018


Depending on your preferences, you may want to use rpath
https://en.wikipedia.org/wiki/Rpath to link libpetsc.so, or add the
location of the PETSc libraries (i.e. where the make variable PETSC_LIBDIR
points to) to LD_LIBRARY_FLAG. I would suggest the first

Il giorno mar 20 nov 2018 alle ore 15:12 Klaus Burkart via petsc-users <
petsc-users at mcs.anl.gov> ha scritto:

> 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
>


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


More information about the petsc-users mailing list