The OASIS Coupler Forum

  HOME

question about oasis-mct coupling

Up to Installation and compilation

Posted by Anonymous at November 6 2023

Hello, everyone
  I'm trying to compile and install OASIS-MCT(oasis3-mct-OASIS3-MCT_5.0), but I'm having some problems.I just finished downloading the source code, followed the instructions in Chapter 6 of the manual, switched to the oasis3-MCT/util/make dir directory, and was ready to start compiling, but without doing anything else, I directly typed the command "make -f TopMakefileOasis3 help" into the terminal, and got an error saying " make:***no rule to make target '/home/fvcom/oasis3-mct-OASIS3 MCT_5.0/util/make_dir/make.intel_nemo_lenovo'. stop." Please ask how to solve this problem, by the way, I would like to consult a more detailed compilation steps (my computer is a virtual machine Ubuntu-20.04.6-live-server-amd64, the compiler has gcc, g++, gfortran, Intel oneAPI HPC Toolkit I'm not sure if I need to make a make.intel_nemo_lenovo file and then run the "make -f TopMakefileOasis3 help" command under the location of the file, but I'm not sure if I need to make a make.intel_nemo_lenovo file and then run "make -f TopMakefileOasis3 help" under the location of the file.)
  Hope to hear from you soon!

Posted by Anonymous at November 6 2023

I'm the one who asked the question above.
I've generally found my previous compilation problem, but now I have a new one: when I use the command "make -f TopMakefileOasis3", I get an error saying: Compilation of the OASIS3-MCT static Compilation of the OASIS3-MCT static libraries
Build output to /home/20cl91p02/NEXTGEN/OA/oasis3-mct/util/make_dir/COMP.log
Build errors to /home/20cl91p02/NEXTGEN/OA/oasis3-mct/util/make_dir/COMP.err
gmake[1]: Entering directory '/home/fvcom/oasis3-mct/util/make_dir'
=> Creating directories for compiling the static libraries
   in /home/20cl91p02/NEXTGEN/OA/oasis3_mct_install/build/lib
mkdir: cannot create directory '/home/20cl91p02': Permission denied
gmake[1]: *** [TopMakefileOasis3:143: makedirs-static] Error 1
gmake[1]: Leaving directory '/home/fvcom/oasis3-mct/util/make_dir'
make: *** [TopMakefileOasis3:91: static-libs-fortran] Error 2
The associated COMP.log shows: checking whether the compiler supports GNU Fortran... yes
checking whether /usr/bin/mpif90 -Wall -I/usr/include accepts -g... checking for Fortran flag to compile... yes
checking for Fortran flag to compile .F90 files... F90 files... none
checking for mpif90... yes checking for Fortran flag to compile . /usr/bin/mpif90 -Wall -I/usr/include 
checking for MPI_Init... checking for MPI_Init... yes
checking for mpif.h... yes checking for mpif.h... yes
Checking Compiler Version
checking how to get the version output from /usr/bin/mpif90 -Wall -I/usr/include ... --version
Checking for Fortran flag to compile preprocessed .F files... --version checking for Fortran flag to compile preprocessed .
checking how to define symbols for preprocessed Fortran... -F files... none checking how to define symbols for preprocessed Fortran...
checking build system type... x86_64-pc-linux-gnu
x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu
checking how to get verbose linking output from /usr/bin/mpif90 -Wall -I/usr/include ... -v
checking for Fortran libraries of /usr/bin/mpif90 -Wall -I/usr/include ... -L/usr/lib/mpif90 -Wall -I/usr/include ...  -L/usr/lib/x86_64-linux-gnu/openmpi/lib -L/opt/intel/oneapi/mpi/2021.6.0//libfabric/lib/... /lib -L/opt/intel/oneapi/mpi/2021.6.0//lib/... /lib -L/opt/intel/oneapi/compiler/2022.1.0/linux/lib/... /lib -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/... /... /... /.../.../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/... /.../... /... /... /... /.../.../.../lib -L/lib/x86_64-linux-gnu -L/lib/... /... /... /... /lib -L/lib/x86_64-linux-gnu -L/usr/lib/... /lib -L/opt/intel/oneapi/tbb/2021.6.0/env/... /lib/intel64/gcc4.8 -L/opt/intel/oneapi/mpi/2021.6.0//libfabric/lib -L/opt/intel/oneapi/mpi/2021.6.0//lib/release -L/opt/intel/oneapi /mpi/2021.6.0//lib -L/opt/intel/oneapi/compiler/2022.1.0/linux/compiler/lib/intel64_lin -L/opt/intel/oneapi/compiler/2022.1.0/linux/ lib -L/opt/intel/oneapi/clck/2021.6.0/lib/intel64 -L/usr/lib/gcc/x86_64-linux-gnu/9/... /... /... -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lm -lquadmath -lpthread
checking for dummy main to link with Fortran libraries... checking for dummy main to link with Fortran libraries....
checking for Fortran name-mangling scheme... lower case, underscore, no extra underscore
Hostname=ubuntu
Machine=x86_64
OS=Linux
Fortran Compiler is GNU
checking if Fortran compiler supports allow-mismatch flag... checking if Fortran compiler supports allow-mismatch flag...
checking if Fortran compiler supports mismatch_all flag... no checking if Fortran compiler supports mismatch_all flag.
checking for ranlib... no checking for ranlib... ranlib

