NOAA-EMC / UPP

Other
36 stars 98 forks source link

build issues with cmake build #212

Closed edwardhartnett closed 3 years ago

edwardhartnett commented 3 years ago

@aerorahul do you know what is going on with this?

Wen Meng - NOAA Affiliate 10:15 AM (1 hour ago) to me

Hi Edward,

I have been practicing on build post executable/lib with NCEPLIBS at hpc-stack via cmake under my personal account on hera. I did the checking up and building as:

git clone git@github.com:NOAA-EMC/EMC_post.git cd EMC_post mkdir build module use /scratch2/NCEPDEV/nwprod/hpc-stack/test/modulefiles/stack module load hpc/1.0.0-beta1 module load hpc-intel/18.0.5.274 module load hpc-impi/2018.0.4 cmake .. -DCMAKE_INSTALL_PREFIX=./install

My building process failed at finding netcdf package as:

-- Found MPI: TRUE (found version "3.1") CMake Error at CMakeLists.txt:30 (find_package): By not providing "FindNetCDF.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "NetCDF", but CMake did not find one.

Could not find a package configuration file provided by "NetCDF" with any of the following names:

NetCDFConfig.cmake
netcdf-config.cmake

Add the installation prefix of "NetCDF" to CMAKE_PREFIX_PATH or set "NetCDF_DIR" to a directory containing one of the above files. If "NetCDF" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred! See also "/scratch2/NCEPDEV/ovp/Wen.Meng/LIBS/src/upp_v10.0.0/EMC_post/build/CMakeFiles/CMakeOutput.log".

Can you advise the fix?

Thanks,

aerorahul commented 3 years ago

Yes. I do. We can take it offline.

aerorahul commented 3 years ago

User Error!

edwardhartnett commented 3 years ago

This is the place to resolve this, so I can find the answer again. ;-)

The FindNetCDF.cmake file is in a submodule - is that correct?

aerorahul commented 3 years ago
  1. Recursive clone
  2. I don't see the netcdf module loaded.
aerorahul commented 3 years ago

This will build the post library and executable

 module load cmake
 module use /scratch2/NCEPDEV/nwprod/hpc-stack/test/modulefiles/stack
 module load hpc/1.0.0-beta1
 module load hpc-intel/18.0.5.274
 module load hpc-impi/2018.0.4
 module load netcdf
 module load w3nco
 module load g2
 module load g2tmpl
 module load bacio
 module load ip
 module load sp
 module load w3emc
 module load crtm
 module load sfcio
 module load gfsio
 module load wrf_io
 module list
 git clone --recursive emcgh:emc_post
 mkdir build
 cd build
 cmake -DCMAKE_INSTALL_PREFIX=../install -DBUILD_WITH_WRFIO=ON ../emc_post
 make -j12
 make install
WenMeng-NOAA commented 3 years ago

It turns out I didn't use the option --recursive to check out the submodules. Now it works for me. Thanks for the instructions. I will practice further on my personal account.

WenMeng-NOAA commented 3 years ago

@aerorahul The building process works for me (cmake ../EMC_post -DCMAKE_INSTALL_PREFIX=../install -DBUILD_POSTEXEC=OFF). I load the following modules for buiding executable:

module use /scratch2/NCEPDEV/nwprod/hpc-stack/test/modulefiles/stack module load hpc/1.0.0-beta1 module load hpc-intel/18.0.5.274 module load hpc-impi/2018.0.4

module load jasper module load png module load z

module load g2 module load g2tmpl module load w3nco module load bacio module load gfsio module load ip module load sp module load crtm module load w3emc

module load nemsio module load sfcio module load sfcio module load wrf_io

The building process failed as:

