LHAPDF is hosted by Hepforge, IPPP Durham

Problems Compiling on Mac OS X (particularily v10.6)

We are getting numerous reports of problems compiling LHAPDF under v10.6 of MacOs. Usually the error look something like:

version.cc:18: error: variable or field 'FC_FUNC' declared void
version.cc:18: error: 'getlhapdfversion' was not declared in this scope
version.cc:18: error: 'GETLHAPDFVERSION' was not declared in this scope
version.cc:27: error: expected '}' at end of input
make[1]: *** [version.lo] Error 1
make: *** [all-recursive] Error 1
Unfortunately, the problem (in all cases we are aware of) is an inconsistent set of compilers and development tools on Mac platforms, particularly OS X 10.6. The solution, not entirely well-defined, is to make sure that when you install a third-party Fortran compiler, that it is installed consistently.

You can get the gfortran compiler for Macs either from Fink or the HPC system but neither case integrates cleanly with the system compilers and libraries without a bit of extra work. In the first case you need to be sure that the Fink /sw paths are being used in all cases for compiler, linker, stdc++ library, etc.; in the latter you need to use the complete HPC compiler set, not just the gfortran package, since again there is a system library version mismatch. Why precisely this shows up as a failure to use the FC_FUNC build macro rather than something more obvious is a mystery to us!

You can force the configure to use only the gcc44 installed by Fink

./configure --prefix=/your/install/directory --enable-low-memory  CC=/sw/bin/gcc-4 CXX=/sw/bin/g++-4 FC=/sw/bin/gfortran

Or if you want to use the one installed by HPC in /usr/local/bin them:

./configure --prefix=/your/install/directrory --enable-low-memory CC=/usr/bin/gcc CXX=/usr/bin/g++ FC=/usr/local/bin/gfortran

Another solution, supplied by Nathaniel Tagg, seems to be to upgrade the gfortran version to one that is compatible with Xcode 4.0. Such a compiler is currently (16 Aug 2011) available at the first link from this page. This gets around the compilation errors, and apparently seems to install correctly. Good luck!

We hope that this helps, and are sorry we couldn't provide a more specific recipe: If we get more details we will post them here.