Build Error

Discussions related to downloading and compiling MPAS-Atmosphere.
Post Reply
Yue_Ma
Posts: 18
Joined: Thu Sep 13, 2018 12:24 pm

Build Error

Post by Yue_Ma » Thu Sep 27, 2018 7:08 am

Hi,
I am first trying to compiling the MPAS following tutorial practice guide. While I build init_atmosphere core, I put

Code: Select all

make gfortran CORE=init_atmosphere PRECISION=single
I get

Code: Select all

( make all \
"FC_PARALLEL = mpif90" \
"CC_PARALLEL = mpicc" \
"CXX_PARALLEL = mpicxx" \
"FC_SERIAL = gfortran" \
"CC_SERIAL = gcc" \
"CXX_SERIAL = g++" \
"FFLAGS_PROMOTION = -fdefault-real-8 -fdefault-double-8" \
"FFLAGS_OPT = -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
"CFLAGS_OPT = -O3 -m64" \
"CXXFLAGS_OPT = -O3 -m64" \
"LDFLAGS_OPT = -O3 -m64" \
"FFLAGS_DEBUG = -g -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" \
"CFLAGS_DEBUG = -g -m64" \
"CXXFLAGS_DEBUG = -O3 -m64" \
"LDFLAGS_DEBUG = -g -m64" \
"FFLAGS_OMP = -fopenmp" \
"CFLAGS_OMP = -fopenmp" \
"CORE = init_atmosphere" \
"DEBUG = " \
"USE_PAPI = " \
"OPENMP = " \
"CPPFLAGS =  -D_MPI -DUNDERSCORE" )
make[1]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1'
cd src; make FC="mpif90" \
                 CC="mpicc" \
                 CXX="mpicxx" \
                 SFC="gfortran" \
                 SCC="gcc" \
                 LINKER="mpif90" \
                 CFLAGS="-O3 -m64 "-DSINGLE_PRECISION"" \
                 CXXFLAGS="-O3 -m64 "-DSINGLE_PRECISION"" \
                 FFLAGS="-O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" \
                 LDFLAGS="-O3 -m64" \
                 RM="rm -f" \
                 CPP="cpp -P -traditional" \
                 CPPFLAGS="-D_MPI -DUNDERSCORE -DCORE_INIT_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=init_atmosphere -DMPAS_EXE_NAME=init_atmosphere_model "-DSINGLE_PRECISION" -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION="unknown"" \
                 LIBS="-L/usr/local/ParallelIO/lib -lpio -L/usr/local/PnetCDF/lib -lpnetcdf -L/usr/local/NETCDF/lib -lnetcdff -lnetcdf" \
                 CPPINCLUDES="-I/usr/local/ParallelIO/include -I/usr/local/PnetCDF/include -I/usr/local/NETCDF/include" \
                 FCINCLUDES="-I/usr/local/ParallelIO/include -I/usr/local/PnetCDF/include -I/usr/local/NETCDF/include" \
                 CORE="init_atmosphere"\
                 AUTOCLEAN="false" \
                 GEN_F90="false" \
                 NAMELIST_SUFFIX="init_atmosphere" \
                 EXE_NAME="init_atmosphere_model"
