So I am trying to my nceblibs from NOAA-EMC (GitHub - NOAA-EMC/NCEPLIBS: Top level repo containing submodules for NCEPLIBS and associated dependencies for superproject builds)
These are the libraries I have installed on ubuntu 22.04.
- zlib 1.2.12
- libpng 1.6.37
- Jasper 1.900.1
- mpich 4.0.2
- hdf5 1.12.2
- netcdf-c 4.8.1
- netcdf-fortran 4.5.4
- libjpeg 9.1
- gcc/gfortran/g++ 11.2.0
I am exporting them to the bash terminal via these commands:
export CC=gcc
export FC=gfortran
export CXX=g++
export FFLAGS=-std=legacy
export FCFLAGS=-std=legacy
export JPEG_LIBRARY=$DIR/grib2/lib
export JPEG_INCLUDE_DIR=$DIR/grib2/include
export JASPER_LIBRARIES=$DIR/grib2/lib
export JASPER_INCLUDE_DIR=$DIR/grib2/include
export INSTALL_PREFIX=$HOME/WRF/Libs/nceplibs
I run cmake to build the make files using:
cmake -DJPEG_LIBRARIES=${JPEG_LIBRARY} -DJASPER_LIBRARIES=${JASPER_LIBRARIES} -DJASPER_INCLUDE_DIR=${JASPER_INCLUDE_DIR} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
The output is from cmake is:
-- The C compiler identification is GNU 11.2.0
-- The Fortran compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/gfortran - skipped
-- Setting build type to 'Release' as none was specified.
-- Installing NCEPLIBS from /home/will/WRF/Downloads/NCEPLIBS/COMPONENTS
-- Installing NCEPLIBS at /home/will/WRF/Libs/nceplibs
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
JASPER_INCLUDE_DIR
JASPER_LIBRARIES
JPEG_LIBRARIES
Now I need JASPER_INCLUDE_DIR, JASPER_LIBRARIES, JPEG_LIBRARIES to execute make.
When I execute make without them in the cmakecache.txt file this happens.
[ 43%] Performing configure step for 'g2'
-- The C compiler identification is GNU 11.2.0
-- The Fortran compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/gfortran - skipped
-- Setting build type to 'Release' as none was specified.
-- 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:
Now I have heard that you can use CMAKE_LIBRARY_PATH or CMAKE_PREFIX_PATH to get these libraries into cache file. But I am not sure how to do this. Why isn’t the exports working for the calls?
I have tried to manually put them into cmake.cache.txt using this:
JASPER_INCLUDE_DIR:UNINITIALIZED=/home/will/WRF/Libs/grib2/include
JASPER_LIBRARIES:UNINITIALIZED=/home/will/WRF/Libs/grib2/lib
JPEG_LIBRARIES:UNINITIALIZED=/home/will/WRF/Libs/grib2/lib
But I am not sure if I am doing the format correctly.
Any ideas would be helpful.