compile ROMS error

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

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

compile ROMS error

#1 Unread 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/Module.mk:15: recipe for target 'Build/mod_kinds.o' failed
make: *** [Build/mod_kinds.o] Error 127


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

robertson
Site Admin
Posts: 227
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: compile ROMS error

#2 Unread 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.

try:

which gfortran

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

Dave

ckers

Re: compile ROMS error

#3 Unread 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
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: compile ROMS error

#4 Unread 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.

ckers

Re: compile ROMS error

#5 Unread 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/Module.mk:15: 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
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: compile ROMS error

#6 Unread post by arango »

Your problem is that you haven't configured the build_roms.sh and build_roms.bash correctly. For example, notice that in the build_roms.sh 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

set MY_PATHS = ${COMPILERS}/my_build_paths.sh

if ($USE_MY_LIBS == 'yes') then
  source ${MY_PATHS} ${MY_PATHS}
endif
If you set USE_MY_LIBS it to yes, then you need to modify source code root file Complilers/my_build_paths.sh 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 build_roms.sh, 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.

cls95

Re: compile ROMS error

#7 Unread 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
and

Code: Select all

#export USE_MY_LIBS=no            # use system default library paths
 export USE_MY_LIBS=yes           # use my customized library paths
MY_PATHS=${COMPILERS}/my_build_paths.bash
in the build_roms.bash file.

At the bottom, I get:

Code: Select all

collect2: error: ld returned 1 exit status
make: *** [Master/Module.mk:22: /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 CYGWIN-gfortran.mk 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!
Carlos.

tongyaop
Posts: 7
Joined: Tue Feb 15, 2022 8:59 pm
Location: University of Minnesota

Re: compile ROMS error

#8 Unread post by tongyaop »

I received the same error but I am able to address it through editing both the build_roms.sh and the linked my_build_paths.sh. Now I am able to build the model. I am new to this as well and I am still confused on how different compilers work, but this is what I have, hopefully it will be helpful to some of you.

Firstly, in the build_roms.sh I tuned based on what I have on my computer

Code: Select all

export	USE_MPIF90=on            # compile with mpif90 script
export	FORT=gfortran

export	USE_DEBUG=on            # use Fortran debugging flags
export	USE_LARGE=on            # activate 64-bit compilation

export	USE_NETCDF4=on   
I found this slightly confusing, since a lot of tutorials are asking me to do different stuff. I finally decided to use mpif90 and gfortran because I can directly find them with "which" command in my terminal.

Then, I goes to the my_build_path.sh and find that section. Based on what I have in build_roms.sh, in the library section, I went to gfortran ) section, in the singularity command section, use NetCDF4 section, and not using parallel IO (else) section, and edited my path to NetCDF4

Code: Select all

          export	NETCDF=/usr
          export	NF_CONFIG=${NETCDF}/bin/nf-config
          export	NETCDF_INCDIR=${NETCDF}/include
Both my MacOS and Linux has netcdf directory under /usr/bin/ and /usr/include/ so I found the original path document a little bit confusing

Post Reply