compile ROMS error

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Posts: 15
Joined: Thu Apr 05, 2018 6:34 pm
Location: Ha Noi University Sience and Technology, Vietnam

compile ROMS error

#1 Post by thaitlhp »

Hi everyone,i compile ROMS using Ubuntu app,i get trouble:

cd Build; -c -fno-second-underscore -O3 -ffast-math mod_kinds.f90
/bin/sh: 1: -c: not found
ROMS/Modules/ recipe for target 'Build/mod_kinds.o' failed
make: *** [Build/mod_kinds.o] Error 127

please help me :cry: :cry: :cry:

User avatar
Site Admin
Posts: 180
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: compile ROMS error

#2 Post by robertson »

From the flags it appears that you have enabled gfortran but my first guess is that either gfortran is not installed or is not in your path. Most modern Linux distributions have a separate package for the GNU fortran compiler; it no longer comes as part of the gcc package. I believe Ubuntu has many to choose from.


which gfortran

if the full path to your gfortran executable is not returned then you need to install/get gfortran in your path.


Posts: 4
Joined: Mon Apr 29, 2019 8:01 pm
Location: National Taiwan University

Re: compile ROMS error

#3 Post by ckers »

I'm new in ROMS. If I'm sure gfortran is installed, which file should I edit to point to the path. Thanks~

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

Re: compile ROMS error

#4 Post by kate »

From the command line, see what "which gfortran" or "which mpif90" give you. That's what the ROMS build system will execute to find the correct path. If it doesn't come up already, you need to change your user path to point there, perhaps in your ~/.bashrc file or similar. On a supercomputer, it might be something like "module load XXX" where on the system here, XXX is "toolchain/foss/2016b" (foss here stands for free and open source software). You might need to ask a local expert on your computer.

Posts: 4
Joined: Mon Apr 29, 2019 8:01 pm
Location: National Taiwan University

Re: compile ROMS error

#5 Post by ckers »

This is what I've got. Please help me, tks~

ROMS/Bin/cpp_clean /home/njtsai/src/trunk/ROMS/Bin/Build_roms/mod_kinds.f90
cd /home/njtsai/src/trunk/ROMS/Bin/Build_roms; -c -frepack-arrays -O3 -ffast-math mod_kinds.f90
/bin/sh: 1: -c: not found
ROMS/Modules/ recipe for target '/home/njtsai/src/trunk/ROMS/Bin/Build_roms/mod_kinds.o' failed
make: *** [/home/njtsai/src/trunk/ROMS/Bin/Build_roms/mod_kinds.o] Error 127

User avatar
Site Admin
Posts: 1173
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University

Re: compile ROMS error

#6 Post by arango »

Your problem is that you haven't configured the and build_roms.bash correctly. For example, notice that in the script we have:

Code: Select all

# If applicable, use my specified library paths.

 setenv USE_MY_LIBS no           # use system default library paths
#setenv USE_MY_LIBS yes          # use my customized library paths


if ($USE_MY_LIBS == 'yes') then
  source ${MY_PATHS} ${MY_PATHS}
If you set USE_MY_LIBS it to yes, then you need to modify source code root file Complilers/ and edit the appropriate paths for the desired compiler. You need to spend sometime reading and understanding the information provided in the build scripts.

What I recommend to everybody is to have a customized version of these make configuration files in a different directory, say ${HOME}/Compilers/ROMS or any other, to avoid overwriting during svn updates. Notice that in, we have logic for such strategy:

Code: Select all

# 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, you need to keep these
# configurations files up-to-date.

 setenv COMPILERS            ${MY_ROMS_SRC}/Compilers
#setenv COMPILERS            ${HOME}/Compilers/ROMS
If after these suggestions you still have problems, you need to seek help from a computer technician at your institution. There is not much that we can do for you neither have the time for messaging you back.

We are in a profession that requires lots of patience and curiosity. All users of ROMS go through the learning phase by themselves slowly by exploring the code and reading the instructions provided in the Wiki. ROMS is not a black box, and some knowledge of the computer environment, Unix, compilers, and ocean modeling is required. There are several examples of ROMS configuration in the test repository. See the ROMA Wiki for more information.


Re: compile ROMS error

#7 Post by cls95 »

Hi! I'm new in ROMS and I got several errors while trying to installing it, but I have fixed every one until this last one I got some days ago. It happens while I try to compile ROMS. I have read some other topics but I can't fix it even if I try to follow what you recommended to other people.

I think I get one of the most popular errors, but I can't fix it. It's the one explained in the FAQ section in the wiki.

Code: Select all

/home/keles/roms/Projects/Upwelling/Build_roms/libUTIL.a(close_io.o):close_io.f90:(.text+0x120c): undefined reference to `__netcdf_MOD_nf90_strerror' 
Followed by many, many messages like this one. But after the first one I get:

Code: Select all

/home/keles/roms/Projects/Upwelling/Build_roms/libUTIL.a(close_io.o):close_io.f90:(.text+0x120c): truncated relocation to adjust: R_X86_64_PC32 against the undefined reference to: `__netcdf_MOD_nf90_strerror'
(Sorry if it doesn't make sense, but I got the messages in Spanish and I tried to translate them to the way I supposed they are shown in English)

I have copied build_roms.bash and my_build_paths.bash to the Upwelling folder and customized them changing:

Code: Select all

 export         COMPILERS=/home/keles/roms/Projects/Upwelling

Code: Select all

#export USE_MY_LIBS=no            # use system default library paths
 export USE_MY_LIBS=yes           # use my customized library paths
in the build_roms.bash file.

At the bottom, I get:

Code: Select all

collect2: error: ld returned 1 exit status
make: *** [Master/ /home/keles/roms/Projects/Upwelling/romsS.exe] Error 1
I have also changed in the my_build_paths.bash file:

Code: Select all

      export    NETCDF_INCDIR=/usr/local/include
      export    NETCDF_LIBDIR=/usr/local/lib
Because that is the place I compile NETCDF (both NetCDF C 4.7.0 and NetCDF Fortran 4.4.5). Finally, I have also modified the file to look like:

Code: Select all

    NETCDF_INCDIR ?= /usr/local/include
    NETCDF_LIBDIR ?= /usr/local/lib
      NETCDF_LIBS ?= -lnetcdff -lnetcdf
Do you know if I am missing some step or if I am not doing something in the right way?

Thank you very much for your concern!

Post Reply