Fedora Linux Support Community & Resources Center
  #1  
Old 29th June 2009, 06:18 AM
sblueknigt Offline
Registered User
 
Join Date: Jun 2009
Posts: 1
Question Need help setting compiler/linker definitions in scripts for Wave Watch III

I am using Fedora 10, and I am trying to compile the source code for the Wave Watch III model. There are two scripts called "comp" and "link" that need to be editing before running the w3_make script (which invokes a bunch of other scripts to essentially compile the entire model). w3_make calls upon the comp/link scripts for compiler definition and linker call. Below are the edits I have made to the comp and link scripts, respectively...

__________________________________________________ _________________________
# 2.b Perform compilation - - - - - - - - - - - - - - - - - - - - - - - - - -
# Save compiler exit code in $OK

# Generic --------------------------------------------------------------------
gfortran -c $name.$fext -o $name.o > $name.out 2> $name.err
OK="$?"
__________________________________________________ _________________________
# 3. Link all things #
# --------------------------------------------------------------------------- #
# Add here the correct linker call including switches
#
# Generic -------------------------------------------------------------------
gfortran -o $prog $name lib.a > link.out 2> link.err
OK="$?"
__________________________________________________ _________________________

When I run w3_make to compile the grid preprocessor it returns the error...

wriwx@wri-> w3_make ww3_grid

*****************************
*** compiling WAVEWATCH-III ***
*****************************

Scratch directory : /home/wriwx/scratch
Save source codes : yes
Save listings : yes


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


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

This shows that the object file cannot be found, but the compiler should be creating it, as it passes a test that I'm running prior that passes and produces the file ctest.o in the proper directory. All directories and variables are correctly defined in the scripts, though I am unsure if I am inserting the correct variables/options after calling gfortran in the "link" script...therefore, I think the error may be in the "link" script. I have set-up error listing, which outputs the following error...


ww3_grid.f90:243.19:

USE CONSTANTS
1
Fatal Error: Can't open module file 'constants.mod' for reading at (1): No such file or directory


I have no idea what this is about.

I do not have much experience with compiling code, but I think the problem is in the "link" script. If anyone more familiar with compiling can help or has any idea what may be wrong here, it would be greatly appreciated. If more info is needed, post a reply and I will give my e-mail address. I have attached the "comp" and "link" scripts as they were before my above edits. Thank You.
Reply With Quote
  #2  
Old 29th June 2009, 06:49 AM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,294
The above post was automatically moderated (removed from public view) by the Forum vB software. I have no idea why. I have approved the post.

V
Reply With Quote
  #3  
Old 3rd December 2009, 07:05 AM
SAsurfa Offline
Registered User
 
Join Date: Dec 2009
Posts: 6
windows_xp_2003ie
Hi Guys and Gals,

I have just installed ww3 on a linux machine and I am getting a similar problem to above, although my error reads..

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, Craig
Reply With Quote
  #4  
Old 8th December 2009, 05:40 AM
SAsurfa Offline
Registered User
 
Join Date: Dec 2009
Posts: 6
windows_xp_2003ie
No one got any ideas to help me out??
Reply With Quote
  #5  
Old 8th December 2009, 06:26 AM
aleph Offline
Banned (for/from) behaving just like everybody else!
 
Join Date: Jul 2007
Location: Nanjing, China
Posts: 1,332
linuxfedorafirefox
It seems there's a bug in the compilation procedures. The F95 module files are missing from the compiler's search path, which is the current directory for the compiler's process. If that is the case, you may have to hack the makefile or compilation script or whatever by using the "-J" option for gfortran. E.g. to search the directory "/path/to/foo" for the mod files USEd by bar.f90, use "gfortran -J/path/to/foo bar.f90".

Having to deal with the clusterfnck known as F90/F95 is already a misfortune, I believe. It was an attempt to bring the worst of F77 and Java together in a new language, yet preserving compatibility with F77 (in the same (doomed) manner of C++ preserving compatibility with C). So good luck with that. I understand the pain.
__________________
Code:
from rlyeh import cthulhu
cthulhu.fhtagn()
Reply With Quote
  #6  
