0

I am trying to install (https://github.com/NOAA-EMC/NCEPLIBS) for a post processing toolkit. I have downloaded and installed the required libraries to a build folder:

#############################Compilers#######################
    export CC=gcc
    export CXX=g++
    export FC=gfortran
    export F77=gfortran
            
    #############################zlib############################
    #Uncalling compilers due to comfigure issue with zlib1.2.12
    #With CC & CXX definied ./configure uses different compiler Flags
    cd $HOME/WRF/Downloads
    tar -xvzf v1.2.12.tar.gz
    cd zlib-1.2.12/
    CC= CXX= ./configure --prefix=$DIR/grib2
    make
    make install
    make check
     
#############################libpng###########################
    cd $HOME/WRF/Downloads
    export LDFLAGS=-L$DIR/grib2/lib
    export CPPFLAGS=-I$DIR/grib2/include
    tar -xvzf libpng-1.6.37.tar.gz
    cd libpng-1.6.37/
    ./configure --prefix=$DIR/grib2
    make
    make install
    make check
    ##############################Llibjpeg#########################
    #Used for nceplibs only
    cd $HOME/WRF/Downloads
    export LDFLAGS=-L$DIR/grib2/lib
    export CPPFLAGS=-I$DIR/grib2/include
    tar -xvzf jpegsrc.v9.tar.gz
    cd jpeg-9
    ./configure --prefix=$DIR/grib2
    make 
    make install
    #############################JasPer############################
    cd $HOME/WRF/Downloads
    unzip jasper-1.900.1.zip
    cd jasper-1.900.1/
    autoreconf -i
    ./configure --prefix=$DIR/grib2
    make
    make install
    
    export JASPERLIB=$DIR/grib2/lib
    export JASPERINC=$DIR/grib2/include
    ##############################MPICH############################
    cd $HOME/WRF/Downloads
    tar -xvzf mpich-4.0.2.tar.gz
    cd mpich-4.0.2/
    ./configure --prefix=$DIR/MPICH --with-device=ch3 FFLAGS=-fallow-argument-mismatch FCFLAGS=-fallow-argument-mismatch
    make
    make install
    make check
    
    export PATH=$DIR/MPICH/bin:$PATH
    
    #############################hdf5 library for netcdf4 functionality############################
    cd $HOME/WRF/Downloads
    tar -xvzf hdf5-1_12_2.tar.gz
    cd hdf5-hdf5-1_12_2
    ./configure --prefix=$DIR/grib2 --with-zlib=$DIR/grib2 --enable-hl --enable-fortran
    make 
    make install
    make check
    
    export HDF5=$DIR/grib2
    export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
    
    ##############################Install NETCDF C Library############################
    cd $HOME/WRF/Downloads
    tar -xzvf v4.8.1.tar.gz
    cd netcdf-c-4.8.1/
    export CPPFLAGS=-I$DIR/grib2/include 
    export LDFLAGS=-L$DIR/grib2/lib
    ./configure --prefix=$DIR/NETCDF --disable-dap
    make 
    make install
    make check
    
    export PATH=$DIR/NETCDF/bin:$PATH
    export NETCDF=$DIR/NETCDF
    
    ##############################NetCDF fortran library############################
    cd $HOME/WRF/Downloads
    tar -xvzf v4.5.4.tar.gz
    cd netcdf-fortran-4.5.4/
    export LD_LIBRARY_PATH=$DIR/NETCDF/lib:$LD_LIBRARY_PATH
    export CPPFLAGS=-I$DIR/NETCDF/include 
    export LDFLAGS=-L$DIR/NETCDF/lib
    ./configure --prefix=$DIR/NETCDF --disable-shared
    make 
    make install
    make check

And now I am executing the install commands for nceplibs:

cd $HOME/WRF/Downloads
git clone https://github.com/NOAA-EMC/NCEPLIBS
cd NCEPLIBS
mkdir -p build && cd build
export CC=gcc
export FC=gfortran
export CXX=g++
export FFLGAS=-fallow-argument-mismatch
export FCFLAGS=-fallow-argument-mismatch

export JPEG_LIBRARY=/home/will/WRF/Libs/grib2/lib
export JPEG_INCLUDE_DIR=/home/will/WRF/Libs/grib2/include
export JASPER_LIBRARIES=/home/will/WRF/Libs/grib2/lib
export JASPER_INCLUDE_DIR=/home/will/WRF/Libs/grib2/include

export INSTALL_PREFIX=$HOME/WRF/Libs/nceplibs
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
make
make install

However whenever I try to run the make command it comes up saying that the exports for JASPER & JPEG are not found. I believe it has to do with cmake but I am not 100% certain.

This is the error I see on my terminal.

[ 39%] Completed 'w3nco'
[ 40%] Built target w3nco
[ 41%] Performing update step for 'g2'
[ 42%] No patch step for 'g2'
[ 42%] Performing configure step for 'g2'
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) 
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR
  JPEG_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindJasper.cmake:62 (find_package_handle_standard_args)
  CMakeLists.txt:24 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/will/WRF/Downloads/NCEPLIBS/build/g2/src/g2-build/CMakeFiles/CMakeOutput.log".
