As of version 5.1, LHAPDF's libraries are built using the GNU libtool program, and will produce both a static library(libLHAPDF.a) and a "dynamic" shared library with a .so suffix. The "dynamic" shared library is actually compiled as a version-specific library, e.g. lib/libLHAPDF.so.5.1.0, and symbolic links are then used to make it available under less specific names, in particular lib/libLHAPDF.so.
The difference between the static and "dynamic" shared libraries is that the function symbols encoded in the shared library are position independent, meaning that they can be referenced from anywhere and the address will be correct. When you link a program against a static library, the functions in that library are copied into your executable, which is correspondingly larger. Dynamic linking, by contrast, just tells the executable that at run time it should find the symbols in the system's LHAPDF shared library, with the result that the executable is smaller than with static linking. Of course, that means that users of a program that is dynamically linked against LHAPDF need to have a copy of the LHAPDF "dynamic" shared library on their system, but since they need to have the PDF grid files anyway, that isn't such a crazy assumption. We recommend using shared libraries unless you have a good reason not to, since they reduce executable size and allow your programs to pick up bug fixes in libraries without recompilation/relinking being necessary.
A common reason for the "dynamic" shared library failing to be found at run time is not having it in the LD_LIBRARY_PATH environmental variable (DYLD_LIBRARY_PATH on a Mac)
By default, linking your program against LHAPDF using, e.g. gfortran will attempt to use the "dynamic" shared library. If you definitely want to use the static library, pass the-static compiler flag, e.g.
gfortran -o myprog myprog.f -static -lLHAPDF -lstdc++Note that we also have to add explicit linking against the C++ standard library in this case — C++ strings are used to determine the default paths to data files — because static libraries, unlike shared ones, have no mechanism for telling the linker about extra libraries that they depend on.