[ 96%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/io_int_stubs.f.o /scratch2/NCEPDEV/ovp/Wen.Meng/LIBS/src/upp_v10.0.0/EMC_post/sorc/ncep_post.fd/io_int_stubs.f(4): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [DATA] SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status ) -----------------------------------------------------------^ /scratch2/NCEPDEV/ovp/Wen.Meng/LIBS/src/upp_v10.0.0/EMC_post/sorc/ncep_post.fd/io_int_stubs.f(4): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [STATUS] SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status ) ----------------------------------------------------------------------------------^ /scratch2/NCEPDEV/ovp/Wen.Meng/LIBS/src/upp_v10.0.0/EMC_post/sorc/ncep_post.fd/io_int_stubs.f(4): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [OUTCOUNT] SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status ) ------------------------------------------------------------------------^ [ 97%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST.F.o

Please advise the fix. Thanks!

aerorahul commented 3 years ago

@WenMeng-NOAA What you posted are warnings in the code, not compilation errors.

sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/io_int_stubs.f.o
/scratch2/NCEPDEV/ovp/Wen.Meng/LIBS/src/upp_v10.0.0/EMC_post/sorc/ncep_post.fd/io_int_stubs.f(4): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [DATA]
SUBROUTINE ext_int_get_dom_ti_real ( DataHandle,Element, Data, Count, Outcount, Status )

When I build, following the instructions I posted above, I do not see any errors or failures.

[ 85%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/upp.dir/SET_OUTFLDS.f.o
[ 86%] Linking Fortran static library libupp.a
[ 86%] Built target upp
Scanning dependencies of target nceppost.x
[ 86%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/intio_tags.f.o
[ 87%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/native_endianness.f.o
[ 87%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/wrf_io_flags.f.o
[ 87%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/ASSIGNNEMSIOVAR.f.o
[ 88%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/GETNEMSNDSCATTER.f.o
[ 88%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/GFSPOSTSIG.F.o
[ 88%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_GFS.f.o
[ 89%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_GFS_NEMS.f.o
[ 90%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_GFS_NEMS_MPIIO.f.o
[ 90%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_GFS_NETCDF.f.o
[ 91%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_GFS_NETCDF_PARA.f.o
[ 91%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_GFS_SIGIO.f.o
[ 91%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_NETCDF.f.o
[ 92%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_NMM.f.o
[ 92%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/TIMEF.f.o
[ 93%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/WRFPOST.f.o
[ 94%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/getlvls.f.o
[ 95%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/retrieve_index.f.o
[ 96%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST.F.o
[ 97%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_NEMS.f.o
[ 98%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/INITPOST_NEMS_MPIIO.f.o
[ 99%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/getIVariableN.f.o
[ 99%] Building Fortran object sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/getVariable.f.o
[100%] Linking Fortran executable nceppost.x
[100%] Built target nceppost.x

Also, if you wish to build with WRF_IO, you need to load the wrf_io module module load wrf_io, and add the following to your cmake command: -DBUILD_WITH_WRFIO=ON. The default is to use the stub.

WenMeng-NOAA commented 3 years ago

@aerorahul The option -DBUILD_WITH_WRFIO=ON works.

Now the build process failed at libpng as:

/scratch2/NCEPDEV/nwprod/hpc-stack/test/intel-18.0.5.274/png/1.6.35/lib64/libpng.a(pngrutil.c.o): In function png_handle_iCCP': pngrutil.c:(.text+0xf46): undefined reference toinflateValidate' /scratch2/NCEPDEV/nwprod/hpc-stack/test/intel-18.0.5.274/png/1.6.35/lib64/libpng.a(pngrutil.c.o): In function png_decompress_chunk': pngrutil.c:(.text+0x3699): undefined reference toinflateValidate' /scratch2/NCEPDEV/nwprod/hpc-stack/test/intel-18.0.5.274/png/1.6.35/lib64/libpng.a(pngrutil.c.o): In function png_read_start_row': pngrutil.c:(.text+0x69ca): undefined reference toinflateValidate' make[2]: [sorc/ncep_post.fd/nceppost.x] Error 1 make[1]: [sorc/ncep_post.fd/CMakeFiles/nceppost.x.dir/all] Error 2 make: *** [all] Error 2

aerorahul commented 3 years ago

@WenMeng-NOAA I followed the instructions I gave you on Hera, with the hpc-stack you mentioned and was able to build it. I put those in a script and it is at: /scratch1/NCEPDEV/stmp2/Rahul.Mahajan/test/Wen.Meng/build_post.sh

To use: $> /scratch1/NCEPDEV/stmp2/Rahul.Mahajan/test/Wen.Meng/build_post.sh

WenMeng-NOAA commented 3 years ago

@aerorahul Your build script works for me. Thanks!