Gcc and fort on an El Capitan Mac

Are there any special options I should be invoking in setup for the combination of gcc and ifort on a Mac? With the same setup on my linux box:
setup --cc gcc --cxx g++ --fc ifort --chemps2 off --pcmsolver off --max-am-eri 8

everything seems to go fine until the very end where the make dies with:

[100%] Linking CXX executable …/…/…/bin/psi4
Undefined symbols for architecture x86_64:
MAIN_”, referenced from:
_main in libifcore.a(for_main.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
src/bin/psi4/CMakeFiles/psi4.dir/build.make:183: recipe for target ‘bin/psi4’ failed

This library is one of 7 that appear in build.make for ifort (needed for dkh)


I don’t know about the reliability of mixing Intel and Gnu compilers like that. Maybe try gfortran. Are you planning to use dkh? If not, psi will build just fine w/o a fortran compiler.

If compilations are giving you trouble, you may want to dial --max-am-eri down to 4, until the build process is sorted, then redo with higher AM. We build with 6 for a production executable, so if you need 8 for your work, I’m not surprised your builds are painfully slow.

This combination works fine for Molpro, Dirac, and CFour (on my Mac as well as our Linux cluster) so in principle it should be fine. I’d like to use DKH at some point, so I need a fortran compiler. I suppose I could use gfortran but it’s not nearly as efficient as ifort (although if it’s just for DK integrals it’s probably not a big deal).

Yes, the dkh is only one file, so efficiency considerations are minimal.

A lot of the complication in Intel link libraries comes about when mixing languages. In Psi4, C++ is the primary declared language, then if Fortran is used, the build must add extra libraries. Molpro and CFour are Fortran only, I believe. Dirac is mixed C++/Fortran, but either their primary is Fortran or they have their CMake files set up better than ours.

I’ve made a ticket (https://github.com/psi4/psi4/issues/297) to try out these mixed-vendor compilations, though it probably won’t be addressed soon. I think gfortran for dkh for now.

(Link is mostly for my benefit to keep it associated with this topic.)

@loriab DIRAC uses Fortran as linker language and gives libstdc++ to the linker via a target_link_libraries command.
Adding CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES to the libraries to link Psi4 against might help.
I do not have the Intel compilers suite for Mac OS X available, so I cannot try this out myself.

Thanks Lori, I’ll try gfortran on my Mac. Btw, Molpro actually has a far amount of C++ in it now, but as you note it is still fortran-dominate and uses fortran as the linker language. So I generally use ifort or pgf90 with gcc/g++ since I never feel like paying extra for the Intel c compiler suite.