OSX ./build.bash problems (upwelling test case).

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
marina_ud
Posts: 3
Joined: Mon Sep 08, 2014 4:17 pm
Location: University of Delaware Coastal Engineering

OSX ./build.bash problems (upwelling test case).

#1 Unread post by marina_ud »

Greetings,

I'm quite new to ocean modeling, with my programming background being primarily in machine code and matlab programming, though I have prior C and javascript experience and used linuxboxes in the past. This still puts me firmly in the beginner stage for the lot of this.

I was given a Mac-OSX computer to start testing ROMS on, practicing and learning, in preparation for taking over a long-running project from another doctoral student. I successfully followed all of the installation instructions.

However, after installation, the instructions continue with the running of the 'upwelling' example. During this process I get to the stage of "creating an executable oceanS file" . At the ./build.bash command for compiling, I get the following errors:

make: *** No rule to make target `clean'. Stop.
make: *** No targets specified and no makefile found. Stop.

The file "oceanS" is not built.

I reviewed my installation of the components required to run ROMS, as from what I have been able to read, this is normally caused by a failure to properly install the fortran library for netCDF. However, I installed both netCDF 4.2 and the netCDF-fortran-4.2 library directly off of MacPorts, based on the instructions found at: http://mazamascience.com/WorkingWithData/?p=1474 ; and, after following those instructions, I downloaded and ran their test case programme successfully without difficulty, so clearly at least netCDF itself is working correctly, and I installed the fortran library by the same process.

I understand that generally it's expected for beginners to work through these issues themselves, but at this stage I've exhausted what knowledge as I have without an outside perspective, so anything I could check or test to be able to continue proceeding would be deeply appreciated.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#2 Unread post by kate »

It is telling you that it can't find the makefile. In the build.bash, there is the line

Code: Select all

cd ${MY_ROMS_SRC}
right before it tries to "make". Make sure that ${MY_ROMS_SRC} is set to the top of your source code, where there is a makefile.

marina_ud
Posts: 3
Joined: Mon Sep 08, 2014 4:17 pm
Location: University of Delaware Coastal Engineering

Re: OSX ./build.bash problems (upwelling test case).

#3 Unread post by marina_ud »

Thank you very kindly for your answer, Kate. I implemented the correction for it and received a new error (got a few lines into the compile this time). This error I identified as being a failure to properly recognize where netcdf was, so based on my expected application (i.e. exclusively ROMS), I went ahead and installed the older version of netcdf per the instructions on the ROMS Wiki. It still didn't work, but I then identified a problem that the specification for changing the following lines in the build.bash file were incorrect for my installation:
else
export NETCDF_INCDIR=/usr/local/include
export NETCDF_LIBDIR=/usr/local/lib
fi
As earlier on in the mac OSX instructions for installing the fortran compiler this example of testing its location is shown:
which gfortran
/usr/local/bin/gfortran
However, on the command 'which gfortran', my address is:

/opt/local/bin/gfortran .

Thus, I altered the code to read:
else
export NETCDF_INCDIR=/opt/local/include
export NETCDF_LIBDIR=/opt/local/lib
fi

The ./build.bash then compiled for quite a while and seemed like it was going to work, but finally terminally failed on the following error:
cd /Users/mitfrc/ROMSDIR/ROMS/Projects/Upwelling/Build; /opt/local/bin/gfortran -c -frepack-arrays -O3 -ffast-math -ffree-form -ffree-line-length-none strings.f90
cd /Users/mitfrc/ROMSDIR/ROMS/Projects/Upwelling/Build; /opt/local/bin/gfortran -c -frepack-arrays -O3 -ffast-math -ffree-form -ffree-line-length-none mod_netcdf.f90
mod_netcdf.f90:19.16:

USE netcdf
1
Fatal Error: Wrong module version '10' (expected '6') for file 'netcdf.mod' opened at (1)
make: *** [/Users/mitfrc/ROMSDIR/ROMS/Projects/Upwelling/Build/mod_netcdf.o] Error 1
Which is where I stand at the present. I assume the 'wrong module version' for netcdf.mod is the relevant problem, but don't have a good idea of what that means.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#4 Unread post by kate »

Which is where I stand at the present. I assume the 'wrong module version' for netcdf.mod is the relevant problem, but don't have a good idea of what that means.
It means that your netcdf was compiled with a different version of gfortran than that you are using to compile ROMS. It looks like you got a precompiled version? If you knew what version of gfortran was used, you could fetch that instead (since it is newer).

You don't say what version of Netcdf it is. I would suggest something recent, in the 4.x series. That way you can have USE_NETCDF4 in your build and not have to mess around with setting NETCDF_INCDIR or NETCDF_LIBDIR. You then need to point to the correct nc-config and let it do the work. For the netcdf, it is "which nc-config" you need to know, not "which gfortran". Did your freshly downloaded netcdf go into /opt/local? The build must have found a netcdf.mod file in /opt/local/include.

I'm in the class of people who must have the newest software. I would therefore a) fetch a new gfortran, b) fetch the source for a new netcdf, and c) compile b with a, putting it into /opt/local.

marina_ud
Posts: 3
Joined: Mon Sep 08, 2014 4:17 pm
Location: University of Delaware Coastal Engineering

Re: OSX ./build.bash problems (upwelling test case).

#5 Unread post by marina_ud »

Greetings,

Thank you again so much for your help, Kate. I've been getting back to this and succeeded to my knowledge in re-installing newer versions of netCDF and gfortran. However, I now get the error :

cd /Users/mitfrc/ROMSDIR/ROMS/Projects/Upwelling/Build; /usr/local/bin/gfortran -c -frepack-arrays -O3 -ffast-math -ffree-form -ffree-line-length-none mod_netcdf.f90
mod_netcdf.f90:19.10:

USE netcdf
1
Fatal Error: Cannot read module file 'netcdf.mod' opened at (1), because it was created by a different version of GNU Fortran
make: *** [/Users/mitfrc/ROMSDIR/ROMS/Projects/Upwelling/Build/mod_netcdf.o] Error 1


I admittedly installed netcdf via the netcdf-fortran installer on macports, but understood this to be adequate. Does this merely imply that I don't have fortran-90 working properly for netcdf so it's a 77/90 mismatch issue (fortran is my weakest point in this process by far), or does it mean I still have some older version of gfortran on my computer that I failed to properly uninstall and that macports cheerfully compiled netcdf with this?

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#6 Unread post by kate »

It can't be much clearer:
Cannot read module file 'netcdf.mod' opened at (1), because it was created by a different version of GNU Fortran
You have some version of gfortran. Netcdf-fortran was compiled by some other version of gfortran. For most compilation and linking issues, this wouldn't be so bad, but Fortran 90 module files evolve as the compilers evolve and you have to match compiler versions for all the bits of your final program.

jpringle
Posts: 108
Joined: Sun Jul 27, 2003 6:49 pm
Location: UNH, USA

Re: OSX ./build.bash problems (upwelling test case).

#7 Unread post by jpringle »

Old thread, but I hope this helps someone. You can run ROMS on OS X/mac using macports to install all the libraries. But was noted above, the netcdf is a bit tricky. To get it to work, you must specify the variant of netcdf-fortran to install that is consistent with your fortran compiler. To do this, first determine the version of gfortran you are using:

gfortran --version

Then install the appropriate variant for netcdf-fortran; so if you find you are using gfortran 4.9, run the following command

sudo port install netcdf-fortran +gcc49

More info can be found at https://guide.macports.org/chunked/using.variants.html

I hope this helps someone

Jamie

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: OSX ./build.bash problems (upwelling test case).

#8 Unread post by Scarlett »

Hi everyone!
I'm working with roms-3.7, and I had the same problem with the compiler.
-
makefile:235: INCLUDING FILE Build/make_macros.mk WHICH CONTAINS APPLICATION-DEPENDENT MAKE DEFINITIONS
cd Build; /opt/pb/gcc-5.1.0/bin/gfortran -c -frepack-arrays -fopenmp -O3 -ffast-math -ffree-form -ffree-line-length-none mod_netcdf.f90
mod_netcdf.f90:19:10:

USE netcdf
1
Fatal Error: Cannot read module file ‘netcdf.mod’ opened at (1), because it was created by a different version of GNU Fortran
compilation terminated.
make: *** [Build/mod_netcdf.o] Error 1

Could anybody tell me how to solve this problem, please? I tryed to install netcdf-fortran + gcc49 .. but it does not work ...
Thanks in advance.
-
Mar.Mo.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#9 Unread post by kate »

/opt/pb/gcc-5.1.0/bin/gfortran
Try
install netcdf-fortran + gcc51
instead.

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: OSX ./build.bash problems (upwelling test case).

#10 Unread post by Scarlett »

Hi Kate, thanks for your help:
-
Apparently "install netcdf-fortran + gcc51" do not works for me....
I get:

[root@:ahumada]$(12)->yum install netcdf-fortran + gcc51
Loaded plugins: changelog, fastestmirror, presto, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* AL-Server: mirror1.alcancelibre.org
* base: mirror.cs.uwp.edu
* epel: fedora-epel.mirror.lstn.net
* extras: mirror.atlanticmetro.net
* updates: mirror.solarvps.com
No package netcdf-fortran available.
No package + available.
No package gcc51 available.
Error: Nothing to do
-
I tried for gcc-5.1.0, gcc-6.3.0 and gcc-4.6.2 ... and in all the cases I get the same...
Could you help me please?
-
Thanks in advance.
-
Mar.Mo.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#11 Unread post by kate »

Jamie was recommending "port install" while I've used "brew" instead. Then there's my Linux virtualbox on the Mac where I use "apt-get install". That's where I really know how to set things up correctly.

jpartida18
Posts: 3
Joined: Thu May 25, 2017 4:45 pm
Location: Woods Hole Oceanographic Institution

Re: OSX ./build.bash problems (upwelling test case).

#12 Unread post by jpartida18 »

Hello,

I am getting an error while attempting to compile with build.bash as well, though the problem is different. When I enter ./build.bash a good amount of text is printed to the screen, but then abruptly ends with


ROMS/Bin/cpp_clean /Users/jacob_partida/roms//Projects/Upwelling//Build/mod_kinds.f90
cd /Users/jacob_partida/roms//Projects/Upwelling//Build; /usr/local/bin/gfortran -c -frepack-arrays -g -fbounds-check -ffree-form -ffree-line-length-none mod_kinds.f90
FATAL:/opt/local/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
make: *** [/Users/jacob_partida/roms//Projects/Upwelling//Build/mod_kinds.o] Error 1


I'm on OS 10.12.5
I have used gfortran 6.3 to compile netcdf3, and also have used macports to get netcdf and netcdf-fortran (version 4). Using either one has returned the same error. I have more or less followed the steps in the various tutorials in the wiki.
I would greatly appreciate any help on this I can get!

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#13 Unread post by kate »

Can you try an older version of gfortran? 6.3 is pretty darn new. My homebrew gcc is at 5.3 on the Mac.

That said, gfortran 6.3 works for me in the Ubuntu virtualbox.

jpartida18
Posts: 3
Joined: Thu May 25, 2017 4:45 pm
Location: Woods Hole Oceanographic Institution

Re: OSX ./build.bash problems (upwelling test case).

#14 Unread post by jpartida18 »

Alright, thanks for the reply.

So I've uninstalled gfortran 6, netcdf, netcdf-fortran...
used macports to install gcc5, hdf5-18 (+gcc5), netcdf(+gcc5), and netcdf-fortran(+gcc5)

and get the error message in the attached file
which ends with

cd /Users/jacob_partida/roms//Projects/Upwelling//Build; -c -frepack-arrays -g -fbounds-check -ffree-form -ffree-line-length-none mod_kinds.f90
/bin/sh: -c: command not found
make: *** [/Users/jacob_partida/roms//Projects/Upwelling//Build/mod_kinds.o] Error 127
Attachments
log_170526.rtf
(13.76 KiB) Downloaded 556 times

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: OSX ./build.bash problems (upwelling test case).

#15 Unread post by kate »

This is in the FAQ, bullet three.

jpartida18
Posts: 3
Joined: Thu May 25, 2017 4:45 pm
Location: Woods Hole Oceanographic Institution

Re: OSX ./build.bash problems (upwelling test case).

#16 Unread post by jpartida18 »

My fault, I got so used to looking in that FAQ that I forgot to look again..

problem solved by creating a symbolic link to the new-old gfortran downloaded through macports:

sudo ln -s /opt/local/bin/gfortran-mp-5 /usr/local/bin/gfortran

(location of gfortran with new name [gfortran-mp-5 ... thanks macports :roll: ] -> location of the old symbolic link since removed)

seems to have worked, thanks for your help!

Post Reply