make[2]: *** [CMakeFiles/g2.dir/build.make:92: g2/src/g2-stamp/g2-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:348: CMakeFiles/g2.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I am not sure if I have to put those values to the $PATH for them to be picked up by cmake or if there is a command I am missing.

Nic3500
  • 8,144
  • 10
  • 29
  • 40
  • typing `cmake --version` to see if it matches with a version that NCEPLIBS tested. which is **cmake-3.16.3**. if not, remove and install the specific version (you can find its tarball from https://cmake.org/files/v3.16/ , and then rebuild NCEPLIBS – paulyang0125 Jun 01 '22 at 01:50
  • Newer cmake might be the issue? Wouldn't it be backwards compatible? –  Jun 01 '22 at 02:01
  • you're troubleshooting environment setup issues so I suggest you satisfy NCEPLIBS SW requirements (https://github.com/NOAA-EMC/NCEPLIBS#required-software) first and then if that configs works, you can start to narrow down which one caused your issue. – paulyang0125 Jun 01 '22 at 05:43
  • I'll give that a try and see what happens –  Jun 01 '22 at 07:21
  • If you **install** libraries (zlib, libpng, etc.) into **custom prefix**, then you need to tell CMake about that prefix. The simplest way is to assign this prefix to `CMAKE_PREFIX_PATH` variable, as describe in [that my answer](https://stackoverflow.com/a/34797156/3440745). We such setting CMake should be able to find all these libraries without library-specific hints. – Tsyvarev Jun 01 '22 at 19:06
  • Are you deleting the cache between your CMake runs? If it is not found the first time, CMake caches the result. You adjust your variables, but CMake just reads the cached result. – usr1234567 Jun 01 '22 at 19:36
  • nope, i think there is something missing from the install directory. –  Jun 01 '22 at 21:51
  • @Tsyvarev Still running into issues, any chance you'd be willing to help me via a webcall? –  Jun 02 '22 at 15:31
  • @Tsyvarev So something link this???? CMAKE_JASPER_LIBRARIES_PATH=/home/will/WRF/Libs/grib2/lib –  Jun 04 '22 at 20:05
  • Once again, the variables listed under "missing:" clause are NOT the ones you should specify with `-D` parameter to `cmake`. If you want to know which variable you could set, then see documentation for a specific `FindXXX.cmake` script. E.g. for Jasper it is [FindJasper](https://cmake.org/cmake/help/latest/module/FindJasper.html) script, to which you could hint with `JASPER_INCLUDE_DIR`, `JASPER_LIBRARY_RELEASE` and `JASPER_LIBARRY_DEBUG` (cached) variables. But again, in your case the simplest way is to set `CMAKE_PREFIX_PATH` variable. I don't know why you are avoiding this. – Tsyvarev Jun 05 '22 at 08:16
  • @Tsyvarev not sure of the syntax –  Jun 05 '22 at 08:46
  • Trying to figure out how to use it –  Jun 05 '22 at 08:47
  • "not sure of the syntax" - What syntax you are not sure about? If you want to set `CMAKE_PREFIX_PATH`, then the syntax in the [answer](https://stackoverflow.com/a/34797156/3440745) I referenced in my [previous comment](https://stackoverflow.com/questions/72455454/unfamiliar-with-cmake-possible-error-in-configuration?noredirect=1#comment128016169_72455454): `cmake -DCMAKE_PREFIX_PATH= ` – Tsyvarev Jun 05 '22 at 14:04

1 Answers1

0
 cmake -DCMAKE_PREFIX_PATH:PATH=$DIR/grib2 -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}  ..