Old 15th December 2009, 05:51 AM
SAsurfa Offline
Registered User
 
Join Date: Dec 2009
Posts: 6
windows_xp_2003ie
Ok thanks for your help aleph, I figured out the problem thanks to your help.

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
Reply With Quote
  #7  
Old 7th January 2010, 10:51 PM
rodneyjsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 3
windows_vistasafari
Hi SAsurfa,

I am having the same issue. I have changed my comp and link files to the following -

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

However I am still getting the same error? Any help would be appreciated. Thx! ./rj
Reply With Quote
  #8  
Old 8th January 2010, 12:52 AM
SAsurfa Offline
Registered User
 
Join Date: Dec 2009
Posts: 6
windows_xp_2003ie
Hi Rodney, I'm Posties in the other forum

OK, instead of pointing to the mod folder in the end line 'gfortran -c -J /home/dev.....

put it in the top of the generic compiling code after the 'opt' variable...

i.e..

opt = "-c -O2 -I$path_m"

and $path_m is specified somewhere esle in the program code, but should automatically point to the mod directory, you shouldn't need to change this.

so then instead of having..

gfortran -c -J /home/dev.....

put gfortran $opt $name.$fext > $name.out 2> $name.err

or if you've got a small algorithm to select which compiler you use as I have then...

$comp $opt $name.$fext > $name.out 2> $name.err


Oh this is in the comp file by the way, not the link file.

Hope that helps
Reply With Quote
  #9  
Old 8th January 2010, 06:34 AM
rodneyjsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 3
windows_vistasafari
Nice! Works like a champ. Thanks SAsurfa. However now I am getting when running w3_make ww3_grid

ad3 : processing ww3_grid
Linking ww3_grid
*** program ww3_grid not found ***

cat: link.out: No such file or directory

cat: link.err: No such file or directory

Anyways I added the same config to the link file but no luck Sorry to keep bugging but did you come across that too?
Reply With Quote
  #10  
Old 8th January 2010, 07:02 AM
SAsurfa Offline
Registered User
 
Join Date: Dec 2009
Posts: 6
windows_xp_2003ie
Looks like you have an error in the linking program now.

DO you have the code??
Reply With Quote
  #11  
Old 8th January 2010, 06:00 PM
rodneyjsd Offline
Registered User
 
Join Date: Jan 2010
Posts: 3
windows_vistasafari
This is the link file in the bin directory. I am assuming this is where all the linking is occurring? I am just using the general settings with gfortran. Thx! ./rj

#!/bin/sh
# --------------------------------------------------------------------------- #
# link : Linker script for use in make (customized for hardware and #
# optimization. Note that this script will not be replaced if part #
# of WAVEWATCH III is re-installed. #
# #
# use : link name [name ... ] #
# name: name of source code file without the extension. #
# the first name will become the program name. #
# #
# error codes : all error output directly to screen. #
# #
# remarks : #
# #
# - Upon (first) installation of WAVEWATCH III the user needs to check the #
# following parts of this scripts : #
# sec. 3 : Provide correct link command #
# #
# Hendrik L. Tolman #
# May 2009 #
# #
# Copyright 2009 National Weather Service (NWS), #
# National Oceanic and Atmospheric Administration. All rights #
# reserved. WAVEWATCH III is a trademark of the NWS. #
# No unauthorized use without permission. #
# #
# --------------------------------------------------------------------------- #
# 1. Preparations #
# --------------------------------------------------------------------------- #
# 1.a Check and process input

if [ "$#" -lt '1' ]
then
echo "usage: link name [name]" ; exit 1
fi

prog=$1
echo " Linking $prog"
input="$*"

# 1.b Internal variables - - - - - - - - - - - - - - - - - - - - - - - - - - -

ww3_env='.wwatch3.env' # setup file

