Compile ROMS problem via cygwin
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Compile ROMS problem via cygwin
Hello Everyone
I´m installing ROMS via CYGWIN. I´ve followed the instructions of the Tutorial for Windows and I´ve got to the Compile ROMS process in order to get the executable oceanS file; when I do so, I get this message:
./build.bash: line 40: $'\r': command not found
./build.bash: line 43: $'\r': command not found
./build.bash: line 46: syntax error near unexpected token '$'in\r'
./build.bash: line 46: ' case "$1" in
I applied the dos2unix command as:
$ dos2unix ./build.bash
and I only get this line (blue)
dos2unix: convirtiendo archivo ./build.bash a formato Unix ...
dos2unix: converting file ./build.bash to unix format ... (traslation)
Is my sintax on the dos2unix command wrong? Any clue what am I doing wrong?
Beause no lots of stuff comes out and no oceanS is done.
Thanks in advance
Leo
I´m installing ROMS via CYGWIN. I´ve followed the instructions of the Tutorial for Windows and I´ve got to the Compile ROMS process in order to get the executable oceanS file; when I do so, I get this message:
./build.bash: line 40: $'\r': command not found
./build.bash: line 43: $'\r': command not found
./build.bash: line 46: syntax error near unexpected token '$'in\r'
./build.bash: line 46: ' case "$1" in
I applied the dos2unix command as:
$ dos2unix ./build.bash
and I only get this line (blue)
dos2unix: convirtiendo archivo ./build.bash a formato Unix ...
dos2unix: converting file ./build.bash to unix format ... (traslation)
Is my sintax on the dos2unix command wrong? Any clue what am I doing wrong?
Beause no lots of stuff comes out and no oceanS is done.
Thanks in advance
Leo
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
Hi Leolalvarez wrote:Hello Everyone
I´m installing ROMS via CYGWIN. I´ve followed the instructions of the Tutorial for Windows and I´ve got to the Compile ROMS process in order to get the executable oceanS file; when I do so, I get this message:
./build.bash: line 40: $'\r': command not found
./build.bash: line 43: $'\r': command not found
./build.bash: line 46: syntax error near unexpected token '$'in\r'
./build.bash: line 46: ' case "$1" in
I applied the dos2unix command as:
$ dos2unix ./build.bash
and I only get this line (blue)
dos2unix: convirtiendo archivo ./build.bash a formato Unix ...
dos2unix: converting file ./build.bash to unix format ... (traslation)
Is my sintax on the dos2unix command wrong? Any clue what am I doing wrong?
Beause no lots of stuff comes out and no oceanS is done.
Thanks in advance
Leo
The dos2unix command should convert the line endings in the file from Windows (\r\n or CR LF) to Unix (\n or LF) and maybe print a short, informative message. Which is what it appears to have done.
The next thing to do is try running it again. Have you done that?
Mark
PS: the fact that you had \r's in your build.bash in the first place suggests you have downloaded it with a Windows utility, or maybe edited with a Windows editor that doesn't preserve Unix line endings. These are things you should avoid.
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Mark
Thanks for Your replay
Do I have to run the whole dos2unix ./build.bash command or only the ./build.bash command?
One more thing, I have ROMS installed via cygwin on windows with netcdf-4.1.1 version in a laptop.
How can I update the netcdf on this other computer?
Have a nice day
Leo
Thanks for Your replay
Do I have to run the whole dos2unix ./build.bash command or only the ./build.bash command?
One more thing, I have ROMS installed via cygwin on windows with netcdf-4.1.1 version in a laptop.
How can I update the netcdf on this other computer?
Have a nice day
Leo
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Well I have run the dos2unix ./build.bash command and I get
dos2unix: converting file ./build.bash to unix format ... (traslation), so it is Ok!
and then I run the ./build.bash command only and I get this message
$ ./build.bash
makefile:32: *** This makefile requires one of GNU make version 3.80 3.81 3.82.. Alto.
makefile:32: *** This makefile requires one of GNU make version 3.80 3.81 3.82.. Alto.
Is it related with the netcdf or the cygwin installing process?
Thanks in advance
Leo
dos2unix: converting file ./build.bash to unix format ... (traslation), so it is Ok!
and then I run the ./build.bash command only and I get this message
$ ./build.bash
makefile:32: *** This makefile requires one of GNU make version 3.80 3.81 3.82.. Alto.
makefile:32: *** This makefile requires one of GNU make version 3.80 3.81 3.82.. Alto.
Is it related with the netcdf or the cygwin installing process?
Thanks in advance
Leo
Re: Compile ROMS problem via cygwin
This new problem is related to gnu make. I get:
Then you need to try running build.bash again.
This version matches one in the list of versions it is looking for. What do you get from "make --version"? Add the response to the makefile, near the top. The line looks like:delta.arsc.edu 236% make --version
GNU Make 3.81
You do need to have GNU make, however, not some other version - you should be fine with Cygwin.NEED_VERSION := 3.80 3.81 3.82
Then you need to try running build.bash again.
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Kate
I´m updating the cygwin, and I had installed the 3.82.90-1 version of the GNU make, I´m going to change it for the 3.81-2 version and try to Compile ROMS again
Thanks a lot
Leo
I´m updating the cygwin, and I had installed the 3.82.90-1 version of the GNU make, I´m going to change it for the 3.81-2 version and try to Compile ROMS again
Thanks a lot
Leo
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Kate
It is compiling now, the GNUmake 3.81-2 version works Ok!
Thanks a lot
Leo
It is compiling now, the GNUmake 3.81-2 version works Ok!
Thanks a lot
Leo
Re: Compile ROMS problem via cygwin
Actually, I think Mark Hadfield posted that changing the makefile to account for the weird Cygwin version of make worked just fine. Easier than installing some old make just for ROMS!
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Well the compiling was running until I got this message and the process stops
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld devolvió el estado de salida 1
make: *** [/home/Usuario/roms/Projects/Upwelling/oceanS.exe] Error 1
Any clue about it?
Do I have to run the ./configure, make, make check & make install for the netcdf-4.2.1.1 and netcdf-fortran-4.2 again?
Leo
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld devolvió el estado de salida 1
make: *** [/home/Usuario/roms/Projects/Upwelling/oceanS.exe] Error 1
Any clue about it?
Do I have to run the ./configure, make, make check & make install for the netcdf-4.2.1.1 and netcdf-fortran-4.2 again?
Leo
Re: Compile ROMS problem via cygwin
Please show us the output line before:
The examples on the web tell what's wrong in the line above it.final link failed: Invalid operation
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Kate
Here is the line before final link failed: Invalid operation, I insert the whole paragraph just in case
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /home/Usuar io/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o): bad reloc address 0x48c in se ction `.rdata'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld devolvió el estado de salida 1
make: *** [/home/Usuario/roms/Projects/Upwelling/oceanS.exe] Error 1
Thanks for You help
Leo
Here is the line before final link failed: Invalid operation, I insert the whole paragraph just in case
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /home/Usuar io/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o): bad reloc address 0x48c in se ction `.rdata'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld devolvió el estado de salida 1
make: *** [/home/Usuario/roms/Projects/Upwelling/oceanS.exe] Error 1
Thanks for You help
Leo
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
A quick Google search on "bad reloc address" indicates that this message is usually preceded by other error messages, eg undefined reference, that give you a better indication of the problem. Please, if you can, reply on the forum attaching the *entire* output of your ROMS build, or at least the last few screenfuls of it.
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Kate & Mark
Here it is, the entire output of the Compile ./build.bash
Hope You can help me
Thanks in advance
Here it is, the entire output of the Compile ./build.bash
Hope You can help me
Thanks in advance
- Attachments
-
- CompileRoms-build.bash-Error.docx
- (30.05 KiB) Downloaded 556 times
Re: Compile ROMS problem via cygwin
This could be the second bullet described here. Look at Compilers/CYGWIN-gfortran.mk where there's an ifdef USE_NETCDF4. Did you define it in the build script? Which NetCDF do you have? Does the command "nc-config --flibs" work for you and what does it give?
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
Yes, Kate is on the right track.
The command that triggers the error is
The error messages that follow indicate that the linker can't find several routines from the netCDF Fortran 90 interface.
Leo, you said earlier in the thread that you are using netcdf-4.2 and netcdf-fortran-4.2 or similar. With those versions the Fortran library is separate from the C library, so you would also need "-lnetcdff" in the linker command to find the netCDF Fortran library. And maybe also -lhdf5 and others, depending on the options chosen when netCDF was built. The necessary information should be passed to the build process by nc-config or nf-config (either should work, actually) but it's not.
The command that triggers the error is
Code: Select all
/usr/bin/gfortran-4 -frepack-arrays -O3 -ffast-math /home/Usuario/roms/Projects/Upwelling/Build/esmf_roms.o /home/Usuario/roms/Projects/Upwelling/Build/master.o /home/Usuario/roms/Projects/Upwelling/Build/ocean_control.o /home/Usuario/roms/Projects/Upwelling/Build/ocean_coupler.o /home/Usuario/roms/Projects/Upwelling/Build/propagator.o /home/Usuario/roms/Projects/Upwelling/Build/roms_export.o /home/Usuario/roms/Projects/Upwelling/Build/roms_import.o -o /home/Usuario/roms/Projects/Upwelling/oceanS.exe /home/Usuario/roms/Projects/Upwelling/Build/libUTIL.a /home/Usuario/roms/Projects/Upwelling/Build/libNLM.a /home/Usuario/roms/Projects/Upwelling/Build/libNLM_bio.a /home/Usuario/roms/Projects/Upwelling/Build/libNLM_sed.a /home/Usuario/roms/Projects/Upwelling/Build/libANA.a /home/Usuario/roms/Projects/Upwelling/Build/libUTIL.a /home/Usuario/roms/Projects/Upwelling/Build/libMODS.a -L/usr/local/lib -lnetcdf
Leo, you said earlier in the thread that you are using netcdf-4.2 and netcdf-fortran-4.2 or similar. With those versions the Fortran library is separate from the C library, so you would also need "-lnetcdff" in the linker command to find the netCDF Fortran library. And maybe also -lhdf5 and others, depending on the options chosen when netCDF was built. The necessary information should be passed to the build process by nc-config or nf-config (either should work, actually) but it's not.
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Mark
Yes I´m using the netcdf-4.2.1.1 version and the netcdf-fortran-4.2version.
Anyway I guess my mistake is in here, I configured netcdf-4.2.1.1 with this:
./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap --disable-dap-remote-tests
and configured netcdf-fortran-4.2 with:
CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
instead of this sintax:
CC=gcc FC=gfortran LIBS="$(nf-config --libs)" CPPFLAGS="-I$(nf-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
As Kate once suggested in thread 2766
I´m going to try this last sintax and see what happen
Thanks in advance
Yes I´m using the netcdf-4.2.1.1 version and the netcdf-fortran-4.2version.
Anyway I guess my mistake is in here, I configured netcdf-4.2.1.1 with this:
./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap --disable-dap-remote-tests
and configured netcdf-fortran-4.2 with:
CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
instead of this sintax:
CC=gcc FC=gfortran LIBS="$(nf-config --libs)" CPPFLAGS="-I$(nf-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
As Kate once suggested in thread 2766
I´m going to try this last sintax and see what happen
Thanks in advance
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
No!!lalvarez wrote:Hello Mark
Yes I´m using the netcdf-4.2.1.1 version and the netcdf-fortran-4.2version.
Anyway I guess my mistake is in here, I configured netcdf-4.2.1.1 with this:
./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap --disable-dap-remote-tests
and configured netcdf-fortran-4.2 with:
CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
instead of this sintax:
CC=gcc FC=gfortran LIBS="$(nf-config --libs)" CPPFLAGS="-I$(nf-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
As Kate once suggested in thread 2766
I´m going to try this last sintax and see what happen
Thanks in advance
Your configure command for building netcdf-fortran was fine. As far as I can tell, you have built & installed it with no problems. Your problem is that the information about the netcdf-fortran configuration is not being passed properly to ROMS.
Re nc-config & nf-config, nc-config is created when netcdf is built and it is installed in ${prefix}/bin (where prefix in your case is /usr/local). It is available to any application that wants to call the netcdf C library. Then you build netcdf-fortran: the cleanest way to tell the configure command where to find everything is with nc-config, hence the form of the configure command that I recommended. The netcdf-fortran build process creates its own counterpart to nc-config, called nf-config, and likewise installs it in ${prefix}/bin. That's not the command you want when building netcdf-fortran, because the first time you build netcdf-fortran it doesn't exist.
The ROMS build process needs to know how to link to netcdf-fortran and for that the most elegant way is to call the appropriate configuration command, which in your case is nf-config (but see below). This is what should happen if you define USE_NETCDF4 (which can be done just by creating an environment variable in build.bash). Then the following line in the platform-specific make file comes into play
Code: Select all
NC_CONFIG ?= nc-config
Code: Select all
export NC_CONFIG=nf-config
Code: Select all
export NC_CONFIG=/usr/local/bin/nf-config
Code: Select all
export PATH=/usr/local/bin:$PATH
IMHO ensuring the nf-config command you want is on your path is the best solution.
I hope that's clear enough; now I'm going to confuse things again. Why is the ROMS default nc-config, when nf-config is the right command? Because until recently (version 4.2.x) the netCDF C and Fortran libraries were not separate and there was no nf-config. But here's the clever and rather confusing thing: in the very latest version of netcdf-fortran, the nf-config script is still created & installed as I've described, but the pre-existing nc-config is also modified so that it knows where to find the Fortran stuff. (I've included output from nc-config and nf-config on my system at the bottom of this post to demonstrate.) Clever, though a bit dodgy in my opinion. So which to use? I would suggest nf-config if you have it and nc-config if you don't.
Code: Select all
$ nf-config --all
This netCDF-Fortran 4.2 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/include -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF-Fortran 4.2
$ nc-config --all
This netCDF 4.2.1.1 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes
--has-dap -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-pnetcdf-> no
--has-szlib ->
--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF 4.2.1.1
Re: Compile ROMS problem via cygwin
I think Mark's suggestion about adding the -lnetcdff library might have gotten lost in the noise. You have to do that.
Here is my CYGWIN-gfortran.mk file, which I keep in ../my_ROMS_compilers. I point to that directory in by build.bash file, with:
CYGWIN-gfortran.mk:
Here is my CYGWIN-gfortran.mk file, which I keep in ../my_ROMS_compilers. I point to that directory in by build.bash file, with:
Code: Select all
export MY_ROMS_COMPILER=/home/csherwood/src/my_ROMS_compilers
Code: Select all
# svn $Id: CYGWIN-gfortran.mk 655 2008-07-25 18:57:05Z arango $
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Copyright (c) 2002-2010 The ROMS/TOMS Group :::
# Licensed under a MIT/X style license :::
# See License_ROMS.txt :::
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# Include file for GNU g95 on Cygwin (actually gfortran - CRS)
# -------------------------------------------------------------------------
#
# ARPACK_LIBDIR ARPACK libary directory
# FC Name of the fortran compiler to use
# FFLAGS Flags to the fortran compiler
# CPP Name of the C-preprocessor
# CPPFLAGS Flags to the C-preprocessor
# NETCDF_INCDIR NetCDF include directory
# NETCDF_LIBDIR NetCDF libary directory
# LD Program to load the objects into an executable
# LDFLAGS Flags to the loader
# RANLIB Name of ranlib command
# MDEPFLAGS Flags for sfmakedepend (-s if you keep .f files)
#
# First the defaults
#
BIN := $(BIN).exe
FC := gfortran
FFLAGS := -frepack-arrays
CPP := /usr/bin/cpp
CPPFLAGS := -P -traditional
LDFLAGS :=
AR := ar
ARFLAGS := -r
MKDIR := mkdir -p
RM := rm -f
RANLIB := ranlib
PERL := perl
TEST := test
MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)
#
# Library locations, can be overridden by environment variables.
#
ifdef USE_NETCDF4
NETCDF_INCDIR ?= /usr/local/netcdf4/include
NETCDF_LIBDIR ?= /usr/local/netcdf4/lib
HDF5_LIBDIR ?= /usr/local/lib
CURL_LIBDIR ?= /usr/local/lib
else
NETCDF_INCDIR ?= /usr/local/include
NETCDF_LIBDIR ?= /usr/local/lib
endif
LIBS := -L$(NETCDF_LIBDIR) -lnetcdff -lnetcdf
ifdef USE_NETCDF4
LIBS += -L$(HDF5_LIBDIR) -lhdf5_hl -lhdf5 -lz -L$(CURL_LIBDIR) -lcurl
endif
ifdef USE_ARPACK
ARPACK_LIBDIR ?= /usr/local/lib
LIBS += -L$(ARPACK_LIBDIR) -larpack
endif
ifdef USE_MPI
CPPFLAGS += -DMPI
ifdef USE_MPIF90
FC := mpif90
ifdef USE_DEBUG
FFLAGS += -mpe=mpicheck
endif
else
# MPI without mpif90 is not currently supported
endif
endif
ifdef USE_OpenMP
CPPFLAGS += -D_OPENMP
FFLAGS += -fopenmp
endif
ifdef USE_DEBUG
FFLAGS += -g -fbounds-check -fbacktrace
else
FFLAGS += -O3 -ffast-math
endif
ifdef USE_MCT
MCT_INCDIR ?= /usr/local/include
MCT_LIBDIR ?= /usr/local/lib
FFLAGS += -I$(MCT_INCDIR)
LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
endif
ifdef USE_ESMF
ESMF_SUBDIR := $(ESMF_OS).$(ESMF_COMPILER).$(ESMF_ABI).$(ESMF_COMM).$(ESMF_SITE)
ESMF_MK_DIR ?= $(ESMF_DIR)/lib/lib$(ESMF_BOPT)/$(ESMF_SUBDIR)
include $(ESMF_MK_DIR)/esmf.mk
FFLAGS += $(ESMF_F90COMPILEPATHS)
LIBS += $(ESMF_F90LINKPATHS) -lesmf -lC
endif
ifdef USE_WRF
FFLAGS += -I$(MCT_INCDIR)
LIBS += -L$(MCT_LIBDIR) -lmct -lmpeu
LIBS += WRF/main/module_wrf_top.o
LIBS += WRF/main/libwrflib.a
LIBS += WRF/external/fftpack/fftpack5/libfftpack.a
LIBS += WRF/external/io_grib1/libio_grib1.a
LIBS += WRF/external/io_grib_share/libio_grib_share.a
LIBS += WRF/external/io_int/libwrfio_int.a
LIBS += WRF/external/esmf_time_f90/libesmf_time.a
LIBS += WRF/external/RSL_LITE/librsl_lite.a
LIBS += WRF/frame/module_internal_header_util.o
LIBS += WRF/frame/pack_utils.o
LIBS += WRF/external/io_netcdf/libwrfio_nf.a
# LIBS += WRF/external/io_netcdf/wrf_io.o
endif
#
# Use full path of compiler.
#
FC := $(shell which ${FC})
LD := $(FC)
#
# Turn off bounds checking for function def_var, as "dimension(*)"
# declarations confuse Gnu Fortran 95 bounds-checking code.
#
$(SCRATCH_DIR)/def_var.o: FFLAGS += -fno-bounds-check
#
# Allow integer overflow in ran_state.F. This is not allowed
# during -O3 optimization. This option should be applied only for
# Gfortran versions >= 4.2.
#
FC_TEST := $(findstring $(shell ${FC} --version | head -1 | cut -d " " -f 5 | \
cut -d "." -f 1-2),4.0 4.1)
ifeq "${FC_TEST}" ""
$(SCRATCH_DIR)/ran_state.o: FFLAGS += -fno-strict-overflow
endif
#
# Set free form format in source files to allow long string for
# local directory and compilation flags inside the code.
#
$(SCRATCH_DIR)/mod_ncparam.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/mod_strings.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/analytical.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/biology.o: FFLAGS += -ffree-form -ffree-line-length-none
ifdef USE_ADJOINT
$(SCRATCH_DIR)/ad_biology.o: FFLAGS += -ffree-form -ffree-line-length-none
endif
ifdef USE_REPRESENTER
$(SCRATCH_DIR)/rp_biology.o: FFLAGS += -ffree-form -ffree-line-length-none
endif
ifdef USE_TANGENT
$(SCRATCH_DIR)/tl_biology.o: FFLAGS += -ffree-form -ffree-line-length-none
endif
#
# Supress free format in SWAN source files since there are comments
# beyond column 72.
#
ifdef USE_SWAN
$(SCRATCH_DIR)/ocpcre.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/ocpids.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/ocpmix.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom3.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom4.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swancom5.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanmain.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanout1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanout2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanparll.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanpre1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanpre2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swanser.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swmod1.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/swmod2.o: FFLAGS += -ffixed-form
$(SCRATCH_DIR)/m_constants.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/m_fileio.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/mod_xnl4v5.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/serv_xnl4v5.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanBpntlist.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanCheckGrid.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanCompdata.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanCompUnstruc.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanComputeForce.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanConvAccur.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanConvStopc.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanCreateEdges.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanCrossObstacle.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanDiffPar.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanDispParm.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanFindObstacles.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanFindPoint.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGridCell.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGriddata.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGridFace.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGridobjects.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGridTopology.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGridVert.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanGSECorr.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanInitCompGrid.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanInterpolateAc.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanInterpolateOutput.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanInterpolatePoint.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanIntgratSpc.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanPointinMesh.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanPrepComp.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanPrintGridInfo.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanPropvelS.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanPropvelX.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanReadADCGrid.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanReadEasymeshGrid.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanReadGrid.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanReadTriangleGrid.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanSweepSel.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanThreadBounds.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanTranspAc.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanTranspX.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/SwanVertlist.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/waves_control.o: FFLAGS += -ffree-form -ffree-line-length-none
$(SCRATCH_DIR)/waves_coupler.o: FFLAGS += -ffree-form -ffree-line-length-none
endif
Chris Sherwood, USGS
1 508 457 2269
1 508 457 2269
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
You can let nc-config(*) do that. You just need to ensure that nc-config is on the path and that USE_NETCDF4 is defined. Then the following lines (from the current CYGWIN_gfortran.mk) come into play:csherwood wrote:I think Mark's suggestion about adding the -lnetcdff library might have gotten lost in the noise. You have to do that.
Code: Select all
ifdef USE_NETCDF4
NC_CONFIG ?= nc-config
NETCDF_INCDIR ?= $(shell $(NC_CONFIG) --prefix)/include
LIBS := $(shell $(NC_CONFIG) --flibs)
else
NETCDF_INCDIR ?= /usr/local/include
NETCDF_LIBDIR ?= /usr/local/lib
LIBS := -L$(NETCDF_LIBDIR) -lnetcdf
endif
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Mark & Chris
Well I did not try the nf-config for the nc-config, as You suggested.
In here I include my $nf-config --all, which is:
and my $ nc-config --all:
As far as I can see, there are no differences with those of yours Mark.
About my CYGWIN-gfortran.mk file here I send it as a word file.
I found some differences compared with the CYGWIN-gfortran of Chris
I hope You can help me
Well I did not try the nf-config for the nc-config, as You suggested.
In here I include my $nf-config --all, which is:
Code: Select all
$ nf-config --all
This netCDF-Fortran 4.2 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/include -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF-Fortran 4.2
Code: Select all
$ nc-config --all
This netCDF 4.2.1.1 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes
--has-dap -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-pnetcdf-> no
--has-szlib ->
--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF 4.2.1.1
About my CYGWIN-gfortran.mk file here I send it as a word file.
I found some differences compared with the CYGWIN-gfortran of Chris
I hope You can help me
- Attachments
-
- myCYGWIN-gfortran.mk.docx
- (13.66 KiB) Downloaded 521 times
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
Hi Leo
That's all as I expected. See the string that is returned by "nc-config --flibs" or "nf-config --flibs":
The ROMS build process needs to incorporate that string in the command used to link the ROMS executable. At the moment (judging from the error output you gave several posts back) it's not doing so. It's just using this:
So the linker can't find the netCDF Fortran routines (which would be brought in via "-lnetcdff"), not to mention the hdf5, curl and zlib routines.
The problem is that you're not defining USE_NETCDF4 before calling make. You can do so with a line like this in build.bash:
There may be one in there already that's commented out. Just delete the "#' at the start of the line.
Mark
That's all as I expected. See the string that is returned by "nc-config --flibs" or "nf-config --flibs":
Code: Select all
-L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
Code: Select all
-L/usr/local/lib -lnetcdf
The problem is that you're not defining USE_NETCDF4 before calling make. You can do so with a line like this in build.bash:
Code: Select all
export USE_NETCDF4=on
Mark
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello Mark
I´m a little confuse, jaja
Here is the build.bash script of mine as I already have it, in here I have highlighted the export NC_CONFIG= lines I have found.
Are those lines the ones that You suggest to change for: export NC_CONFIG=nf-config or export NC_CONFIG=/usr/local/bin/nf-config?
Also I have found the lines with the export PATH= text. Are those lines the ones to be change for: export PATH=/usr/local/bin:$PATH?
Thanks in advance for Your help
I´m a little confuse, jaja
Here is the build.bash script of mine as I already have it, in here I have highlighted the export NC_CONFIG= lines I have found.
Are those lines the ones that You suggest to change for: export NC_CONFIG=nf-config or export NC_CONFIG=/usr/local/bin/nf-config?
Also I have found the lines with the export PATH= text. Are those lines the ones to be change for: export PATH=/usr/local/bin:$PATH?
Thanks in advance for Your help
Code: Select all
#!/bin/bash
#
# svn $Id: build.bash 641 2012-12-19 21:51:03Z arango $
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Copyright (c) 2002-2012 The ROMS/TOMS Group :::
# Licensed under a MIT/X style license :::
# See License_ROMS.txt :::
#::::::::::::::::::::::::::::::::::::::::::::::::::::: Hernan G. Arango :::
# :::
# ROMS/TOMS Compiling Script :::
# :::
# Script to compile an user application where the application-specific :::
# files are kept separate from the ROMS source code. :::
# :::
# Q: How/why does this script work? :::
# :::
# A: The ROMS makefile configures user-defined options with a set of :::
# flags such as ROMS_APPLICATION. Browse the makefile to see these. :::
# If an option in the makefile uses the syntax ?= in setting the :::
# default, this means that make will check whether an environment :::
# variable by that name is set in the shell that calls make. If so :::
# the environment variable value overrides the default (and the :::
# user need not maintain separate makefiles, or frequently edit :::
# the makefile, to run separate applications). :::
# :::
# Usage: :::
# :::
# ./build.bash [options] :::
# :::
# Options: :::
# :::
# -j [N] Compile in parallel using N CPUs :::
# omit argument for all available CPUs :::
# -noclean Do not clean already compiled objects :::
# :::
# Notice that sometimes the parallel compilation fail to find MPI :::
# include file "mpif.h". :::
# :::
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
parallel=0
clean=1
while [ $# -gt 0 ]
do
case "$1" in
-j )
shift
parallel=1
test=`echo $1 | grep '^[0-9]\+$'`
if [ "$test" != "" ]; then
NCPUS="-j $1"
shift
else
NCPUS="-j"
fi
;;
-noclean )
shift
clean=0
;;
* )
echo ""
echo "$0 : Unknown option [ $1 ]"
echo ""
echo "Available Options:"
echo ""
echo "-j [N] Compile in parallel using N CPUs"
echo " omit argument for all avaliable CPUs"
echo "-noclean Do not clean already compiled objects"
echo ""
exit 1
;;
esac
done
# Set the CPP option defining the particular application. This will
# determine the name of the ".h" header file with the application
# CPP definitions.
export ROMS_APPLICATION=UPWELLING
# Set a local environmental variable to define the path to the directories
# where all this project's files are kept.
export MY_ROOT_DIR=/home/Usuario/roms
export MY_PROJECT_DIR=${MY_ROOT_DIR}/Projects/Upwelling
# The path to the user's local current ROMS source code.
#
# If using svn locally, this would be the user's Working Copy Path (WCPATH).
# Note that one advantage of maintaining your source code locally with svn
# is that when working simultaneously on multiple machines (e.g. a local
# workstation, a local cluster and a remote supercomputer) you can checkout
# the latest release and always get an up-to-date customized source on each
# machine. This script is designed to more easily allow for differing paths
# to the code and inputs on differing machines.
#export MY_ROMS_SRC=${MY_ROOT_DIR}/branches/arango
export MY_ROMS_SRC=${MY_ROOT_DIR}/trunk
# Set path of the directory containing makefile configuration (*.mk) files.
# The user has the option to specify a customized version of these files
# in a different directory than the one distributed with the source code,
# ${MY_ROMS_SRC}/Compilers. If this is the case, the you need to keep
# these configurations files up-to-date.
export COMPILERS=${MY_ROMS_SRC}/Compilers
#export COMPILERS=${HOME}/Compilers
# Set tunable CPP options.
#
# Sometimes it is desirable to activate one or more CPP options to run
# different variants of the same application without modifying its header
# file. If this is the case, specify each options here using the -D syntax.
# Notice also that you need to use shell's quoting syntax to enclose the
# definition. Both single or double quotes work. For example,
#
#export MY_CPP_FLAGS="-DAVERAGES"
#export MY_CPP_FLAGS="${MY_CPP_FLAGS} -DDEBUGGING"
#
# can be used to write time-averaged fields. Notice that you can have as
# many definitions as you want by appending values.
#export MY_CPP_FLAGS="-D"
# Other user defined environmental variables. See the ROMS makefile for
# details on other options the user might want to set here. Be sure to
# leave the switches meant to be off set to an empty string or commented
# out. Any string value (including off) will evaluate to TRUE in
# conditional if-statements.
export USE_MPI= # distributed-memory parallelism
export USE_MPIF90= # compile with mpif90 script
#export which_MPI=mpich # compile with MPICH library
#export which_MPI=mpich2 # compile with MPICH2 library
export which_MPI=openmpi # compile with OpenMPI library
#export USE_OpenMP=on # shared-memory parallelism
export FORT=ifort
export FORT=gfortran
#export FORT=pgi
#export USE_DEBUG=on # use Fortran debugging flags
export USE_LARGE=on # activate 64-bit compilation
export USE_NETCDF4=on # compile with NetCDF-4 library
#export USE_PARALLEL_IO=on # Parallel I/O with Netcdf-4/HDF5
export USE_MY_LIBS=on # use my library paths below
# There are several MPI libraries available. Here, we set the desired
# "mpif90" script to use during compilation. This only works if the make
# configuration file (say, Linux-pgi.mk) in the "Compilers" directory
# has the following definition for FC (Fortran Compiler) in the USE_MPI
# section:
#
# FC := mpif90
#
# that is, "mpif90" defined without any path. Notice that the path
# where the MPI library is installed is computer dependent. Recall
# that you still need to use the appropriate "mpirun" to execute.
if [ -n "${USE_MPIF90:+1}" ]; then
case "$FORT" in
ifort )
if [ "${which_MPI}" = "mpich" ]; then
[color=#BF0000]export PATH=/opt/intelsoft/mpich/bin:$PATH[/color]
elif [ "${which_MPI}" = "mpich2" ]; then
[color=#BF0000]export PATH=/opt/intelsoft/mpich2/bin:$PATH[/color]
elif [ "${which_MPI}" = "openmpi" ]; then
[color=#BF0000]export PATH=/opt/intelsoft/openmpi/bin:$PATH[/color]
fi
;;
pgi )
if [ "${which_MPI}" = "mpich" ]; then
[color=#BF0000]export PATH=/opt/pgisoft/mpich/bin:$PATH[/color]
elif [ "${which_MPI}" = "mpich2" ]; then
[color=#BF0000]export PATH=/opt/pgisoft/mpich2/bin:$PATH[/color]
elif [ "${which_MPI}" = "openmpi" ]; then
[color=#BF0000]export PATH=/opt/pgisoft/openmpi/bin:$PATH[/color]
fi
;;
gfortran )
if [ "${which_MPI}" = "mpich2" ]; then
[color=#BF0000]export PATH=/opt/gfortransoft/mpich2/bin:$PATH[/color]
elif [ "${which_MPI}" = "openmpi" ]; then
[color=#BF0000]export PATH=/opt/gfortransoft/openmpi/bin:$PATH[/color]
fi
;;
esac
fi
# If the USE_MY_LIBS is activated above, the path of the libraries
# required by ROMS can be set here using environmental variables
# which take precedence to the values specified in the make macro
# definitions file (Compilers/*.mk). For most applications, only
# the location of the NetCDF library is needed during compilation.
#
# Notice that when the USE_NETCDF4 macro is activated, we need the
# serial or parallel version of the NetCDF-4/HDF5 library. The
# configuration script NC_CONFIG (available since NetCDF 4.0.1)
# is used to set up all the required libraries according to the
# installed options (openDAP, netCDF4/HDF5 file format). The
# parallel library uses the MPI-I/O layer (usually available
# in MPICH2 and OpenMPI) requiring compiling with the selected
# MPI library.
#
# In ROMS distributed-memory applications, you may use either the
# serial or parallel version of the NetCDF-4/HDF5 library. The
# parallel version is required when parallel I/O is activated
# (ROMS cpp option PARALLEL_IO and HDF5).
#
# However, in serial or shared-memory ROMS applications, we need
# to use the serial version of the NetCDF-4/HDF5 to avoid conflicts
# with the compiler. We cannot activate MPI constructs in serial
# or shared-memory ROMS code. Hybrid parallelism is not possible.
#
# Recall also that the MPI library comes in several flavors:
# MPICH, MPICH2, OpenMPI, etc.
if [ -n "${USE_MY_LIBS:+1}" ]; then
case "$FORT" in
ifort )
export ESMF_OS=Linux
export ESMF_COMPILER=ifort
export ESMF_BOPT=O
export ESMF_ABI=64
export ESMF_COMM=mpich
export ESMF_SITE=default
export ARPACK_LIBDIR=/opt/intelsoft/serial/ARPACK
if [ -n "${USE_MPI:+1}" ]; then
if [ "${which_MPI}" = "mpich" ]; then
export ESMF_DIR=/opt/intelsoft/mpich/esmf
export MCT_INCDIR=/opt/intelsoft/mpich/mct/include
export MCT_LIBDIR=/opt/intelsoft/mpich/mct/lib
export PARPACK_LIBDIR=/opt/intelsoft/mpich/PARPACK
elif [ "${which_MPI}" = "mpich2" ]; then
export ESMF_DIR=/opt/intelsoft/mpich2/esmf
export MCT_INCDIR=/opt/intelsoft/mpich2/mct/include
export MCT_LIBDIR=/opt/intelsoft/mpich2/mct/lib
export PARPACK_LIBDIR=/opt/intelsoft/mpich2/PARPACK
elif [ "${which_MPI}" = "openmpi" ]; then
export ESMF_DIR=/opt/intelsoft/openmpi/esmf
export MCT_INCDIR=/opt/intelsoft/openmpi/mct/include
export MCT_LIBDIR=/opt/intelsoft/openmpi/mct/lib
export PARPACK_LIBDIR=/opt/intelsoft/openmpi/PARPACK
fi
fi
if [ -n "${USE_NETCDF4:+1}" ]; then
if [ -n "${USE_PARALLEL_IO:+1}" ] && [ -n "${USE_MPI:+1}" ]; then
if [ "${which_MPI}" = "mpich" ]; then
[color=#0040BF]export NC_CONFIG=/opt/intelsoft/mpich/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/intelsoft/mpich/netcdf4/include
elif [ "${which_MPI}" = "mpich2" ]; then
[color=#0040BF]export NC_CONFIG=/opt/intelsoft/mpich2/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/intelsoft/mpich2/netcdf4/include
elif [ "${which_MPI}" = "openmpi" ]; then
[color=#0040BF]export NC_CONFIG=/opt/intelsoft/openmpi/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/intelsoft/openmpi/netcdf4/include
fi
else
[color=#0040BF]export NC_CONFIG=/opt/intelsoft/serial/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/intelsoft/serial/netcdf4/include
fi
else
export NETCDF_INCDIR=/opt/intelsoft/serial/netcdf3/include
export NETCDF_LIBDIR=/opt/intelsoft/serial/netcdf3/lib
fi
;;
pgi )
export ESMF_OS=Linux
export ESMF_COMPILER=pgi
export ESMF_BOPT=O
export ESMF_ABI=64
export ESMF_COMM=mpich
export ESMF_SITE=default
export ARPACK_LIBDIR=/opt/pgisoft/serial/ARPACK
if [ -n "${USE_MPI:+1}" ]; then
if [ "${which_MPI}" = "mpich" ]; then
export ESMF_DIR=/opt/pgisoft/mpich/esmf
export MCT_INCDIR=/opt/pgisoft/mpich/mct/include
export MCT_LIBDIR=/opt/pgisoft/mpich/mct/lib
export PARPACK_LIBDIR=/opt/pgisoft/mpich/PARPACK
elif [ "${which_MPI}" = "mpich2" ]; then
export ESMF_DIR=/opt/pgisoft/mpich2/esmf
export MCT_INCDIR=/opt/pgisoft/mpich2/mct/include
export MCT_LIBDIR=/opt/pgisoft/mpich2/mct/lib
export PARPACK_LIBDIR=/opt/pgisoft/mpich2/PARPACK
elif [ "${which_MPI}" = "openmpi" ]; then
export ESMF_DIR=/opt/pgisoft/openmpi/esmf
export MCT_INCDIR=/opt/pgisoft/openmpi/mct/include
export MCT_LIBDIR=/opt/pgisoft/openmpi/mct/lib
export PARPACK_LIBDIR=/opt/pgisoft/openmpi/PARPACK
fi
fi
if [ -n "${USE_NETCDF4:+1}" ]; then
if [ -n "${USE_PARALLEL_IO:+1}" ] && [ -n "${USE_MPI:+1}" ]; then
if [ "${which_MPI}" = "mpich" ]; then
[color=#0040BF]export NC_CONFIG=/opt/pgisoft/mpich/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/pgisoft/mpich/netcdf4/include
elif [ "${which_MPI}" = "mpich2" ]; then
[color=#0040BF]export NC_CONFIG=/opt/pgisoft/mpich2/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/pgisoft/mpich2/netcdf4/include
elif [ "${which_MPI}" = "openmpi" ]; then
[color=#0040BF]export NC_CONFIG=/opt/pgisoft/openmpi/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/pgisoft/openmpi/netcdf4/include
fi
else
[color=#0040BF]export NC_CONFIG=/opt/pgisoft/serial/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/pgisoft/serial/netcdf4/include
fi
else
export NETCDF_INCDIR=/opt/pgisoft/serial/netcdf3/include
export NETCDF_LIBDIR=/opt/pgisoft/serial/netcdf3/lib
fi
;;
gfortran )
export ESMF_OS=Linux
export ESMF_COMPILER=gfortran
export ESMF_BOPT=O
export ESMF_ABI=64
export ESMF_COMM=mpich
export ESMF_SITE=default
export ARPACK_LIBDIR=/opt/gfortransoft/serial/ARPACK
if [ -n "${USE_MPI:+1}" ]; then
if [ "${which_MPI}" = "mpich2" ]; then
export ESMF_DIR=/opt/gfortransoft/mpich2/esmf
export MCT_INCDIR=/opt/gfortransoft/mpich2/mct/include
export MCT_LIBDIR=/opt/gfortransoft/mpich2/mct/lib
export PARPACK_LIBDIR=/opt/gfortransoft/mpich2/PARPACK
elif [ "${which_MPI}" = "openmpi" ]; then
export ESMF_DIR=/opt/gfortransoft/openmpi/esmf
export MCT_INCDIR=/opt/gfortransoft/openmpi/mct/include
export MCT_LIBDIR=/opt/gfortransoft/openmpi/mct/lib
export PARPACK_LIBDIR=/opt/gfortransoft/openmpi/PARPACK
fi
fi
if [ -n "${USE_NETCDF4:+1}" ]; then
if [ -n "${USE_PARALLEL_IO:+1}" ] && [ -n "${USE_MPI:+1}" ]; then
if [ "${which_MPI}" = "mpich2" ]; then
[color=#0040BF]export NC_CONFIG=/opt/gfortransoft/mpich2/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/gfortransoft/mpich2/netcdf4/include
elif [ "${which_MPI}" = "openmpi" ]; then
[color=#0040BF]export NC_CONFIG=/opt/gfortransoft/openmpi/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/gfortransoft/openmpi/netcdf4/include
fi
else
[color=#0040BF]export NC_CONFIG=/opt/gfortransoft/serial/netcdf4/bin/nc-config[/color]
export NETCDF_INCDIR=/opt/gfortransoft/serial/netcdf4/include
fi
else
export NETCDF_INCDIR=/usr/local/include
export NETCDF_LIBDIR=/usr/local/lib
fi
;;
esac
fi
# The rest of this script sets the path to the users header file and
# analytical source files, if any. See the templates in User/Functionals.
#
# If applicable, use the MY_ANALYTICAL_DIR directory to place your
# customized biology model header file (like fennel.h, nemuro.h, ecosim.h,
# etc).
export MY_HEADER_DIR=${MY_PROJECT_DIR}
export MY_ANALYTICAL_DIR=${MY_PROJECT_DIR}
# Put the binary to execute in the following directory.
export BINDIR=${MY_PROJECT_DIR}
# Put the f90 files in a project specific Build directory to avoid conflict
# with other projects.
export SCRATCH_DIR=${MY_PROJECT_DIR}/Build
# Go to the users source directory to compile. The options set above will
# pick up the application-specific code from the appropriate place.
cd ${MY_ROMS_SRC}
# Remove build directory.
if [ $clean -eq 1 ]; then
make clean
fi
# Compile (the binary will go to BINDIR set above).
if [ $parallel -eq 1 ]; then
make $NCPUS
else
make
fi
Re: Compile ROMS problem via cygwin
You have selected both ifort and gfortran, but gfortran is second and overwrites the other. The instances of NC_CONFIG you need to focus on are in the gfortran section. You aren't doing parallel I/O, so it's this one:export FORT=ifort
export FORT=gfortran
export NC_CONFIG=/opt/gfortransoft/serial/netcdf4/bin/nc-config
- arango
- Site Admin
- Posts: 1361
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: Compile ROMS problem via cygwin
This stuff in the build.bash script is trivial. It is well documented in the script. Several environmental variables are defined and used temporarily in the bash session to pass those values to the respective compilation macro *.mk in Compilers. The build script provides you an interface to customize all these directory paths. You do not need to modify either the makefile or the compilation macros. These paths are different in everybody's computer. The values in the distributed scripts are for our system and are given as an example. It is impossible for us to guess the directories where everybody installed all the libraries needed by ROMS.
Notice that the temporary variable NC_CONFIG is the full path where nc-config is, if not already in your PATH. If that directory is already in global PATH, it is not necessary to put the full path. But it does not matter if you specify the full path. It is the safest way and give you full control and you don't need to change PATH. This is convenient if you have more than one Fortran compiler or several versions of the NetCDF library It is that simple It seems to me that you need to learn basic Unix and check how the environmental variables work.
Notice that the temporary variable NC_CONFIG is the full path where nc-config is, if not already in your PATH. If that directory is already in global PATH, it is not necessary to put the full path. But it does not matter if you specify the full path. It is the safest way and give you full control and you don't need to change PATH. This is convenient if you have more than one Fortran compiler or several versions of the NetCDF library It is that simple It seems to me that you need to learn basic Unix and check how the environmental variables work.
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Kate and Hernan
Thank You for you advice, i´m going to check that out and be more careful.
Any good site for basic unix learning?
Leo
Thank You for you advice, i´m going to check that out and be more careful.
Any good site for basic unix learning?
Leo
-
- Posts: 34
- Joined: Tue Jan 22, 2013 5:28 pm
- Location: University of Delaware
Re: Compile ROMS problem via cygwin
Hi, lalvarez
Did you ever manage to correct this linking problem and get ROMS to compile?
I'm just a beginner and I've just run up on the same issue. Not really sure where to begin.
Upon, entering the build.bash command I got the same compilation ending in the error. (Which I believe is the same bit at the end which you received.
Did you ever manage to correct this linking problem and get ROMS to compile?
I'm just a beginner and I've just run up on the same issue. Not really sure where to begin.
Upon, entering the build.bash command I got the same compilation ending in the error. (Which I believe is the same bit at the end which you received.
Code: Select all
/home/Robert/software/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o):lbc.f90:(.text+0x2279): undefined reference to `___netcdf_MOD_nf90_get_att_text'
/home/Robert/software/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o):lbc.f90:(.text+0x2d6f): undefined reference to `___netcdf_MOD_nf90_put_att_text'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /home/Robert/software/roms/Projects/Upwelling/Build/libUTIL.a(lbc.o): bad reloc address 0x48c in section `.rdata'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status
Master/Module.mk:22: recipe for target `/home/Robert/software/roms/Projects/Upwelling/oceanS.exe' failed
make: *** [/home/Robert/software/roms/Projects/Upwelling/oceanS.exe] Error 1
- m.hadfield
- Posts: 521
- Joined: Tue Jul 01, 2003 4:12 am
- Location: NIWA
Re: Compile ROMS problem via cygwin
Hi robjenkinsiii
You could begin by reading all the posts in this thread.
The linker is failing to find a netCDF Fortran routine, probably because the linker command is lacking a "-lnetcdff", and the most likely reason for that is that you have netcdf-4.x installed but have failed to define USE_NETCDF4 in build.bash.
If you want further help with this, please give the linker command that produced this error and describe your netCDF installation (what version? where installed? does the command "nc-config" work in the shell?).
Mark
You could begin by reading all the posts in this thread.
The linker is failing to find a netCDF Fortran routine, probably because the linker command is lacking a "-lnetcdff", and the most likely reason for that is that you have netcdf-4.x installed but have failed to define USE_NETCDF4 in build.bash.
If you want further help with this, please give the linker command that produced this error and describe your netCDF installation (what version? where installed? does the command "nc-config" work in the shell?).
Mark
-
- Posts: 106
- Joined: Wed Feb 03, 2010 6:59 pm
- Location: Universidad Autonoma de Baja California Sur
Re: Compile ROMS problem via cygwin
Hello robjenkinsiii
I´m enclosing here my build.bash file, You have to look where the shaded rows are, perhaps that´s the problem, as Mark says
Have a nice day
I´m enclosing here my build.bash file, You have to look where the shaded rows are, perhaps that´s the problem, as Mark says
The trick in here is "where things are, and that's your directories"You could begin by reading all the posts in this thread.
The linker is failing to find a netCDF Fortran routine, probably because the linker command is lacking a "-lnetcdff", and the most likely reason for that is that you have netcdf-4.x installed but have failed to define USE_NETCDF4 in build.bash.
If you want further help with this, please give the linker command that produced this error and describe your netCDF installation (what version? where installed? does the command "nc-config" work in the shell?).
Mark
Have a nice day
- Attachments
-
- buildX.txt
- (17.02 KiB) Downloaded 505 times