make[2]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1/src'
( cd external; make FC="mpif90" SFC="gfortran" CC="mpicc" SCC="gcc" FFLAGS="-O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" CFLAGS="-O3 -m64 -DSINGLE_PRECISION" CPP="cpp -P -traditional" NETCDF="/usr/local/NETCDF" CORE="init_atmosphere" all )
make[3]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external'
( cd esmf_time_f90; make FC="mpif90 -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form" CPP="cpp -P -traditional" CPPFLAGS="-D_MPI -DUNDERSCORE -DCORE_INIT_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=init_atmosphere -DMPAS_EXE_NAME=init_atmosphere_model -DSINGLE_PRECISION -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION=unknown -DHIDE_MPI" GEN_F90=false )
make[4]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external/esmf_time_f90'
ar -ru libesmf_time.a *.o
ar: `u' modifier ignored since `D' is the default (see `U')
make[4]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external/esmf_time_f90'
( cd ezxml; make )
make[4]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external/ezxml'
rm -f *.o *.i
make -j 1 library
make[5]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external/ezxml'
mpicc -O3 -m64 -DSINGLE_PRECISION -D_MPI -DUNDERSCORE -DCORE_INIT_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=init_atmosphere -DMPAS_EXE_NAME=init_atmosphere_model -DSINGLE_PRECISION -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION=unknown -c ezxml.c
make[5]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external/ezxml'
make[4]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external/ezxml'
make[3]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/external'
( cd framework; make CPPFLAGS="-D_MPI -DUNDERSCORE -DCORE_INIT_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=init_atmosphere -DMPAS_EXE_NAME=init_atmosphere_model -DSINGLE_PRECISION -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION=unknown" CPPINCLUDES="-I/usr/local/ParallelIO/include -I/usr/local/PnetCDF/include -I/usr/local/NETCDF/include" all ) 
make[3]: Entering directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/framework'
rm -f mpas_io.o mpas_io.mod
mpif90 -D_MPI -DUNDERSCORE -DCORE_INIT_ATMOSPHERE -DMPAS_NAMELIST_SUFFIX=init_atmosphere -DMPAS_EXE_NAME=init_atmosphere_model -DSINGLE_PRECISION -DMPAS_NATIVE_TIMERS -DMPAS_GIT_VERSION=unknown -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -c mpas_io.F -I/usr/local/ParallelIO/include -I/usr/local/PnetCDF/include -I/usr/local/NETCDF/include -I/usr/local/ParallelIO/include -I/usr/local/PnetCDF/include -I/usr/local/NETCDF/include -I../external/esmf_time_f90
mpas_io.F:30:43:

    integer, parameter :: MPAS_INT_FILLVAL = NF_FILL_INT
                                           1
Error: Parameter ‘nf_fill_int’ at (1) has not been declared or is a variable, which does not reduce to a constant expression
mpas_io.F:31:53:

    character, parameter :: MPAS_CHAR_FILLVAL = achar(NF_FILL_CHAR)
                                                     1
Error: Parameter ‘nf_fill_char’ at (1) has not been declared or is a variable, which does not reduce to a constant expression
mpas_io.F:42:54:

    real (kind=RKIND), parameter :: MPAS_REAL_FILLVAL = NF_FILL_FLOAT
                                                      1
Error: Parameter ‘nf_fill_float’ at (1) has not been declared or is a variable, which does not reduce to a constant expression
mpas_io.F:566:79:

 io_ierr = PIO_def_dim(handle % pio_file, trim(dimname), PIO_unlimited, new_dimlist_node % dimhandle % dimid)
                                                                     1
Error: Symbol ‘pio_unlimited’ at (1) has no IMPLICIT type
mpas_io.F:278:37:

             pio_mode = PIO_64BIT_DATA
                                     1
Error: Symbol ‘pio_64bit_data’ at (1) has no IMPLICIT type
Makefile:119: recipe for target 'mpas_io.o' failed
make[3]: *** [mpas_io.o] Error 1
make[3]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1/src/framework'
Makefile:31: recipe for target 'frame' failed
make[2]: *** [frame] Error 2
make[2]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1/src'
Makefile:694: recipe for target 'mpas_main' failed
make[1]: *** [mpas_main] Error 2
make[1]: Leaving directory '/home/lennovo/MPAS/MPAS-Model-6.1'
Makefile:214: recipe for target 'gfortran' failed
make: *** [gfortran] Error 2
how can I build init_atmosphere core?

mgduda
Posts: 362
Joined: Mon Feb 26, 2018 7:35 pm

Re: Build Error

Post by mgduda » Tue Oct 02, 2018 10:52 pm

Sorry for the late reply! Which version of the PIO library are you using? If you're using the newer PIO 2.x library, you'll need to add "USE_PIO2=true" to your build command.

In case you're using the older PIO 1.x library, this could be an issue with the netCDF library. Which versions of the parallel-netCDF and netCDF libraries are you using?
NCAR/MMM

Yue_Ma
Posts: 18
Joined: Thu Sep 13, 2018 12:24 pm

Re: Build Error

Post by Yue_Ma » Thu Oct 04, 2018 8:52 am

Thanks your suggestion! My gcc/gfortran/g++ version is 7.3.0. It causes Fortran could not call a C funtion, although cmake could build netcdf.
I find this by the test#4 from http://www2.mmm.ucar.edu/wrf/OnLineTuto ... torial.php

