Skip to content

Could not load "petscFoam" with undefined symbol

Hello, I built openfoam along with petsc on two machines. One was successful but the other failed with undefined symbol.

This is the failed one:

$ foamHasLibrary -verbose petscFoam
Could not load "petscFoam"
/home/jczhang/OpenFOAM/jczhang-v2406/platforms/linux64IcxDPInt32Opt/lib/libpetscFoam.so: undefined symbol: _ZN4Foam14PstreamGlobals17MPICommunicators_E
$ nm /home/jczhang/OpenFOAM/jczhang-v2406/platforms/linux64IcxDPInt32Opt/lib/libpetscFoam.so |grep PstreamGlobals
                 U _ZN4Foam14PstreamGlobals17MPICommunicators_E

You can see the undefined symbol. However, on the succeeded one, I can also find the undefined symbol. Then what made the difference? Could someone shed light on that?

$  foamHasLibrary -verbose petscFoam
Can load "petscFoam"
$ nm /home/jczhang/OpenFOAM/jczhang-v2406/platforms/linux64GccDPInt32Opt/lib/libpetscFoam.so |grep PstreamGlobals
                 U _ZN4Foam14PstreamGlobals17MPICommunicators_E