Compiling on RedHat 6

Is there a known issue with compiling OpenKIM 1.2.2 on RedHat 6 and similar distributions? Specifically, if I run ‘make examples’ (which seems to work), then ‘make’, make segfaults. Interestingly, if I run ‘make’ without having run ‘make examples’, make does not segfault. I’ve tried GCC 4.4 and 4.7.3 with similar results. I’ve also tried on a freshly-installed CentOS 6.4 system to no avail.

Output:

make examples
Makefile:42: Makefile.ModelsList: No such file or directory
Makefile:42: Makefile.ModelDriversList: No such file or directory
Makefile:42: Makefile.TestsList: No such file or directory
Creating… Makefile.TestsList.
Creating… Makefile.ModelDriversList.
Creating… Makefile.ModelsList.
Creating… KIM_Config file… KIM_API/Makefile.KIM_Config.
Creating… KIM_Config file… MODEL_DRIVERS/Makefile.KIM_Config.
Creating… KIM_Config file… MODELS/Makefile.KIM_Config.
Creating… KIM_Config file… TESTS/Makefile.KIM_Config.

  • installing… ex_model_driver_P_LJ … copied to /software/OpenKIM/openkim-api-v1.2.2/MODEL_DRIVERS
  • installing… ex_model_driver_P_Morse … copied to /software/OpenKIM/openkim-api-v1.2.2/MODEL_DRIVERS
  • installing… EXAMPLES.README … copied to /software/OpenKIM/openkim-api-v1.2.2/MODEL_DRIVERS
  • installing… ex_model_Al_PF_ErcolessiAdams … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_LJ … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_C … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_CLUSTER_C … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_CLUSTER_F90 … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_F90 … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_MI_OPBC_H_F … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_NEIGH_PURE_H_F … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_MLJ_NEIGH_RVEC_F … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ar_P_Morse … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_ArNe_P_MLJ_NEIGH_RVEC_F … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Cu_PF_Johnson … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ne_P_fastLJ … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ne_P_LJ … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ne_P_LJ_NEIGH_PURE_H … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ne_P_MLJ_NEIGH_RVEC_H … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_model_Ne_P_Morse … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… EXAMPLES.README … copied to /software/OpenKIM/openkim-api-v1.2.2/MODELS
  • installing… ex_test_Al_FCCcohesive_MI_OPBC … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Al_free_cluster … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_FCCcohesive_MI_OPBC … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_FCCcohesive_NEIGH_PURE … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_FCCcohesive_NEIGH_RVEC … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_FCCcohesiveCutoff_NEIGH_RVEC … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_free_cluster … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_free_cluster_CLUSTER_C … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_free_cluster_CLUSTER_F90 … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_free_cluster_CLUSTER_memory_F90 … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ar_multiple_models … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_ArNe_B2cohesive_NEIGH_RVEC … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Cu_free_cluster … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ne_free_cluster … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ne_free_cluster_SI … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… ex_test_Ne_free_cluster_stiff … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… EXAMPLES.README … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… run_all_ex_tests … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… run_forces_numer_deriv_for_all_models … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… vc_config_ener_forces … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… vc_forces_delta … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS
  • installing… vc_forces_numer_deriv … copied to /software/OpenKIM/openkim-api-v1.2.2/TESTS

make
Creating… Makefile.TestsList.
Creating… Makefile.ModelDriversList.
Creating… Makefile.ModelsList.
*** glibc detected *** make: malloc(): memory corruption (fast): 0x000000000063dbd0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x76126)[0x7ffff7ac0126]
/lib64/libc.so.6(+0x79edf)[0x7ffff7ac3edf]
/lib64/libc.so.6(__libc_malloc+0x71)[0x7ffff7ac4951]
make[0x4120f8]
make[0x412229]
make[0x4136fe]
make[0x406997]
make[0x407324]
make[0x40761e]
make[0x410e79]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7ffff7a68cdd]
make[0x402429]
======= Memory map: ========
00400000-00428000 r-xp 00000000 08:02 419590 /usr/bin/make
00628000-0062a000 rw-p 00028000 08:02 419590 /usr/bin/make
0062a000-0066c000 rw-p 00000000 00:00 0 [heap]
7ffff19a4000-7ffff19b9000 r-xp 00000000 00:13 926648659 /panfs/pas14/apps/LINUX/gcc/4.7.3/lib64/libgcc_s.so.1
7ffff19b9000-7ffff1bb8000 —p 00015000 00:13 926648659 /panfs/pas14/apps/LINUX/gcc/4.7.3/lib64/libgcc_s.so.1
7ffff1bb8000-7ffff1bb9000 rw-p 00014000 00:13 926648659 /panfs/pas14/apps/LINUX/gcc/4.7.3/lib64/libgcc_s.so.1
7ffff1bb9000-7ffff7a4a000 r–p 00000000 08:02 405945 /usr/lib/locale/locale-archive
7ffff7a4a000-7ffff7bd4000 r-xp 00000000 08:02 133667 /lib64/libc-2.12.so
7ffff7bd4000-7ffff7dd3000 —p 0018a000 08:02 133667 /lib64/libc-2.12.so
7ffff7dd3000-7ffff7dd7000 r–p 00189000 08:02 133667 /lib64/libc-2.12.so
7ffff7dd7000-7ffff7dd8000 rw-p 0018d000 08:02 133667 /lib64/libc-2.12.so
7ffff7dd8000-7ffff7ddd000 rw-p 00000000 00:00 0
7ffff7ddd000-7ffff7dfd000 r-xp 00000000 08:02 133663 /lib64/ld-2.12.so
7ffff7fe1000-7ffff7fe4000 rw-p 00000000 00:00 0
7ffff7ff9000-7ffff7ffb000 rw-p 00000000 00:00 0
7ffff7ffb000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso]
7ffff7ffc000-7ffff7ffd000 r–p 0001f000 08:02 133663 /lib64/ld-2.12.so
7ffff7ffd000-7ffff7ffe000 rw-p 00020000 08:02 133663 /lib64/ld-2.12.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0
7ffffffea000-7ffffffff000 rw-p 00000000 00:00 0 [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)

