openkim-api-v1.4.0 on Mac

64 views
Skip to first unread message

Ron Miller

unread,
Mar 6, 2014, 6:16:06 AM3/6/14
to ope...@googlegroups.com
Hi,

I just tried to put openkim-api-v1.4.0 onto my macbook pro and it failed to compile.  Here is the offending part of the result:

*******************************************************************************
** Making... Model Driver... ex_model_driver_P_LJ                            **
*******************************************************************************
Creating... ex_model_driver_P_LJ.o.
ex_model_driver_P_LJ.F03: In function 'compute_energy_forces':
ex_model_driver_P_LJ.F03:354:0: warning: 'enepot.dim[0].ubound' may be used uninitialized in this function [-Wmaybe-uninitialized]
 if (comp_enepot.eq.1) enepot = 0.0_cd
 ^
ex_model_driver_P_LJ.F03:248:0: note: 'enepot.dim[0].ubound' was declared here
 real(c_double), pointer :: enepot(:);         type(c_ptr) :: penepot
 ^
ex_model_driver_P_LJ.F03:356:0: warning: 'force.dim[1].ubound' may be used uninitialized in this function [-Wmaybe-uninitialized]
 if (comp_force.eq.1)  force  = 0.0_cd
 ^
ex_model_driver_P_LJ.F03:247:0: note: 'force.dim[1].ubound' was declared here
 real(c_double), pointer :: force(:,:);        type(c_ptr) :: pforce
 ^
ex_model_driver_P_LJ.F03:508:0: warning: 'energy' may be used uninitialized in this function [-Wmaybe-uninitialized]
                energy = energy + 0.5_cd*phi       !      add half v to total energy
 ^
ex_model_driver_P_LJ.F03:245:0: note: 'energy' was declared here
 real(c_double), pointer :: energy;            type(c_ptr) :: penergy
 ^
Creating... intermediate file... ex_model_driver_P_LJ_init_wrapper.cpp.
Creating... ex_model_driver_P_LJ_init_wrapper.o.
Creating... ex_model_driver_P_LJ.a.
Creating... ex_model_driver_P_LJ.so.
ld: illegal text-relocation to _reinit in ex_model_driver_P_LJ.a(ex_model_driver_P_LJ.o) from anon in ex_model_driver_P_LJ.a(ex_model_driver_P_LJ.o) for architecture x86_64
collect2: error: ld returned 1 exit status
/Users/rmiller/work/openkim-api-v1.4.0/MAKE_SYSTEM/Makefile.Generic:172: recipe for target 'ex_model_driver_P_LJ.so' failed
make[1]: *** [ex_model_driver_P_LJ.so] Error 1
rm ex_model_driver_P_LJ_init_wrapper.cpp
Makefile:227: recipe for target 'ex_model_driver_P_LJ-all' failed
make: *** [ex_model_driver_P_LJ-all] Error 2

Ryan S. Elliott

unread,
Mar 6, 2014, 9:59:00 AM3/6/14
to ope...@googlegroups.com
Hi Ron, Yes. Sorry about that. I should have documented this issue
before the release of 1.4.0... Anyway, here is the workaround.


As of 2014-01-20, gfortran on Darwin OS (Mac OSX) has a bug
associated with the use of iso_c_binding Fortran/C
interoperability features which are now standard in openkim-api.
(See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59888) We have
reported this bug and are awaiting its fix. In the meantime,
the following workaround has been identified:

(i) You must have a "multi-library" version of gfortran
installed on your mac due the need (see (ii) below) to
compile for a 32bit architecture. This means that GCC must
have been configured with the "--enable-multilib" flag. To check
your version execute `gfortran -v' and look for the string
"--enable-multilib". In order to install a multilib version
of gfortran on your mac you can use a package manager such
as Homebrew, Mac Ports, or fink. Follow the instructions
for installing the package manager of your choice. Then
execute the command to install gfortran.

For Homebrew the command is:
% brew install gfortran --enable-multilib

For Mac Ports the command is:
% sudo port select --set gcc mp-gcc48
(Note, this may require that you compile the package from source
in order to get the correct version.)

(ii) You must compile the openkim-api and associated Models,
Tests, etc. using the `KIM_SYSTEMARCH = 32bit' setting.

(iii) Item (ii) above, may mean that you will need to tell your
compilers to use 32bit mode (for example):
`CC = gcc -m32'
`CXX = g++ -m32'
`FC = gfortran -m32'

(iv) You need to have the following line in the
Makefile.KIM_Config file in order to avoid harmless
compiler warnings:
`LDFLAGS += -read_only_relocs suppress'



That should do it.... Let's hope the gfortran team gets around to fixing
this bug quickly.

Cheers,

Ryan
Reply all
Reply to author
Forward
0 new messages