Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wave Watch 3 Model compilation error 1

Status
Not open for further replies.

posties

Programmer
Dec 2, 2009
10
AU
Hi Guys and Gals,

I have a bit of a problem.

I've unpacked the ww3 3.14 model onto a linux machine and compiled the test case and thats all fine and working.

Then i tried the next step which is compling one of the modules WW3_Grid and I got this error message...


Processing ww3_grid
---------------------
ad3 : processing ww3_grid
*** compile error ***
file w3gdatmd.o not found
mv: cannot stat `w3gdatmd.o': No such file or directory
make: *** [/home/ww3/obj/w3gdatmod.o] Error 5


**********************
*** end of compilation ***
**********************




I go check to the scratch folder and there is a log in the file 'w3gdatmd.l' saying....



In file w3gdatmd.f90:633

USE W3SERVMD, ONLY:EXTCDE
1
Fatal Error: Can't open module 'w3servmd.mod' for reading at (1): No such file or directory..



So then I checked out the objects folder and there is a file in there named 'w3servmd.o' and its a binary so I can't see whats going on..

Can someone help ASAP as I've spent nearly a day trying to figure out what's going on. Is it just a simple thing I'm missing??

Cheers and thanks in advance, Craig
 
Looks like the build order. Basically what is happening is

File a.f90 has use b
File b.f90 is built after a.f90 so b.mod does not exist when a.f90 needs it

Simple fix is to build b.f90 before a.f90
 
Thanks xwb, but I just tried to compile w3servmd.ftn by itself but this error comes up..

usr/bin/ld:w3servmd.ftn: file format not recognised; treating as linker script
usr/bin/ld:w3servmd.ftn:1: syntax error
collect2: ld returned 1 exit status

So that didn't help :?
 
The .ftn files have to be compiled using gfortran, g77 or g95. ld is the linker. You need to compile them before you link them.
 
Thanks XWB, but i've already tried to compile 'w3gdatmd.ftn' and I get the samer error as I did when i tried to compile 'w3servmd.ftn;.

:? Maybe there is a problem with the compiler call?

Here is what I have for the compiler ponter....

gfortran -c $name.$fext >$name.out 2>$name.err
OK="$?"

Cheers, Craig
 
I think basically what you want is
Code:
gfortran -c w3servmd.ftn   <-- this should generate w3servmd.mod
gfortran -c w3gdatmd.f90
ld ...
 
The thing is is that 'w3servmd.mod' has been generated and is sitting in the 'mod' folder but for some reason the program gets stuck.

I just tried those commands above and it comes up with the error..
gfortran: w3servmd.ftn:linker input file unused because linking not done


I think the problem lies elsewhere.

Ie w3servmd.mod is being generated but the program can't find it??

I have tried copying the w3servmd.mod file that's been generated to the 'bin' and also 'working' directory but this doesn't help.

I feel there's something simple going wrong but I can't figure it out.
 
I've nearly tried everything but still getting the same error. Am I supposed to pre-process any files with 'w3adc' at all before I try and compile??

Cheers, Craig
 
Not sure - try this

rename w3adc.ftn to w3adc.f90

I'm guessing that it builds as f77 if the extension is .f or .ftn and it doesn't generate the mod files.
 
Sorry - don't know where I got adc from: just rename all .ftn files to .f90.
 
Cheers for your continued help xwb, but I don't think renaming the files is an option, as there at least 15 .ftn files and I believe the program is setup to work with the /ftn files.

So where i'm at at the moment is this.

I try to compile one of the program ww3_grid with the w3_make file.

'w3_make' goes to the 'ad3' program which then chooses whether to run the 'w3adc' program to compile '.ftn' files or otherwise the 'comp' program to compile .f and .f90 files.

It creates w3servmd.mod in the /mod/ folder and w3servmd.o in the /obj/ folder but then the error log file for 'w3gdatmd.l' says it cannot fine the file w3servmd.mod although it exists.

Maybe there is a read or write permission error problem??
 
I think the .mod files have to live in the same directory as the .obj or .o files.
 
Ok thanks for your help xwb, I figured out the problem.

When calling the compile instruction 'gfortran' I wasn't specifying correctly where the 'mod' directory was so now that's sorted its all working and compiling.

But now I have a seperate problem.

I'm trying to install wgrib2 and bacio libraries etc but I can't seem to get them to work.

The makefiles look as if they are in C but there are supposed to be fortran, hence my fortran compiler isn't recognising some of the commands.

Does anyone have any ideas on how to setup up the grib2 libraries etc. ??

Cheers, Craig
 
Makefiles have their own syntax: neither C nor Fortran. Can you post the makefile if it is not too big.
 
Here is a simple bacio makefile that I can't get to work..

------------------------------
SHELL=/bin/sh
CC=xlc
FC=xlf
LIB=libbacio.a
INC=clib.h
FFLAGS= -O3 -qnosave -qarch=auto
AFLAGS= -X64
CFLAGS=-O3 -qarch=auto

$(LIB): $(LIB)( bacio.v1.3.o baciof.o )

$(LIB)(bacio.v1.3.o): bacio.v1.3.c $(INC)
$(CC) -c $(CFLAGS) bacio.v1.3.c
ar -rv $(AFLAGS) $(LIB) bacio.v1.3.o

$(LIB)(baciof.o): baciof.f
$(FC) -c $(FFLAGS) baciof.f
ar -rv $(AFLAGS) $(LIB) baciof.o
rm -f baciof.o

----------------------------------------



And here is the more complex g2lib-1.1.9



-----------------------------------------

SHELL=/bin/sh

# Make sure one of the following options appears in your CFLAGS
# variable to indicate which system you are on. Used to call
# "C" routines from Fortran.
# -DLINUX, -DLINUXG95, -DSGI, -DHP, -DCRAY90, -DAIX, -DLINUXF90, -DVPP5000

# If you want to enable support for PNG or JPEG2000 encoding/decoding,
# you must specify -DUSE_PNG and/or -DUSE_JPEG2000 in the FDEFS variable
# for the Fortran pre-processor
# -DUSE_PNG requires libpng.a and libz.a
# ( and png.h pngconf.h zconf.h zlib.h include files).
# -DUSE_JPEG2000 requires libjasper.a
# ( and all the jasper/*.h include files).
#
# In addition, INCDIR must include all directories where the above
# mentioned include files can be found.
FDEFS=-DUSE_PNG -DUSE_JPEG2000
INCDIR=-I/pub/share/ncoops/jasper-1.900.1/src/libjasper/include

LIB=libg2.a

#--------------------------------------
# The following was used for XLF on AIX
#DEFS=-DAIX -DHAVE_SYS_TYPES_H=1
#FC=xlf
#CC=xlc
#CPP=/usr/ccs/lib/cpp -P
#MODDIR=../g2mod
#FFLAGS=-O3 -g -qnosave -qarch=auto -qmoddir=$(MODDIR) -I $(MODDIR)
#CFLAGS=-O3 -q64 -g -qcpluscmt -qarch=auto $(DEFS) $(INCDIR)
#ARFLAGS=-X64

#--------------------------------------
# The following was used for F90 on LINUX
#
# DEFS=-DLINUXF90
# FC=f90
# CC=gcc

#--------------------------------------
# The following was used for GFORTRAN on LINUX
#
# DEFS=-DLINUX
# FC=gfortran
# CC=gcc
# FFLAGS=-O3 -g -m32 -I $(MODDIR)
# CFLAGS=-O2 -g -m32 $(DEFS) $(INCDIR)
# CPP=cpp -P -C
# MODDIR=.

#--------------------------------------
# The following was used for G95 on LINUX
#
DEFS=-DLINUXG95
FC=g95
CC=cc
CPP=cpp -P -C
MODDIR=.
FFLAGS=-O3 -g -I $(MODDIR)

#
#----- used with 32-bit machine ---
#
CFLAGS=-O3 $(DEFS) $(INCDIR)

#
#----- used with 64-bit machine ---
#
# CFLAGS=-O3 $(DEFS) $(INCDIR) -D__64BIT__
#
ARFLAGS=
#--------------------------------------

.SUFFIXES: .a .f .F .c

$(LIB): $(LIB)(gridtemplates.o) \
$(LIB)(pdstemplates.o) \
$(LIB)(drstemplates.o) \
$(LIB)(gribmod.o) \
$(LIB)(realloc.o) \
$(LIB)(getgb2rp.o) \
etc......... (This goes on for a while)



.F.f:
$(CPP) $(FDEFS) $*.F $*.f

.f.a:
$(FC) -c $(FFLAGS) $<
ar $(ARFLAGS) -ruv $@ $*.o
rm -f $*.o

.c.a:
$(CC) -c $(CFLAGS) $<
ar $(ARFLAGS) -ruv $@ $*.o
rm -f $*.o
------------------------------------------


Cheers, Craig
 
The first script, probably from IBM/AIX uses xlf to build the code. The second uses g95.

The part you didn't quite understand was that it uses the C preprocessor to convert from a .F file to a .f file. It then builds the .f file with g95.

In the first script, if you change xlc to gcc and xlf to g95, you might get it to build.
 
Ok Cheers XWB, over that hurdle and have all the libraries installed.

I'm basically learning Linux and fortran as I go so am running into a few stumbling blocks but am making slow progress and learning as I go.
 
Hi posties,

I am having the same compile issue with fortran. can you be a little more specific with your solution regarding your statement below...

'When calling the compile instruction 'gfortran' I wasn't specifying correctly where the 'mod' directory was so now that's sorted its all working and compiling.'

I have tried all kinds of settings in the comp file to include the likes of...

gfortran -c -J /home/dev/wave3/mod $prog $objects > link.out 2> link.err

Any info would be greatly appreciated. Thx! ./rj



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top