Weiming-Hu / AnalogsEnsemble

The C++ and R packages for parallel ensemble forecasts using Analog Ensemble
https://weiming-hu.github.io/AnalogsEnsemble/
MIT License
18 stars 5 forks source link

Installation issue on a local machine without Internet connection #121

Closed lovechang1986 closed 2 years ago

lovechang1986 commented 2 years ago

Download the boost_1_77_0.tar.bz2 from www.boost.org. Then tar and use code to install below:

tar -zxvf boost_1_77_0.tar.bz2
cd boost_1_77_0
./bootstrap.sh --prefix=/home/software/boost
./b2 install

After..

>>> CC=gcc CXX=g++ cmake -DBUILD_BOOST=ON -DENABLE_AI=on -DCMAKE_PREFIX_PATH="/usr/local/enccodes;/opt/AnalogsEnsemble;/home/software/libtorch;/home/software/boost" ..

-- The C compiler identification is GNU 9.3.1
-- The CXX compiler identification is GNU 9.3.1
-- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/gcc
-- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/gcc -- 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: /opt/rh/devtoolset-9/root/usr/bin/g++
-- Check for working CXX compiler: /opt/rh/devtoolset-9/root/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- You are building PAnEn version 4.4.3 Pandora from GEOlab @ Penn State
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Torch: /home/software/libtorch/lib/libtorch.so  
-- 
*************************************

You have enabled the AI component!
Enjoy the power of AI!

*************************************
-- Installation rules will be disabled because boost-cmake does not support install rules
-- More information please refer to https://github.com/Orphis/boost-cmake/pull/45
-- Download source files for boost-cmake
正克隆到 '/home/software/AnalogsEnsemble-master/build/boost-cmake'...
fatal: 无法访问 'https://github.com/Orphis/boost-cmake.git/':Received HTTP code 400 from proxy after CONNECT
CMake Error at CMakeLists.txt:120 (add_subdirectory):
  add_subdirectory given source
  "/home/software/AnalogsEnsemble-master/build/boost-cmake" which is not an
  existing directory.

-- Configuring the library AnEn
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Configuring the library AnEnIO
-- Found eccodes: /opt/AnalogsEnsemble/lib64/libeccodes.so  
-- Found NetCDF: /opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf.so  
-- Configuring the library Grid
-- Configuring the executable anen_grib
-- Configuring the executable anen_netcdf
-- Configuring the executable grib_convert
-- Configuring the executable anen_transform
-- No tests built. Install CppUnit to automatically enable tests
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.5") found components:  doxygen missing components:  dot
-- Graphviz is NOT found. No DOT support.
-- Type 'make document' to generate C++ documentation.
-- 
**********************************************************************

If the build system generation is complete,
you can type 'make' or 'make -j <number of cores>' to build projects.

If you have set -DCMAKE_INSTALL_PREFIX=[path],
you can also type 'make install' to build and install projects

**********************************************************************
CMake Warning in CMakeLists.txt:
  CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have
  been specified

-- Configuring incomplete, errors occurred!
See also "/home/software/AnalogsEnsemble-master/build/CMakeFiles/CMakeOutput.log".
See also "/home/software/AnalogsEnsemble-master/build/CMakeFiles/CMakeError.log".
Weiming-Hu commented 2 years ago

You have specified -DBUILD_BOOST=ON and this forces cmake to build boost regardless. You might want to set -DBUILD_BOOST=OFF and try again (after cleaning your cache). Or even better, don't specify it at all. By default, it is OFF.

lovechang1986 commented 2 years ago
(base) [iekdjgheegg@localhost build]# CC=gcc CXX=g++ cmake -DBUILD_BOOST=OFF -DENABLE_AI=on -DCMAKE_PREFIX_PATH="/usr/local/enccodes;/opt/AnalogsEnsemble;/home/software/testtorch/libtorch;/home/software/boost" ..
-- The C compiler identification is GNU 9.3.1
-- The CXX compiler identification is GNU 9.3.1
-- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/gcc
-- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/gcc -- 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: /opt/rh/devtoolset-9/root/usr/bin/g++
-- Check for working CXX compiler: /opt/rh/devtoolset-9/root/usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- You are building PAnEn version 4.4.3 Pandora from GEOlab @ Penn State
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Torch: /home/software/testtorch/libtorch/lib/libtorch.so  
-- 
*************************************

You have enabled the AI component!
Enjoy the power of AI!

*************************************
-- Boost 1.58.0 found.
-- Configuring the library AnEn
-- Boost 1.58.0 found.
-- Found Boost components:
   date_time;serialization
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Configuring the library AnEnIO
-- Found eccodes: /opt/AnalogsEnsemble/lib64/libeccodes.so  
-- Found NetCDF: /opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf_c++4.so;/opt/AnalogsEnsemble/lib/libnetcdf.so  
-- Boost 1.58.0 found.
-- Found Boost components:
   date_time;filesystem
