[CIG-SHORT] a problem in "SPECFEM3D_BASIN_V1.2"

Leif Strand leif at geodynamics.org
Mon Jul 31 11:40:05 PDT 2006

Hi Sufang,

Building SPECFEM3D is slightly tricky. There are two programs: the 
mesher (xmeshfem3D) and the solver (xspecfem3D). In order to build the 
solver, you need "OUTPUT_FILES/values_from_mesher.h". But this header 
file is an output file of the mesher! In other words, you need to do the 

1) Build 'xmeshfem3D'.
2) Run 'xmeshfem3D' with the desired parameters (see "DATA/Par_file"). 
This will produce "OUTPUT_FILES/values_from_mesher.h" as output.
3) Build 'xspecfem3D'.
4) Run 'xspecfem3D'.

There is also a utility program called "xcreate_header_file" which will 
simply generate "OUTPUT_FILES/values_from_mesher.h" from your parameter 
file without doing anything else (it won't create a mesh). This is 
useful if you are running on a cluster where the mesher and the solver 
need to run as a single batch job, and you therefore need to build both 
programs beforehand. So an alternative approach is:

1) Build 'xcreate_header_file'.
2) Run 'xcreate_header_file' with the desired parameters 
("DATA/Par_file"). This will produce "OUTPUT_FILES/values_from_mesher.h" 
as output.
3) Build 'xmeshfem3D' and 'xspecfem3D'.
4) Run 'xmeshfem3D' and 'xspecfem3D'.

I'm not certain what is causing the linker error LNK1136 -- 
unfortunately I don't have Visual Fortran for Windows available to test. 
It is possible that your Fortran compiler couldn't find 
"OUTPUT_FILES/values_from_mesher.h" and produced a corrupt ".obj" file, 
but this seems unlikely.

I do have one theory. Looking at the 'Makefile', note that some of the 
files are compiled with your regular Fortran compiler command, but 
others -- such as specfem3D.f90 -- are compiled with 'mpif90'. So I 
would make sure your settings for the Makefile variables 'F90' and 
'MPIF90' are consistent. In particular, on Windows (as I recall) the GNU 
compilers use a different object file format than the Intel and 
Microsoft compilers, so an incompatibility could arise there. Of course, 
if you aren't using 'Makefile', this doesn't apply to you.

If you continue to have trouble with LNK1136, send me the output of a 
full rebuild, and "specfem3D.obj".

--Leif Strand

Sufang Zhang wrote:

> Dear cig-short,
>    I am lucky to discover your website and have downloaded the 
> software "SPECFEM3D_BASIN_V1.2". When I debugged it in Visual Fortran, 
> there is an error like that "Linking...
> .\Debug\specfem3D.obj : fatal error LNK1136: invalid or corrupt file
> Error executing link.exe."
>  And I have not found any files in the filefold "OUTPUT_FILES".
>    Also, I think the problem may be the following code. 
> ! standard include of the MPI library
>   include 'mpif.h'
> ! include values created by the mesher
>   include "OUTPUT_FILES/values_from_mesher.h"
>  Can you give me some advice to use the softwar?
> Best wishes!
>                                                               Zhang Sufang
>                                                            IGG,CAS  
> Beijing, China
>                                                               July 
> 29,2006 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://geodynamics.org/pipermail/cig-short/attachments/20060731/248cc1f4/attachment.htm

More information about the CIG-SHORT mailing list