# 1.c Read data from the environment file - - - - - - - - - - - - - - - - - -

cd
if [ -f $ww3_env ]
then
set `grep WWATCH3_DIR $ww3_env` ; shift
main_dir="$*"
else
echo "*** Set-up file $ww3_env not found ***"
exit 2
fi

if [ -n "`grep MPI $main_dir/bin/switch`" ]
then
export mpi_mod='yes'
else
export mpi_mod='no'
fi

if [ -n "`grep OMP $main_dir/bin/switch`" ]
then
export omp_mod='yes'
else
export omp_mod='no'
fi

# 1.d Initial clean-up - - - - - - - - - - - - - - - - - - - - - - - - - - - -

rm -f $main_dir/exe/$prog

# --------------------------------------------------------------------------- #
# 2. Check objects #
# --------------------------------------------------------------------------- #

cd $main_dir/obj
objects=$NULL
error='n'
set $input

while [ "$#" -gt '0' ]
do
file=$1.o
if [ -f "$file" ]
then
objects="$objects $file"
else
echo " *** file $file not found ***"
error='y'
fi
shift
done

# --------------------------------------------------------------------------- #
# 3. Link all things #
# --------------------------------------------------------------------------- #
# Add here the correct linker call including switches

# Generic -------------------------------------------------------------------
# f90 -o $prog $objects > link.out 2> link.err
#gfortran -c $prog $objects > link.out 2> link.err

opt="-c -O2 -I$path_m"
gfortran $opt $name.$fext > $name.out 2> $name.err
OK="$?"

# Portland Group ------------------------------------------------------------
# 3.a Build options and determine compiler name
# No GRIB libraries for this one

# opt="-o $prog"

##if [ "$mpi_mod" = 'yes' ]
##then
## comp=mpif90
##else
# comp=pgf90
##fi

# if [ "$omp_mod" = 'yes' ]
# then
# opt="$opt -mp"
# fi

# 3.b Link

# $comp $opt $objects > link.out 2> link.err
# OK="$?"

# IBM RS 6000 xlf ----------------------------------------------------------
# 3.a Build options and determine compiler name
# Note GRIB libraries for this one

# opt="-g -C -qsigtrap -o $prog -O3 -qarch=pwr3 -qnosave"
# comp=xlf90

# if [ "$mpi_mod" = 'yes' ]
# then
# comp=mpxlf90
# fi

# if [ "$omp_mod" = 'yes' ]
# then
# comp=xlf90_r
# opt="$opt -qsmp=noauto"
# fi

# case $prog in
# 'ww3_grib' ) libs="/nwprod/w3lib90/w3lib_4 /nwprod/w3lib90/bacio_4" ;;
# * ) libs= ;;
# esac

# 3.b Link

# $comp $opt $objects $libs > link.out 2> link.err
# OK="$?"

# End compiler dep. ---------------------------------------------------------

# --------------------------------------------------------------------------- #
# 4. Postprocessing #
# --------------------------------------------------------------------------- #

if [ "$OK" != '0' ]
then
echo " *** error in linking ***"
echo ' '
cat link.out
echo ' '
cat link.err
echo ' '
rm -f link.???
rm -f $prog
else
if [ ! -f $prog ]
then
echo " *** program $prog not found ***"
echo ' '
cat link.out
echo ' '
cat link.err
echo ' '
rm -f link.???
else
mv $prog $main_dir/exe/.
rm -f link.???
fi
fi

# end of link --------------------------------------------------------------- #
Reply With Quote
  #12  
Old 12th January 2010, 12:38 AM
SAsurfa Offline
Registered User
 
Join Date: Dec 2009
Posts: 6
windows_xp_2003ie
Ok under Generic you have the wrong settings.

You don't need the -c command after the compiler as you are not compiling.

This is what I have, but I have installed all the libraries from here http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/


--------------------------------------------------------------------------- #
# 3. Link all things #
# --------------------------------------------------------------------------- #
# Add here the correct linker call including switches