-- Configuring the library Grid
-- Boost 1.58.0 found.
-- Found Boost components:
   filesystem
-- Configuring the executable anen_grib
-- Boost 1.58.0 found.
-- Found Boost components:
   program_options
-- Configuring the executable anen_netcdf
-- Boost 1.58.0 found.
-- Found Boost components:
   program_options
-- Configuring the executable grib_convert
-- Boost 1.58.0 found.
-- Found Boost components:
   program_options
-- Configuring the executable anen_transform
-- Boost 1.58.0 found.
-- Found Boost components:
   program_options
-- No tests built. Install CppUnit to automatically enable tests
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.5") found components:  doxygen missing components:  dot
-- Graphviz is NOT found. No DOT support.
-- Type 'make document' to generate C++ documentation.
-- 
**********************************************************************

If the build system generation is complete,
you can type 'make' or 'make -j <number of cores>' to build projects.

If you have set -DCMAKE_INSTALL_PREFIX=[path],
you can also type 'make install' to build and install projects

**********************************************************************
-- Configuring done
-- Generating done
-- Build files have been written to: /home/software/AnalogsEnsemble-master/build
(base) [iekdjgheegg@localhost build]# make -j 16
Scanning dependencies of target Grid
[  2%] Building CXX object CGrid/CMakeFiles/Grid.dir/src/Txt.cpp.o
[  5%] Building CXX object CGrid/CMakeFiles/Grid.dir/src/Grid.cpp.o
[  8%] Linking CXX static library libGrid.a
[  8%] Built target Grid
Scanning dependencies of target AnEn
[ 11%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/AnEn.cpp.o
[ 13%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/AnEnIS.cpp.o
[ 16%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/AnEnSSE.cpp.o
[ 19%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/AnEnSSEMS.cpp.o
[ 22%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/BasicData.cpp.o
[ 25%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Calculator.cpp.o
[ 27%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Array4DPointer.cpp.o
[ 30%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Config.cpp.o
[ 33%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Forecasts.cpp.o
[ 36%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/ForecastsPointer.cpp.o
[ 38%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Functions.cpp.o
[ 41%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Observations.cpp.o
[ 44%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/ObservationsPointer.cpp.o
[ 47%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Parameters.cpp.o
[ 50%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Profiler.cpp.o
[ 52%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Stations.cpp.o
[ 55%] Building CXX object CAnEn/CMakeFiles/AnEn.dir/src/Times.cpp.o
[ 58%] Linking CXX static library libAnEn.a
[ 58%] Built target AnEn
Scanning dependencies of target AnEnIO
[ 61%] Building CXX object CAnEnIO/CMakeFiles/AnEnIO.dir/src/AnEnReadGrib.cpp.o
[ 63%] Building CXX object CAnEnIO/CMakeFiles/AnEnIO.dir/src/AnEnWriteNcdf.cpp.o
[ 69%] Building CXX object CAnEnIO/CMakeFiles/AnEnIO.dir/src/ParameterGrib.cpp.o
[ 69%] Building CXX object CAnEnIO/CMakeFiles/AnEnIO.dir/src/Ncdf.cpp.o
[ 72%] Building CXX object CAnEnIO/CMakeFiles/AnEnIO.dir/src/AnEnReadNcdf.cpp.o
[ 75%] Building CXX object CAnEnIO/CMakeFiles/AnEnIO.dir/src/FunctionsIO.cpp.o
[ 77%] Linking CXX static library libAnEnIO.a
[ 77%] Built target AnEnIO
Scanning dependencies of target anen_grib
Scanning dependencies of target grib_convert
Scanning dependencies of target anen_transform
Scanning dependencies of target anen_netcdf
[ 80%] Building CXX object apps/anen_transform/CMakeFiles/anen_transform.dir/anen_transform.cpp.o
[ 83%] Building CXX object apps/anen_netcdf/CMakeFiles/anen_netcdf.dir/anen_netcdf.cpp.o
[ 88%] Building CXX object apps/anen_grib/CMakeFiles/anen_grib.dir/anen_grib.cpp.o
[ 88%] Building CXX object apps/grib_convert/CMakeFiles/grib_convert.dir/grib_convert.cpp.o
[ 91%] Linking CXX executable anen_transform
[ 91%] Built target anen_transform
[ 94%] Linking CXX executable grib_convert
[ 97%] Linking CXX executable anen_netcdf
[100%] Linking CXX executable anen_grib
[100%] Built target grib_convert
[100%] Built target anen_netcdf
[100%] Built target anen_grib
(base) [iekdjgheegg@localhost build]# make install -j 16
[  8%] Built target Grid
[ 58%] Built target AnEn
[ 77%] Built target AnEnIO
[ 83%] Built target anen_netcdf
[ 88%] Built target anen_transform
[ 94%] Built target anen_grib
[100%] Built target grib_convert
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libAnEn.a
-- Installing: /usr/local/lib/cmake/AnEnConfig.cmake
-- Installing: /usr/local/lib/cmake/AnEnConfig-noconfig.cmake
-- Installing: /usr/local/include/AnEn.h
-- Installing: /usr/local/include/AnEnIS.h
-- Installing: /usr/local/include/AnEnIS.tpp
-- Installing: /usr/local/include/AnEnSSE.h
-- Installing: /usr/local/include/AnEnSSE.tpp
-- Installing: /usr/local/include/AnEnSSEMS.h
-- Installing: /usr/local/include/Array4D.h
-- Installing: /usr/local/include/Array4DPointer.h
-- Installing: /usr/local/include/BasicData.h
-- Installing: /usr/local/include/BmDim.h
-- Installing: /usr/local/include/Calculator.h
-- Installing: /usr/local/include/Config.h
-- Installing: /usr/local/include/Forecasts.h
-- Installing: /usr/local/include/ForecastsPointer.h
-- Installing: /usr/local/include/Functions.h
-- Installing: /usr/local/include/Functions.tpp
-- Installing: /usr/local/include/Observations.h
-- Installing: /usr/local/include/ObservationsPointer.h
-- Installing: /usr/local/include/Parameters.h
-- Installing: /usr/local/include/Profiler.h
-- Installing: /usr/local/include/Stations.h
-- Installing: /usr/local/include/Times.h
-- Installing: /usr/local/lib/libAnEnIO.a
-- Installing: /usr/local/lib/cmake/AnEnIOConfig.cmake
-- Installing: /usr/local/lib/cmake/AnEnIOConfig-noconfig.cmake
-- Installing: /usr/local/include/AnEnReadGrib.h
-- Installing: /usr/local/include/AnEnReadNcdf.h
-- Installing: /usr/local/include/AnEnReadNcdf.tpp
-- Installing: /usr/local/include/AnEnWriteNcdf.h
-- Installing: /usr/local/include/FunctionsIO.h
-- Installing: /usr/local/include/Ncdf.h
-- Installing: /usr/local/include/Ncdf.tpp
-- Installing: /usr/local/include/ParameterGrib.h
-- Installing: /usr/local/lib/libGrid.a
-- Installing: /usr/local/lib/cmake/GridConfig.cmake
-- Installing: /usr/local/lib/cmake/GridConfig-noconfig.cmake
-- Installing: /usr/local/include/Grid.h
-- Installing: /usr/local/bin/anen_grib
-- Set runtime path of "/usr/local/bin/anen_grib" to ""
-- Installing: /usr/local/bin/anen_netcdf
-- Set runtime path of "/usr/local/bin/anen_netcdf" to ""
-- Installing: /usr/local/bin/grib_convert
-- Set runtime path of "/usr/local/bin/grib_convert" to ""
-- Installing: /usr/local/bin/anen_transform
-- Set runtime path of "/usr/local/bin/anen_transform" to ""

But can't use the anen_transform...

(base) [iekdjgheegg@localhost build]# anen_transform 
anen_transform: error while loading shared libraries: libtorch.so: cannot open shared object file: No such file or directory
(base) [iekdjgheegg@localhost build]# anen_transform --help
anen_transform: error while loading shared libraries: libtorch.so: cannot open shared object file: No such file or directory
Weiming-Hu commented 2 years ago

OK. I have an idea for testing. Can you try if this one runs?

/home/software/AnalogsEnsemble-master/build/apps/anen_transform/anen_transform
Weiming-Hu commented 2 years ago

If the one under your build directory works, I suspect the reason is the library path is not preserved/specified after installation. You might want to specify additional runtime path for the program to find libraries at runtime.

CC=gcc CXX=g++ cmake \
    -DBUILD_BOOST=OFF -DENABLE_AI=on \
    -DCMAKE_PREFIX_PATH="/usr/local/enccodes;/opt/AnalogsEnsemble;/home/software/testtorch/libtorch;/home/software/boost" \
    -DCMAKE_INSTALL_RPATH="/usr/local/enccodes/lib;/opt/AnalogsEnsemble/lib;/home/software/testtorch/libtorch/lib;/home/software/boost/lib"..

Please note that I have added CMAKE_INSTALL_RPATH and /lib after each path in the list. Those lib directories should already be valid and there should be libraries under the lib folders. This basically tells the program to find necessary libraries under those directories in runtime.

You might have to re-run cmake, make, and make install to see changes.

lovechang1986 commented 2 years ago

works!!

Thanks...