mgduda
Posts: 362
Joined: Mon Feb 26, 2018 7:35 pm

Re: Build Error

Post by mgduda » Thu Oct 04, 2018 8:38 pm

What does the output look like from Test #4 on the web pgae you linked for compiling WRF? It is a little surprising that, if the gcc and gfortran compilers are both from the GNU 7.3.0 release, that they wouldn't be able to create compatible object files.
NCAR/MMM

Yue_Ma
Posts: 18
Joined: Thu Sep 13, 2018 12:24 pm

Re: Build Error

Post by Yue_Ma » Thu Oct 11, 2018 2:45 am

I have installed multiple versions of gcc and i set wrong permissions. Now it is fine.
But i meet a new problem. While I build init_atmosphere core,

Code: Select all

/usr/bin/ld: /home/ubuntu/MPAS/mpas-libs/lib/libmpi.a(ad_iwrite.o): undefined reference to symbol 'aio_read64@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/librt.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:18: recipe for target 'mpas' failed
make[2]: *** [mpas] Error 1
make[2]: Leaving directory '/home/ubuntu/MPAS/MPAS-Model-master/src'
Makefile:694: recipe for target 'mpas_main' failed
make[1]: *** [mpas_main] Error 2
make[1]: Leaving directory '/home/ubuntu/MPAS/MPAS-Model-master'
Makefile:214: recipe for target 'gfortran' failed
make: *** [gfortran] Error 2
It looks like MPI can't find some lib? If that is the case, where should i add '-lm' ?

mgduda
Posts: 362
Joined: Mon Feb 26, 2018 7:35 pm

Re: Build Error

Post by mgduda » Thu Oct 11, 2018 4:41 pm

How was your MPI library installed? Was it compiled from source using the GNU 7.3.0 compilers? It might be worth seeing whether the attached MPI test program compiles and runs correctly with

Code: Select all

mpif90 -O3 -m64 -ffree-line-length-none -fconvert=big-endian -ffree-form -o mpi_test mpitest.f90
The above command-line uses the same Fortran compiler flags as are used when compiling MPAS.
Attachments
mpitest.f90
(1.66 KiB) Downloaded 24 times
NCAR/MMM

Yue_Ma
Posts: 18
Joined: Thu Sep 13, 2018 12:24 pm

Re: Build Error

Post by Yue_Ma » Mon Oct 15, 2018 1:05 am

Thanks for your test program. This test program runs correctly and gets an executable file ‘mpi_test’. Now MPAS compiles correctly!
I get packages from http://www2.mmm.ucar.edu/people/duda/fi ... s/sources/ compiled by GNU 5.4.0 compilers or GNU 7.3.0. Of course, i simple modify the 'iolib_installation.sh' , adding

Code: Select all

# Download packages
wget -P ${LIBSRC} http://www2.mmm.ucar.edu/people/duda/files/mpas/sources/mpich-3.2.tar.gz    #mpich
wget -P ${LIBSRC} http://www2.mmm.ucar.edu/people/duda/files/mpas/sources/zlib-1.2.8.tar.gz   #zlib
wget -P ${LIBSRC} http://www2.mmm.ucar.edu/people/duda/files/mpas/sources/hdf5-1.8.19.tar.bz2 #hdf5
wget -P ${LIBSRC} http://www2.mmm.ucar.edu/people/duda/files/mpas/sources/parallel-netcdf-1.8.1.tar.gz  #pnetcdf
wget -P ${LIBSRC} http://www2.mmm.ucar.edu/people/duda/files/mpas/sources/netcdf-4.4.1.1.tar.gz #netcdf-c
wget -P ${LIBSRC} http://www2.mmm.ucar.edu/people/duda/files/mpas/sources/netcdf-fortran-4.4.4.tar.gz #netcdf-fortran
Both version 5.4.0 and version 7.3.0 could work!
Thank you again for your patience.

mgduda
Posts: 362
Joined: Mon Feb 26, 2018 7:35 pm

Re: Build Error

Post by mgduda » Mon Oct 15, 2018 4:49 pm

I'm glad to hear you've got it working!
NCAR/MMM

Post Reply

Return to “Compilation / installation”