undefined 'pghpf_local_mode_' symbol

I have inherited the task of porting a rather large software package from a 32-bit machine to a (64-bit) quad Opteron. This package consists of several shared object modules (mixes of C, C++ and FORTRAN) that are loaded as needed by a Java-based user inteface/control panel.

Curiously, the linking of the code that generates the shared object completes without an error, but when Java attempts to load the same module, an undefined symbol reference to 'pghpf_local_mode_" shuts everything down.

Here’s the linking for one of the shared objects :

  • pgCC -O -shared -fPIC PotentDLL.o psmain.o psscg.o initim.o /sam/gorgon_pgi/lib/Potent.a /sam/gorgon_pgi/lib/cadlib.a /sam/gorgon_pgi/lib/dynalib.a /sam/gorgon_pgi/lib/dblib.a /sam/gorgon_pgi/lib/s3utils.a /sam/gorgon_pgi/lib/wintounix.a
    -L/usr/local/pgi/linux86-64/5.2/libso -lpghpf -lpghpf_rpm -lpghpf2 -lpgftnrtl -lpgf90 -lm -lpgc -lgcc -lc -lgcc -o /sam/gorgon_pgi/bin/libPotentDLL.so

Here’s an attempt by Java to load this same shared object :

  • loading PotentDLL…
    Exception in thread “main” java.lang.UnsatisfiedLinkError: /sam/gorgon_pgi/bin/libPotentDLL.so: /usr/local/pgi/linux86-64/5.2/libso/libpghpf.so: undefined symbol: pghpf_local_mode_
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:834)
    at LoadLib.main(LoadLib.java:4)

I still can’t find where this ‘pghpf_local_mode_’ symbol is defined, after searching all the various PGI libraries. Any ideas here?

The PsychOgre

Hi PsychOgre,

“pghpf_local_mode_” is a global symbol that is inserted into a object compiled using pghpf. Where any of your objects compiled with pghpf? If not, you should remove “-lpghpf -lpghpf_rpm -lpghpf2”.


Thanks for the clarification where the ‘pghpf_local_mode_’ comes from.
After a review of the numerous makefiles, I see that none of the code was compiled with ‘pghpf’. When the ‘-lpghpf*’ libraries are removed from the link statement, the undefined symbol goes away. Yipee!
I hadn’t run into this undefined symbol error when running the same code on a 32-bit machine. I guess the only other difference was the 32-bit machine had PGI v5.1, versus the Opteron has PGI v5.2.

Thanks for your help!