SPECFEM / specfem3d

SPECFEM3D_Cartesian simulates acoustic (fluid), elastic (solid), coupled acoustic/elastic, poroelastic or seismic wave propagation in any type of conforming mesh of hexahedra (structured or not).
GNU General Public License v3.0
398 stars 225 forks source link

Issue compiling with gfortran 4.9.0 on Mac OS 10.9.4 #196

Closed nicofournier closed 10 years ago

nicofournier commented 10 years ago

Compilation works fine with gfortran 4.8.2 but exits with the following error when using 4.9.0:

gfortran  -std=f2003 -fimplicit-none -frange-check -O2 -DFORCE_VECTORIZATION -fmax-errors=10 -pedantic -pedantic-errors -Waliasing -Wampersand -Wcharacter-truncation -Wline-truncation -Wsurprising -Wno-tabs -Wunderflow -ffpe-trap=invalid,zero,overflow -I../shared/  -c -o ../../obj/mesh/meshfem3D.o meshfem3D.f90
meshfem3D.f90:33.6:

  use createRegMesh
      1
Fatal Error: Cannot read module file 'createregmesh.mod' opened at (1), because it was created by a different version of GNU Fortran
make[1]: *** [../../obj/mesh/meshfem3D.o] Error 1
make: *** [xmeshfem3D] Error 2

my (basic) install script below for info if needed.

#!/bin/bash
# INSTALL_SPECFEM3D.SH
#
# Nico Fournier, GNS Science, Taupo, New Zealand
# email: n.fournier@gns.cri.nz
# July 2014

########################################
# Get latest version from GIT (comment if not needed)
########################################
# assumption: specfem3d is installed in user's home directory, under specfem3d. Adjust script if not the case.

cd ~
# make backup of previous installation if it exist
if [ -d specfem3d ]; then tar -cf specfem3d_`date +"%Y%m%dbkp.tar"` specfem3d ; gzip specfem3d_`date +"%Y%m%dbkp.tar"` ; rm -Rf specfem3d ; fi

# clone repository from GIT
git clone --recursive https://github.com/geodynamics/specfem3d.git

########################################
# compile specfem3d and dependencies
########################################
cd specfem3d
chmod a+x configure
# configure
./configure CC=gcc FC=gfortran MPIFC=mpif90

#------------------------------
# SCOTCH
#------------------------------
# adjust Makefile
cd src/decompose_mesh/scotch/src
cp Make.inc/Makefile.inc.i686_mac_darwin10.icc Makefile.inc.old

sed s/icc/gcc/g <Makefile.inc.old> Makefile.inc.old2
sed s/-restrict//g <Makefile.inc.old2> Makefile.inc
rm Makefile.inc.old*

# replace clock_gettime command by clock_get_time in common.c
cd libscotch
mv common.c common.c.old
sed s/clock_gettime/clock_get_time/g <common.c.old> common.c
rm common.c.old

#------------------------------
# Compile SPECFEM3D
#------------------------------
cd ~/specfem3d
make

##### END #####
QuLogic commented 10 years ago

Fatal Error: Cannot read module file 'createregmesh.mod' opened at (1), because it was created by a different version of GNU Fortran

Sounds like you didn't run make clean after building with 4.8.2.

QuLogic commented 10 years ago

Also, are those patches really necessary? Please open a new issue for them if you are certain they are needed.

nicofournier commented 10 years ago

Well, except that I didn't have 4.5.8 installed when I built it first (clean OS install and fresh 4.9.0). So I am a bit confused. Will try it though. Good points re- the patches. SCOTCH is based on the User Manual recommendation. -restrict as a flag also did not work, hence the patches. Will do some more testing and open a new issue if needed

komatits commented 10 years ago

Probably a local install problem, since no problem is detected by BuildBot.