Hi Gabe,

Thanks for your question.

I believe I've seen this previously. If memory serves me right, it is a problem with an older version of gnu make. The segfault you are seeing is definitely make crashing.

The openkim-api package requires version 3.81 or newer of gnu make.
I'm guessing you have an older version and upgrading to 3.81 or 3.82 (the latest version) of gnu make will fix the problem.

Either way, let us know.

Cheers,

Ryan Elliott

RedHat’s make is 3.81. Interestingly, Debian 7 and SLES11 SP1 also have make 3.81 and OpenKIM seems to build on those distributions. I’ll build make 3.82 and see if that solves the problem.

Ryan:

GNU make 3.82 gets me closer to success (I suspect that RedHat’s make 3.81 may not be entirely 3.81). ‘make examples’ completes, and make errors out some time in with this error:

/usr/lib/gcc/x86_64-redhat-linux/4.4.7/…/…/…/…/lib64/crt1.o: In function _start': (.text+0x20): undefined reference to main’
collect2: ld returned 1 exit status
make[1]: *** [ex_test_Al_FCCcohesive_MI_OPBC] Error 1
make: *** [ex_test_Al_FCCcohesive_MI_OPBC-all] Error 2

I’m not sure if this is an issue with OpenKIM or something else. Is a minimum version of gcc and/or glibc necessary?

Thanks,

Gabe

More context:

Hi Gabe,

I'm glad to see you are sticking with it and making some progress. Sorry for the inconvenience.

First, it seems that you managed to fix the problem with make. Good.

Now, it appears that you have run into one of the other few special cases I know of for compiling openkim-api...

GCC 4.4 (which I see from the above you are using) is a bit of an odd duck as the Gnu Compiler Collection goes in respect to gfortran. This version of GCC puts the "main" routine stub (used for fortran programs) in a separate library (libgfortranstart). This is only true for GCC 4.4 (as far as I know). So, some special consideration need to be taken...

There is a note in the INSTALL file (step 1(h)) on this, but it is easy to miss....

In your Makefile.KIM_Config, you should add a line in the "overwrite compile option flags list" section like the following:

LDFLAGS = -lgfortran -lgfortranstart

Try that and let us know if it works!

Cheers,

Ryan

I'm glad to see you are sticking with it and making some progress. Sorry
for the inconvenience.

First, it seems that you managed to fix the problem with make. Good.

Now, it appears that you have run into one of the other few special cases
I know of for compiling openkim-api...

GCC 4.4 (which I see from the above you are using) is a bit of an odd duck
as the Gnu Compiler Collection goes in respect to gfortran. This version
of GCC puts the "main" routine stub (used for fortran programs) in a
separate library (libgfortranstart). This is only true for GCC 4.4 (as far
as I know). So, some special consideration need to be taken...

There is a note in the INSTALL file (step 1(h)) on this, but it is easy to
miss....

In your Makefile.KIM_Config, you should add a line in the "overwrite
compile option flags list" section like the following:

LDFLAGS = -lgfortran -lgfortranstart

Try that and let us know if it works!

Ryan:

Thanks for the information. What I ended up doing in the end is simply
using GCC 4.7.3, which I already had built for the system.

Appreciate all of the help!

Gabe

Hi Gabe,

Glad to hear you got it working! I'm always happy to help.

Cheers,

Ryan