Output Variables: {CC=gcc -I/usr/include } {CFLAGS=-g -O2} {FC=/usr/bin/mpif90 -Wall -I/usr/include } {FCFLAGS=} {PROGFCFLAGS=} {CPPDEFS= - - DSYSLINUX -DCPRGNU} {OPT=-OO DSYSLINUX -DCPRGNU} {OPT=-O2} {DEBUG=} {REAL8=} {BIT64=} {ENDIAN=} {MPIFC=/usr/bin/mpif90 -Wall -I/usr/include } {MPILIBS=} {MPIHEADER=} { INCLUDEFLAG=-I} {INCLUDEPATH=} {AR=ar cq} {RANLIB=ranlib} {BABELROOT=} {COMPILER_ROOT=} {PYTHON=} {PYTHONOPTS=} {FORT_SIZE=} {prefix=NONE} { SRCDIR=} {FC_DEFINE=-D}

configure: creating . /config.status
config.status: creating Makefile.conf
config.status: creating config.h
config.status: config.h is unchanged
Please check the Makefile.conf
Please check the Makefile.conf
make[3]: Nothing to be done for 'all'.
make[3]: Nothing to be done for 'all'.
/usr/bin/mpif90 -Wall -I/usr/include -I/home/fvcom/oasis3-mct/... /compile_oa3-mct/build/lib/psmile.MPI1 -I/home/fvcom/oasis3-mct/... /compile_oa3-mct/build/lib/pio -I/home/fvcom/oasis3-mct/... /compile_oa3-mct/build/lib/mct -Duse_comm_MPI1 -D__VERBOSE -DTREAT_OVERLAY -I/usr/include -c /home/fvcom/oasis3-mct/lib/script/src/remap_ conserv.F90
make[1]: Entering directory '/home/fvcom/compile_oa3-mct/build/lib/scrip'
/usr/bin/mpif90 -Wall -I/usr/include -I/home/fvcom/oasis3-mct/... /compile_oa3-mct/build/lib/psmile.MPI1 -I/home/fvcom/oasis3-mct/... /compile_oa3-mct/build/lib/pio -I/home/fvcom/oasis3-mct/... /compile_oa3-mct/build/lib/mct -Duse_comm_MPI1 -D__VERBOSE -DTREAT_OVERLAY -I/usr/include -c /home/fvcom/oasis3-mct/lib/script/src/remap_ conserv.F90
make[1]: Leaving directory '/home/fvcom/compile_oa3-mct/build/lib/scrip'
What can I do to fix this?

Posted by Anonymous at November 6 2023

