NOAA-EMC / NCEPLIBS-external

Third-party libraries required by NCEPLIBS
Other
8 stars 16 forks source link

Problem building on linux system #48

Closed edwardhartnett closed 4 years ago

edwardhartnett commented 4 years ago

I am getting the following from cmake, what am I doing wrong?

(base) ed@mikado:~/NCEPLIBS-external/build$ cmake ..
-- The Fortran compiler identification is GNU 7.5.0
-- Check for working Fortran compiler: /usr/bin/f95
-- Check for working Fortran compiler: /usr/bin/f95 - works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 - yes
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building libraries: MPI NETCDF ESMF JASPER PNG WGRIB2 
-- Set ESMF MPITYPE to mpich3
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- zlib/CMakeLists.txt
|+++ zlib/CMakeLists.txt
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored
CMake Error at /usr/local/share/cmake-3.17/Modules/ExternalProject.cmake:2659 (message):
  No download info given for 'zlib' and its source directory:

   /home/ed/NCEPLIBS-external/zlib

  is not an existing non-empty directory.  Please specify one of:

   * SOURCE_DIR with an existing non-empty directory
   * DOWNLOAD_COMMAND
   * URL
   * GIT_REPOSITORY
   * SVN_REPOSITORY
   * HG_REPOSITORY
   * CVS_REPOSITORY and CVS_MODULE
Call Stack (most recent call first):
  /usr/local/share/cmake-3.17/Modules/ExternalProject.cmake:3267 (_ep_add_download_command)
  CMakeLists.txt:96 (ExternalProject_Add)
edwardhartnett commented 4 years ago

I installed some things, and messed around with my system for a while, and now the build gets further, but fails here:

  CC       src/binding/fortran/mpif_h/lib_libmpifort_la-null_type_del_fnf.lo
  CC       src/binding/fortran/mpif_h/lib_libmpifort_la-null_type_copy_fnf.lo
  CC       src/binding/fortran/use_mpi/lib_libmpifort_la-typef90cmplxf.lo
  CC       src/binding/fortran/use_mpi/lib_libmpifort_la-typef90realf.lo
  CC       src/binding/fortran/use_mpi/lib_libmpifort_la-typef90intf.lo
  MOD      src/binding/fortran/use_mpi/mpi_constants.mod-stamp
  MOD      src/binding/fortran/use_mpi/mpi_sizeofs.mod-stamp
  MOD      src/binding/fortran/use_mpi/mpi_base.mod-stamp
  MOD      src/binding/fortran/use_mpi/mpi.mod-stamp
  GEN      lib/libmpifort.la
/usr/bin/ld: cannot find -l-L/usr/lib/gcc/x86_64-linux-gnu/7
collect2: error: ld returned 1 exit status
Makefile:14117: recipe for target 'lib/libmpifort.la' failed
make[5]: *** [lib/libmpifort.la] Error 1
Makefile:40484: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
Makefile:10572: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/mpi.dir/build.make:128: recipe for target 'mpich/src/mpi-stamp/mpi-build' failed
make[2]: *** [mpich/src/mpi-stamp/mpi-build] Error 2
CMakeFiles/Makefile2:246: recipe for target 'CMakeFiles/mpi.dir/all' failed
make[1]: *** [CMakeFiles/mpi.dir/all] Error 2
Makefile:100: recipe for target 'all' failed
make: *** [all] Error 2

I'm now trying to install these libraries manually, because the build is not working for me.

climbfuji commented 4 years ago

The first error you are reporting looks like the git clone for the zlib subdirectory didn't work. Is there anything in the netcdf and hdf5 directories? Did you clone with --recursive?

edwardhartnett commented 4 years ago

OK, I've tried this again from scratch.

This is a brand-new linux install, so some utilities were not installed. I've been doing various apt-get installs and now I have everything I need. I wish I had paid a little more attention, because then we could modify the cmake build to expressly ensure that all the utilities it needs are present.

But I'll be repeating this on another new linux box soon, and will pay closer attention.

I also turned off the MPICH build. Now make all works! ;-)

But make install fails:

(base) ed@mikado:~/ne2/build$ sudo make install
[sudo] password for ed: 
make: *** No rule to make target 'install'.  Stop.
climbfuji commented 4 years ago

Ed, please have a look at the README.md in https://github.com/NOAA-EMC/NCEPLIBS-external/, section "get and build the code", as well as https://github.com/NOAA-EMC/NCEPLIBS-external/tree/master/doc/ and in there the step-by-step instructions for ubuntu and redhat. There is no "make install" step for the NCEPLIBS-external, because the "make" process does all of that (essentially because the top-level cmake+make trigger the full build and install process). This is not the standard, admittedly, but at least it is described in the documentation.

edwardhartnett commented 4 years ago

@climbfuji thanks for all your help!

Can we modify the build so that make all and make install work as expected?

Ideally we would also like make test to work, by running the test suite of each of these packages. In fact, it's pretty important that the netCDF C and Fortran test suites be run.

It seems that all the packages in NCEPLIBS-external have well-behaved build systems, except esmf and wgrib2. Have you approached those teams and asked them to provide a standard build system?

climbfuji commented 4 years ago

@climbfuji thanks for all your help!

Can we modify the build so that make all and make install work as expected?

Ideally we would also like make test to work, by running the test suite of each of these packages. In fact, it's pretty important that the netCDF C and Fortran test suites be run.

It seems that all the packages in NCEPLIBS-external have well-behaved build systems, except esmf and wgrib2. Have you approached those teams and asked them to provide a standard build system?

Indeed - we are currently working on an update (or replacement) of NCEPLIBS-external for the v1.1.0 release of the UFS Medium-Range Weather App and the v1.0.0 release of the UFS Short-Range Weather App. We are also working on ways to integrate the ESMF and wgrib2 builds better.