Hi Jakob,
Thanks for your report and I'm sorry for the difficulties!
Unfortunately, many of the compile suites have been slow to implement and debug the full Fortran 2003 standard... So, we are left with a rather "jagged landscape" of systems on which the KIM API can be confidently used. Anyway, I'll try to provide help and information where I can.
First off. Take a look at the "OS Setup for the KIM API" pages
https://openkim.org/os-setup-for-kim-api/
that have recently become available on the openkim.org site. (In particular for the mac; see also below.)
More below:
Hi again,
I am having real trouble with the Fortran compiled models and model drivers.
On my Mac, I guess it is known not to work. I have a relatively old gfortran that can compile the KIM API itself, but crashes with an “illegal text relocation” when it tries to link a model. I do not dare to upgrade, as rumours say that then I can not even compile the API. I can live with not having these models on my mac, but any workaround would be welcome.
Yeah, the "illegal text relocation" issue is a bug in gfortran. It has been reported to the gfortran team:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59888
The good news is that there has been recent effort to fix this bug, but it has not yet been resolved. The bad news is that the fix will appear in gfortran 4.9.0 (I'm not sure if this will be ported to anything older...)
Fortunately, there is a partial workaround. It requires compiling on the mac in 64bit mode and a set of special compile flags. See the INSTALL file notes and the Makefile.KIM_Config file for the mac at the bottom of this page:
https://openkim.org/os-setup-for-kim-api/mac/
On the department Linux cluster the situation is worse. There, we run Centos Linux 6.6 and have gcc version 4.4.7 20120313. According to the KIM makefile, that is too old a gfortran compiler. Disabling the check, I can again compile the API, but compiling models fail with an "internal compiler error”, so I guess the check was there for a reason
Yes, the Fortran 2003 support in 4.4.X is incomplete and buggy. You might have luck using kim-api-v1.4.X (with cray pointers) and older version of the openkim.org Models if you absolutely need to run on this type of system...
We also have Intel compilers on the cluster, version 13.0.1 20121010. If I set the KIM API to use Intel compilers, then I get a problem linking C++ files with the fortran compiler (is that even expected to work?). It happens already when compiling the API. The error is below.
As you can see, the first error is duplicate definition of main, that is the kind of problem one would expect when the fortran compiler tries to link a program already containing a main function. Is there some way to force the API to link with the C++ compiler (in that case probably some Fortran libraries need to be passed to the linker, I can probably find them if need be)?
*******************************************************************************
** Building... src/utils **
*******************************************************************************
make --no-print-directory -C /home/niflheim/schiotz/development/kim-api/src/utils all
Creating... descriptor-file-match.o.
icpc -fPIC -I/home/niflheim/schiotz/development/kim-api/src -D KIM_ARCHTYPE=1 -D KIM_LINK_VALUE=2 -c -O3 -g -Wall -ansi -pedantic descriptor-file-match.cpp
Creating... kim-api-v1-descriptor-file-match.
ifort -o kim-api-v1-descriptor-file-match descriptor-file-match.o ../libkim-api-v1.6.3+INTEL.linux.64bit.dynamic-load.so
descriptor-file-match.o: In function `main':
/home/niflheim/schiotz/development/kim-api-v1.6.3/src/utils/descriptor-file-match.cpp:40: multiple definition of `main'
/home/opt/common/intel-compilers-2013.1.117/compiler/lib/intel64/for_main.o:/export/users/nbtester/efi2linux_nightly/branch-13_0/20121011_000000/libdev/frtl/src/libfor/for_main.c:(.text+0x0): first defined here
/home/opt/common/intel-compilers-2013.1.117/compiler/lib/intel64/for_main.o: In function `main':
/export/users/nbtester/efi2linux_nightly/branch-13_0/20121011_000000/libdev/frtl/src/libfor/for_main.c:(.text+0x38): undefined reference to `MAIN__'
make[1]: *** [kim-api-v1-descriptor-file-match] Error 1
make: *** [utils-all] Error 2
You've discovered a build system bug that is know and fixed, but not yet released. The attached patch file should show you how to correct this bug until it is officially released....
Cheers,
Ryan
intel-patch-for-kim-api-v1.6.3.patch (1.73 KB)