首页 > 编程学习 > NetCDF库编译安装

NetCDF库编译安装

发布时间:2022/8/27 19:46:46

1. 准备

系统环境,全部是deepin系统自带,并无单独安装

deepin 20.6
gcc 8.3.0
g++ 8.3.0
cmake 3.22.1 

netcdf安装版本:此次使用最新4.9.0,系统为deepin 20.6,大于4.3.0

源码下载地址,下载netcdf-c-4.9.0.tar.gz

https://downloads.unidata.ucar.edu/netcdf/

 

netCDF-C Source Code

· CMake version 2.8.12 or greater.

· Optional Requirements:

o HDF5 Libraries for netCDF4/HDF5 support.

o libcurl for DAP support.

 

 2. 安装步骤

1. 需要先安装HDF5

2. 编译安装NetCDF

 

 3. 编译安装HDF5

下载源码包

https://www.hdfgroup.org/downloads/hdf5/

 

 解压后依次执行

sudo ./configure --prefix=/usr/local/hdf5

sudo make

sudo make install

sudo apt install hdf5-helpers
sudo apt-get install libhdf5-serial-dev

cd /usr/local/hdf5/share/hdf5_examples/c

sudo ./run-c-ex.sh

sudo h5cc -o h5_extend h5_extend.c

sudo ./h5_extend

4. 编译安装NetCDF

sudo apt install m4

sudo ./configure --prefix=/usr/local/netcdf4 LDFLAGS=-L/usr/local/hdf5/lib CPPFLAGS=-I/usr/local/hdf5/include

sudo make
sudo make install

5. 参考文档

[1].https://docs.unidata.ucar.edu/netcdf-c/current/netCDF-CMake.html

[2].https://www.cnblogs.com/zhml/p/15102214.html

[3].https://blog.csdn.net/skyvoice2/article/details/7455527

 

 

Copyright © 2010-2022 mfbz.cn 版权所有 |关于我们| 联系方式|豫ICP备15888888号