# Generic -------------------------------------------------------------------
#gfortran -o $prog $objects > link.out 2> link.err
#OK="$?"

opt="-frecord-marker=4"

if [ "$mpi_mod" = 'yes' ]
then
comp=mpif90
libs = "/usr/local/lib/libmpi_f90.so.0
else
comp=/usr/bin/gfortran
fi

if [ "$omp_mod" = 'yes' ]
then
opt="$opt -openmp"
fi

# 3.b Link

case $prog in
'ww3_grib' ) libs= "/usr/local/lib/libg2.a /usr/local/lib/libbacio.a" ;;
* ) libs= ;;
esac

$comp $opt -o $prog $objects $libs > link.out 2> link.err
OK="$?"

Hope that helps!
Reply With Quote
  #13  
Old 22nd April 2010, 04:50 PM
Camillou Offline
Registered User
 
Join Date: Apr 2010
Posts: 18
windows_xp_2003firefox
Re: Need help setting compiler/linker definitions in scripts for Wave Watch III

Hi Everybody!
I am quite new in WW3 and Unix, and I just found this forum. I am trying to install WW3 on my computer. In fact, I don't have Fedora, but Ubuntu (but I think it is quite the same thing, finally).
I have already installed the packages, and I am now in the following step: modidying some thing on comp and link files (in the /bin directory). I have read all the things you have wrote about that, but as I am really beginning with Unix and Fortran, and I really really lost . Could you tell me exactly what I have to write:
FOR comp:
- section sec. 2.b: Provide correct compiler/options.
- sec. 3.a : Provide correct error capturing.
- sec. 3.d : Remove unnecessary files.
FOR link :
- sec. 3 : Provide correct link command

I am compiling with gfortran.
Thank you in advance for your replies...
Cheers from Puerto Varas, south of Chile!
Camillou*
Reply With Quote
  #14  
Old 22nd April 2010, 05:28 PM
giulix Offline
"Fixed" by (vague) request
 
Join Date: Oct 2005
Location: GMT+ 1
Posts: 2,950
linuxfedorafirefox
Re: Need help setting compiler/linker definitions in scripts for Wave Watch III

Hi, apart from Aleph and admins, it doesn't look very likely that people who contributed to this thread are still around. So, unless they are still monitoring this thread via their respective email accounts, chances are they won't read your post. Therefore, it might be useful if you could post a link to the code/documentation of this software (I had a look around, understood it is some .gov project, so it should be FOSS but couldn't find a link to it). That will greatly enhance your chances of getting help on such an exotic (and interesting) topic. And btw, Ubuntu and Fedora are quite different, especially in terms of packaging. That could be a problem if particular versions of additional software are required. If, on the other hand, Wave Watch III provides all the software needed to build the program, please disregard this last comment...

Last edited by giulix; 22nd April 2010 at 05:32 PM.
Reply With Quote
  #15  
Old 22nd April 2010, 05:51 PM
Hlingler Offline
Administrator
 
Join Date: Sep 2006
Location: Connellsville, PA, USA
Posts: 11,294
linuxopera
Re: Need help setting compiler/linker definitions in scripts for Wave Watch III

Quote:
In fact, I don't have Fedora, but Ubuntu (but I think it is quite the same thing, finally).
They're both Linux distributions, but beyond that, for the purpose of your question, I think that you're in the wrong place - try: http://www.ubuntu.com/
Quote:
I am compiling with gfortran.
In Fedora, there is a compiler package called gcc-gfortran. Perhaps Ubungtu has an equivalent, and this may be what you need.

Good Luck,
V
Reply With Quote
Reply

Tags
compile, link, linking, modeling, wavewatch

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wave Keyboard crazyfool Hardware & Laptops 0 10th July 2008 02:04 PM


Current GMT-time: 23:44 (Saturday, 22-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Shemonaikha Instagram Photos - Nahan Photos on Instagram - Bentong Town Travel Photos