Hello,

To start with, I see the error message:
" mkdir: cannot create directory '/home/20cl91p02': Permission denied"
at the beginning of your mail.
Can you fix that first and then see what happens?
 Regards,
 Sophie

Posted by Anonymous at November 6 2023

/home/20cl91p02': Permission denied"
this is an example directory (it's in my system) :)
First change the directory in the TopMakefileOasis3 file 
GIVE your own directory.

Posted by Anonymous at November 6 2023

Hi, 
Another thing is /home/fvcom/oasis3-mct/util/make_dir/ 
you find some file make.intel@example file.
you need to set COUPLE and ARCHDIR 

example
# COUPLE	: path for oasis3-mct main directory 
#Change the line below
COUPLE          = /home/20cl91p02/NEXTGEN/OA/oasis3-mct
#
# ARCHDIR       : directory created when compiling
#Change the line below
ARCHDIR         = /home/20cl91p02/NEXTGEN/OA/oasis3_mct_install


you can take some help from 
https://www.cerfacs.fr/site-oasis/forum/oa_main.php?c=146

or you can send me an email. 
Thanks
#Subhadeep Maishal 
#Email: subhadeepmaishal@kgpian.iitkgp.ac.in

Posted by Anonymous at November 6 2023

Thank you very much for your detailed answers, I benefited a lot!

Posted by Anonymous at November 6 2023

##############################################################################

# This is the top makefile for compiling OASIS3-MCT coupling library including
#   static and shared versions of mct/mpeu, scrip, psmile 
#   (i.e. interpolation and communication), and c-bindings 
# Platform dependent settings, compiler options, cpp keys, 
#   paths has to be set in an include file indicated in make.inc.
# Extra targets and paths are defined in the automatically included make.common

# for basic help: 
# gmake -f TopMakefileOasis3 help

########################################################################################

include makeubuntu.inc
include make.common

########################################################################################

SHELL = /bin/sh
ifeq ($(MAKE),make)
MAKEf = $(MAKE) --no-print-directory -f TopMakefileOasis3
else
MAKEf = $(MAKE) -f TopMakefileOasis3
endif

# Defining path for FORTRAN and C sources
LIBSRC  = $(COUPLE)/lib

# Log and error files for compiling
LOGSTATIC = $(COUPLE)/util/make_dir/COMP.log
ERRSTATIC = $(COUPLE)/util/make_dir/COMP.err
# Log and error files for compiling the shared libraries
LOGSHARED = $(COUPLE)/util/make_dir/COMP-shared.log
ERRSHARED = $(COUPLE)/util/make_dir/COMP-shared.err
# Log and error files for installing PyOasis
LOGPYO = $(COUPLE)/util/make_dir/COMP-pyoasis.log
ERRPYO = $(COUPLE)/util/make_dir/COMP-pyoasis.err

########################################################################################
# For backwards compatibility

default: static-libs-fortran

oasis3_psmile: static-libs-fortran

oasis3-psmile: static-libs-fortran

makedirs: makedirs-static

makemct: makemct-static

makelibs: makescrip-static

makepsmile: makepsmile-static

cleanlibs: clean-static

########################################################################################

.DEFAULT:
	@echo " "
	@echo "make: *** No rule to make target \`$@\`.  Stop."
	@$(MAKEf) help

help:
	@echo " "
	@echo "TopMakefileOasis3 recommended targets:"
	@echo "  static-libs         = static oasis libraries including fortran and c-bindings"
	@echo "  shared-libs         = shared (dynamic) oasis libraries including fortran and c-bindings"
	@echo "  pyoasis             = builds and installs shared-libs plus higher and intermediate python classes"
	@echo "  realclean           = cleans and resets the build"
	@echo "TopMakefileOasis3 alternative targets:"
	@echo "  oasis3-psmile       = static-libs-fortran (for backwards compatibility)"
	@echo "  static-libs-fortran = static oasis libraries for fortran only"
	@echo "  shared-libs-fortran = shared (dynamic) oasis libraries for fortran only"
	@echo " "

########################################################################################

static-and-shared-libs-fortran: static-libs-fortran shared-libs-fortran

static-libs-fortran: check-vars
	@echo ""
	@echo "Compilation of the OASIS3-MCT static libraries"
	@echo "Build output to $(LOGSTATIC)"
	@echo "Build errors to $(ERRSTATIC)"
	@rm -f $(LOGSTATIC) $(ERRSTATIC)
	$(call check_defined, AR, static lib. archiver command)
	$(call check_defined, ARFLAGS, static lib. archiver options)
	@$(MAKEf) makedirs-static
	@$(MAKEf) makemct-static
	@$(MAKEf) makescrip-static
	@$(MAKEf) makepsmile-static
	@(echo "DONE" ; echo "")

shared-libs-fortran: check-vars
	@echo ""
	@echo "Compilation of the OASIS3-MCT shared libraries"
	@echo "Build output to $(LOGSHARED)"
	@echo "Build errors to $(ERRSHARED)"
	@rm -f $(LOGSHARED) $(ERRSHARED)
	$(call check_defined, DYNOPT LDDYNOPT, shared lib. compilation options)
	@$(MAKEf) makedirs-shared
	@$(MAKEf) makemct-shared
	@$(MAKEf) makescrip-shared
	@$(MAKEf) makepsmile-shared
	@(echo "DONE" ; echo "")

static-libs: static-libs-fortran
	@echo "Compilation of the OASIS3-MCT C bindings static libraries"
	@echo "Build output to $(LOGSTATIC)"
	@echo "Build errors to $(ERRSTATIC)"
	@$(MAKEf) makecbindings-static
	@(echo "DONE" ; echo "")

shared-libs: shared-libs-fortran
	@echo "Compilation of the OASIS3-MCT C bindings shared libraries"
	@echo "Build output to $(LOGSHARED)"
	@echo "Build errors to $(ERRSHARED)"
	@$(MAKEf) makecbindings-shared
	@(echo "DONE" ; echo "")

pyoasis: shared-libs
	@echo "Installation of PyOasis"
	@echo "Build output to $(LOGPYO)"
	@echo "Build errors to $(ERRPYO)"
	@rm -f $(LOGPYO) $(ERRPYO)
	$(call check_defined, MPIRUN, mpi launcher mnemonic helper)
	@$(MAKEf) makedirs-py
	@$(MAKEf) makepyoasis
	@(echo "DONE" ; echo "")

realclean: check-vars
	$(MAKEf) clean-static clean-shared clean-pyoasis

########################################################################################
# Rules for creating build and library directories

makedirs-static:
	@echo "=> Creating directories for compiling the static libraries"
	@echo "   in $(LIBBUILD)"
	@mkdir -p $(LIBBUILD)/scrip
	@mkdir -p $(LIBBUILD)/mctdir
	@mkdir -p $(LIBBUILD)/mct
	@mkdir -p $(LIBBUILD)/psmile.$(CHAN)
	@mkdir -p $(LIBBUILD)/cbindings
	@mkdir -p $(ARCHDIR)/include
	@mkdir -p $(ARCHDIR)/lib

makedirs-shared:
	@echo "=> Creating directories for compiling the shared libraries"
	@echo "   in $(LIBBUILDSHARED)"
	@mkdir -p $(LIBBUILDSHARED)/scrip
	@mkdir -p $(LIBBUILDSHARED)/mctdir
	@mkdir -p $(LIBBUILDSHARED)/mct
	@mkdir -p $(LIBBUILDSHARED)/psmile.$(CHAN)
	@mkdir -p $(LIBBUILDSHARED)/cbindings
	@mkdir -p $(ARCHDIR)/include
	@mkdir -p $(ARCHDIR)/lib

makedirs-py:
	@echo "=> Creating pyoasis installation path"
	@mkdir -p $(ARCHDIR)/python/pyoasis

########################################################################################
# Rules for cleaning

clean-static:
	@echo cleaning oasis3-mct static libraries
	rm -r -f $(LIBBUILD)/scrip
	rm -r -f $(LIBBUILD)/mct
	rm -r -f $(LIBBUILD)/mctdir
	rm -r -f $(LIBBUILD)/psmile.$(CHAN)
	rm -r -f $(ARCHDIR)/include
	rm -r -f $(LIBBUILD)/cbindings
	rm -f $(ARCHDIR)/lib/libscrip.a
	rm -f $(ARCHDIR)/lib/libmct.a
	rm -f $(ARCHDIR)/lib/libmpeu.a
	rm -f $(ARCHDIR)/lib/libpsmile.$(CHAN).a
	rm -f $(ARCHDIR)/lib/liboasis.cbind.a

clean-shared:
	@echo cleaning oasis3-mct shared libraries
	rm -r -f $(LIBBUILDSHARED)/scrip
	rm -r -f $(LIBBUILDSHARED)/mct
	rm -r -f $(LIBBUILDSHARED)/mctdir
	rm -r -f $(LIBBUILDSHARED)/psmile.$(CHAN)
	rm -r -f $(LIBBUILDSHARED)/cbindings
	rm -r -f $(ARCHDIR)/include
	rm -f $(ARCHDIR)/lib/libscrip.so
	rm -f $(ARCHDIR)/lib/libmct.so
	rm -f $(ARCHDIR)/lib/libmpeu.so
	rm -f $(ARCHDIR)/lib/libpsmile.$(CHAN).so
	rm -f $(ARCHDIR)/lib/liboasis.cbind.so

clean-pyoasis:
	@echo cleaning pyoasis
	rm -r -f $(ARCHDIR)/python

########################################################################################
# Rules for compiling mpeu/mct library

makemct-static:
	@echo "=> Configuring libraries mpeu and mct"
	@(cd $(LIBBUILD)/mctdir; cp -f -r -p $(LIBSRC)/mct/* .;\
         ./configure MPIFC="$(F90) $(STATOPT)" FC="$(F90) $(STATOPT)" CC="$(CC) " \
         1>> $(LOGSTATIC) 2>> $(ERRSTATIC) ;)
	@echo "=> Compiling libraries mpeu and mct"
	@(cd $(LIBBUILD)/mctdir; \
         $(MAKE) 1>> $(LOGSTATIC) 2>> $(ERRSTATIC) ;)
	@echo "=> Installing libraries mpeu and mct"
	@(cd $(LIBBUILD)/mctdir; \
         cp -f ./*/lib*.a   $(ARCHDIR)/lib/; \
         cp -f ./*/*.o    $(LIBBUILD)/mct/; \
         cp -f ./*/*.mod  $(LIBBUILD)/mct/; \
         cp -f ./*/*.mod  $(ARCHDIR)/include/;)

makemct-shared:
	@echo "=> Configuring shared libraries mpeu and mct"
	@(cd $(LIBBUILDSHARED)/mctdir; cp -f -r -p $(LIBSRC)/mct/* .;\
         ./configure MPIFC="$(F90) $(DYNOPT)" FC="$(F90) $(DYNOPT)" CC="$(CC) $(DYNOPT)" \
         1>> $(LOGSHARED) 2>> $(ERRSHARED) ;)
	@echo "=> Compiling shared libraries mpeu and mct"
	@(cd $(LIBBUILDSHARED)/mctdir; \
	 $(MAKE) 1>> $(LOGSHARED) 2>> $(ERRSHARED) ; )
	@echo "=> Creating shared library libmpeu.so"
	@(cd $(LIBBUILDSHARED)/mctdir ; \
	 $(F90) $(DYNOPT) $(LDFLAGS) $(LDDYNOPT) \
         -o $(ARCHDIR)/lib/libmpeu.so ./mpeu/*.o $(NETCDF_LIBRARY); )
	@echo "=> Creating shared library libmct.so"
	@(cd $(LIBBUILDSHARED)/mctdir ; \
	 $(F90) $(DYNOPT) $(LDFLAGS) $(LDDYNOPT) \
         -o $(ARCHDIR)/lib/libmct.so ./mct/*.o -L$(ARCHDIR)/lib -lmpeu $(NETCDF_LIBRARY); )
	@echo "=> Installing shared libraries mpeu and mct"
	@(cd $(LIBBUILDSHARED)/mctdir ; \
         cp -f ./*/*.o    $(LIBBUILDSHARED)/mct/; \
         cp -f ./*/*.mod  $(LIBBUILDSHARED)/mct/; \
         cp -f ./*/*.mod  $(ARCHDIR)/include/;)

########################################################################################
# Rules for compiling the libraries scrip

makescrip-static:
	@echo "=> Compiling library scrip"
	@(cd $(LIBBUILD)/scrip; cp -f $(LIBSRC)/scrip/src/Makefile .;\
         $(modifmakefile) ; $(MAKE) all 1>> $(LOGSTATIC) 2>> $(ERRSTATIC) )
	@echo "=> Installing scrip modules"
	@(cd $(LIBBUILD)/scrip ; \
         cp -f *.mod  $(ARCHDIR)/include/;)

makescrip-shared:
	@echo "=> Compiling shared library scrip"
	@(cd $(LIBBUILDSHARED)/scrip; cp -f $(LIBSRC)/scrip/src/Makefile .;\
         $(modifmakefile) ; $(MAKE) shared 1>> $(LOGSHARED) 2>> $(ERRSHARED) )
	@echo "=> Installing scrip modules"
	@(cd $(LIBBUILDSHARED)/scrip ; \
         cp -f *.mod  $(ARCHDIR)/include/;)

########################################################################################
# Rules for compiling the libraries psmile

makepsmile-static:
	@echo "=> Compiling library psmile"
	@(cd $(LIBBUILD)/psmile.$(CHAN) ; \
         cp -f $(LIBSRC)/psmile/src/Makefile . ; $(modifmakefile) ; \
         $(MAKE) all 1>> $(LOGSTATIC) 2>> $(ERRSTATIC) ; )
	@echo "=> Installing library psmile"
	@(cd $(LIBBUILD)/psmile.$(CHAN) ; \
	 cp -f *.mod $(ARCHDIR)/include ; )

makepsmile-shared:
	@echo "=> Compiling shared library psmile"
	@(cd $(LIBBUILDSHARED)/psmile.$(CHAN) ; \
         cp -f $(LIBSRC)/psmile/src/Makefile . ; $(modifmakefile) ; \
         $(MAKE) shared 1>> $(LOGSHARED) 2>> $(ERRSHARED) ; )
	@echo "=> Installing shared library psmile"
	@(cd $(LIBBUILDSHARED)/psmile.$(CHAN) ; \
	 cp -f *.mod $(ARCHDIR)/include ; )

########################################################################################
# Rules for compiling the oasis C bindings

makecbindings-static:
	@echo "=> Compiling the C bindings static"
	@(cd $(LIBBUILD)/cbindings ; \
	 cp -f -r -p $(LIBSRC)/cbindings/Makefile .; $(modifmakefile) ; \
         $(MAKE) libstatic 1>> $(LOGSTATIC) 2>> $(ERRSTATIC) )
	@echo "=> Installing cbindings modules"
	@(cd $(LIBBUILD)/cbindings ; \
         cp -f *.mod  $(ARCHDIR)/include/;)

makecbindings-shared:
	@echo "=> Compiling the C bindings shared"
	@(cd $(LIBBUILDSHARED)/cbindings ; \
	 cp -f -r -p $(LIBSRC)/cbindings/Makefile .; $(modifmakefile) ; \
         $(MAKE) libshared 1>> $(LOGSHARED) 2>> $(ERRSHARED) )
	@echo "=> Installing cbindings modules"
	@(cd $(LIBBUILDSHARED)/cbindings ; \
         cp -f *.mod  $(ARCHDIR)/include/;)

########################################################################################
# Rules for installing the PyOasis python modules

makepyoasis:
	@echo "=> Installing the PyOasis Modules"
	@(cp -f -r -p $(COUPLE)/pyoasis/src/* $(ARCHDIR)/python/pyoasis \
          1>> $(LOGPYO) 2>> $(ERRPYO) )
	@echo export PYOASIS_ROOT=${ARCHDIR} > ${ARCHDIR}/python/init.sh
	@echo setenv PYOASIS_ROOT ${ARCHDIR} > ${ARCHDIR}/python/init.csh
	@echo export LD_LIBRARY_PATH=\$${PYOASIS_ROOT}/lib:\$${LD_LIBRARY_PATH} >> ${ARCHDIR}/python/init.sh
	@echo setenv LD_LIBRARY_PATH \$${PYOASIS_ROOT}/lib:\$${LD_LIBRARY_PATH} >> ${ARCHDIR}/python/init.csh
	@echo export PYTHONPATH=\$${PYOASIS_ROOT}/python:\$${PYTHONPATH} >> ${ARCHDIR}/python/init.sh
	@echo setenv PYTHONPATH \$${PYOASIS_ROOT}/python:\$${PYTHONPATH} >> ${ARCHDIR}/python/init.csh
	@echo export MPIRUN4PY=\"${MPIRUN}\" >> ${ARCHDIR}/python/init.sh
	@echo setenv MPIRUN4PY \"${MPIRUN}\" >> ${ARCHDIR}/python/init.csh
	@echo
	@echo =====================================================================
	@echo The following lines have been put in the file
	@echo \"${ARCHDIR}/python/init.sh\"
	@echo
	@cat ${ARCHDIR}/python/init.sh
	@echo
	@echo The following lines have been put in the file
	@echo \"${ARCHDIR}/python/init.csh\"
	@echo
	@cat ${ARCHDIR}/python/init.csh
	@echo
	@echo Before using pyOASIS issue the command:
	@echo \"source ${ARCHDIR}/python/init.sh\"
	@echo    or
	@echo \"source ${ARCHDIR}/python/init.csh\"
	@echo Alternatively, these lines could be added to your \"\~/.bashrc\" or \"\~/.cshrc\" file. 
	@echo =====================================================================
	@echo

########################################################################################
# Rules for checks

check-vars:
	$(call check_defined, COUPLE, Root of the source directory)
	$(call check_defined, ARCHDIR, Root of the installation path)
	$(call check_defined, CHAN, MPI flavour MPI1/MPI2)
	$(call check_defined, MAKE, the make command make/make)
	$(call check_defined, F90 F f90 f CC, compiler command)
	$(call check_defined, F90FLAGS f90FLAGS FFLAGS fFLAGS CCFLAGS, \
	                      compilation options)

# Params:
#   1. Variable name(s) to test.
#   2. (optional) Error message to print.
check_defined = \
    $(strip $(foreach 1,$1, \
        $(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
    $(if $(value $1),, \
      $(error Undefined $1$(if $2, ($2))))

########################################################################################
# Some rules to modify/add variables in makefiles

modifmakefile =	( echo 'include $(COUPLE)/util/make_dir/make.inc'  > infile;\
                  echo 'include $(COUPLE)/util/make_dir/make.common' >> infile;\
                  cat Makefile >> infile ; \
                  cp -f infile Makefile )

########################################################################################
above is TopMakefileOasis3

below is make.inc
###############################################################################
#
# CHAN	: communication technique used in OASIS3 (MPI1/MPI2/NONE)
CHAN            = MPI1
#
# Paths for libraries, object files and binaries
#
# COUPLE	: path for oasis3-mct main directory
COUPLE          = /home/fvcom/oasis3-mct
#
# ARCHDIR       : directory created when compiling
ARCHDIR         = /home/fvcom/oasis3_mct_install

#
# NETCDF library
NETCDF_INCLUDE  = $(shell $(NETCDF_CONFIG) --fflags)
NETCDF_LIBRARY  = $(shell $(NETCDF_CONFIG) --flibs)
#

# MPI library
MPIDIR      = 
MPIBIN      = 
MPI_INCLUDE = 
MPILIB      =

# Compiling and other commands
MAKE        = make
F90         = mpiifort
F           = $(F90)
f90         = $(F90)
f           = $(F90)
CC          = mpiicc -mt_mpi
LD          = mpiifort
AR          = ar
ARFLAGS     = r
#
# CPP keys and compiler options
# 
CPPDEF    = -Duse_libMPI -Duse_comm_$(CHAN)
#
# 
F90FLAGS_1  = -O2 -I. -mt_mpi
f90FLAGS_1  =  
FFLAGS_1    =  
fFLAGS_1    =  
CCFLAGS_1   = -O2 -xAVX -mt_mpi
LDFLAGS     = -mt_mpi
#
###################
#
# Additional definitions that should not be changed
#
FLIBS		= $(NETCDF_LIBRARY)
# BINDIR        : directory for executables
BINDIR          = $(ARCHDIR)/bin
# LIBBUILD      : contains a directory for each library
LIBBUILD        = $(ARCHDIR)/build/lib
# INCPSMILE     : includes all *o and *mod for each library
INCPSMILE       = -I$(LIBBUILD)/psmile.$(CHAN) -I$(LIBBUILD)/mct -I$(LIBBUILD)/scrip 

F90FLAGS  = $(F90FLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
f90FLAGS  = $(f90FLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
FFLAGS    = $(FFLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
fFLAGS    = $(fFLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
CCFLAGS   = $(CCFLAGS_1) $(INCPSMILE) $(CPPDEF) -I$(NETCDF_INCLUDE)
#
#############################################################################

The error is reported as follows:

Compilation of the OASIS3-MCT static libraries
Build output to /home/fvcom/oasis3-mct/util/make_dir/COMP.log
Build errors to /home/fvcom/oasis3-mct/util/make_dir/COMP.err
=> Creating directories for compiling the static libraries
   in /home/fvcom/oasis3_mct_install/build/lib
=> Configuring libraries mpeu and mct
=> Compiling libraries mpeu and mct
=> Installing libraries mpeu and mct
=> Compiling library scrip
make[1]: *** [TopMakefileOasis3:246: makescrip-static] Error 2
make: *** [TopMakefileOasis3:93: static-libs-fortran] Error 2

Posted by Anonymous at November 7 2023

My problem has been solved, thank you very much!

Posted by Anonymous at November 24 2023

Hi, can you help how did you solve your problems step by step?

I've got the same issues as you.
Can you help me to compile the models atmos.F90 and ocean.F90 and link them with OASIS3-MCT by typing make? Makefile:2: /util/make_dir/make.inc: No such file or directory make: * No rule to make target `/util/make_dir/make.inc'. Stop.

Am i need to compile the OASIS environment at first step according to the manual Ch.6? Regarding compilation I am working on cluster with linux machine (I have openmpi, gfortran, ifort etc.) /storage/ekman/sharmar/OASIS_MCT_5.0/oasis3-mct/util/make_dir 
Output of "gmake -f TopMakefileOasis3 help" is very long, and finally it says: gmake: * [/storage/ekman/sharmar/OASIS_MCT_5.0/oasis3-mct/util/make_dir/make.] Error 2

Am I need to write in .bash_profile links for OASIS?
Thanks in advance, Vitali

Posted by Anonymous at November 24 2023

Hi Vitali,
I don't think that you have the same issue than the one above in this issue.
To compile oasis, you need to make a link between a header Makefile adapted to your platform and make.inc . To construct the header Makefile adapted to your platform, you can start from the examples existing in that directory (e.g. make.intel18.0.1.163_intelmpi2018.1.163_kraken).
Let me know if this helps,
  Sophie
Reply to this