R虚拟环境中安装ncdf4库包编译库问题

news/2024/11/25 9:39:06/

目录

R虚拟环境中安装ncdf4的问题

解决方案


R虚拟环境中安装ncdf4的问题

> install.packages("ncdf4")
trying URL 'https://mirrors.bfsu.edu.cn/CRAN/src/contrib/ncdf4_1.23.tar.gz'
Content type 'application/octet-stream' length 125897 bytes (122 KB)
==================================================
downloaded 122 KB

* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
** using staged installation
configure.ac: starting
checking for nc-config... yes
Using nc-config: nc-config
Output of nc-config --all:

This netCDF 4.9.2 has been built with the following features: 

  --cc            -> /usr/bin/cc
  --cflags        -> -I/usr/include -I/usr/include/hdf5/serial
  --libs          -> -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf
  --static        -> -lhdf5_hl -lhdf5 -lcrypto -lcurl -lpthread -lsz -lz -ldl -lm -lxml2


  --has-dap          -> yes
  --has-dap2         -> yes
  --has-dap4         -> yes
  --has-nc2          -> yes
  --has-nc4          -> yes
  --has-hdf5         -> yes
  --has-hdf4         -> no
  --has-logging      -> no
  --has-pnetcdf      -> no
  --has-szlib        -> no
  --has-cdf5         -> yes
  --has-parallel4    -> no
  --has-parallel     -> no
  --has-nczarr       -> yes
  --has-zstd         -> yes
  --has-benchmarks   -> no
  --has-multifilters -> no
  --has-stdfilters   -> deflate szip bz2
  --has-quantize     -> no

  --prefix        -> /usr
  --includedir    -> /usr/include
  --libdir        -> /usr/lib/x86_64-linux-gnu
  --plugindir     -> 
  --version       -> netCDF 4.9.2

---
netcdf.m4: about to set rpath, here is source string: >-L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf<
netcdf.m4: final rpath:   -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu/hdf5/serial
Netcdf library version: netCDF 4.9.2
Netcdf library has version 4 interface present: yes
Netcdf library was compiled with C compiler: /usr/bin/cc
configure: creating ./config.status
config.status: creating src/Makevars
 
**********************  Results of ncdf4 package configure *******************
 
netCDF v4 CPP flags      = -I/usr/include -I/usr/include/hdf5/serial
netCDF v4 LD flags       =   -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu/hdf5/serial -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/home/langyang/Tools/anaconda3/2024.02/envs/R/lib -Wl,-rpath-link,/home/langyang/Tools/anaconda3/2024.02/envs/R/lib -L/home/langyang/Tools/anaconda3/2024.02/envs/R/lib
netCDF v4 runtime path   =   -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu/hdf5/serial
 
netCDF C compiler used   = /usr/bin/cc
R      C compiler used   = x86_64-conda-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/langyang/Tools/anaconda3/2024.02/envs/R/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1732138515749/work=/usr/local/src/conda/r-base-4.4.2 -fdebug-prefix-map=/home/langyang/Tools/anaconda3/2024.02/envs/R=/usr/local/src/conda-prefix
 
******************************************************************************
 
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-conda-linux-gnu-cc accepts -g... yes
checking for x86_64-conda-linux-gnu-cc option to accept ISO C89... none needed
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-conda-linux-gnu-cc accepts -g... (cached) yes
checking for x86_64-conda-linux-gnu-cc option to accept ISO C89... (cached) none needed
netcdf cc arg1: /usr/bin/cc  R cc arg1: x86_64-conda-linux-gnu-cc R_IS_GCC: 1 R_IS_CLANG: 0 NETCDF_IS_GCC: 1 NETCDF_IS_CLANG: 0  emit_warning: 0
** libs
using C compiler: ‘x86_64-conda-linux-gnu-cc (conda-forge gcc 14.2.0-1) 14.2.0’
x86_64-conda-linux-gnu-cc -I"/home/langyang/Tools/anaconda3/2024.02/envs/R/lib/R/include" -DNDEBUG -I/usr/include -I/usr/include/hdf5/serial  -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/langyang/Tools/anaconda3/2024.02/envs/R/include -I/home/langyang/Tools/anaconda3/2024.02/envs/R/include -Wl,-rpath-link,/home/langyang/Tools/anaconda3/2024.02/envs/R/lib    -fpic  -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/langyang/Tools/anaconda3/2024.02/envs/R/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1732138515749/work=/usr/local/src/conda/r-base-4.4.2 -fdebug-prefix-map=/home/langyang/Tools/anaconda3/2024.02/envs/R=/usr/local/src/conda-prefix  -c ncdf.c -o ncdf.o
In file included from ncdf.c:2:
/usr/include/stdio.h:28:10: fatal error: bits/libc-header-start.h: No such file or directory
   28 | #include <bits/libc-header-start.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [/home/langyang/Tools/anaconda3/2024.02/envs/R/lib/R/etc/Makeconf:197: ncdf.o] Error 1
ERROR: compilation failed for package ‘ncdf4’

* removing ‘/home/langyang/Tools/anaconda3/2024.02/envs/R/lib/R/library/ncdf4’

The downloaded source packages are in
    ‘/tmp/RtmpHKNVpO/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("ncdf4") :
  installation of package ‘ncdf4’ had non-zero exit status
 

安装nc-config文件

sudo apt install netcdf-bin
sudo apt install libnetcdf-dev
install.packages("devtools")

解决方案

参考https://stackoverflow.com/questions/54082459/fatal-error-bits-libc-header-start-h-no-such-file-or-directory-while-compili

原因是:使用了-32指令,我的服务器是64位的,无法直接编译执行32位机器指令

Install 32-bit headers and libraries. Here's how you'd do this on Ubuntu.

Run this command:

sudo apt install gcc-multilib

卸载nc-config文件

sudo apt remove --auto-remove libnetcdf-dev

http://www.ppmy.cn/news/1549785.html

相关文章

统计学习方法中的模型评估与模型选择

一、训练误差与测试误差 1、预测 统计学习的目的是使学到的模型不仅对已知数据而且对未知数据都能有很好的预测能力。 不同的学习方法会给出不同的模型。 当损失函数给定时&#xff0c; 基于损失函数的模型的训练误差(training error)和模型的测试误差(test error)就是学习方…

TCP(Transmission Control Protocol,传输控制协议)报文段的首部格式

---------------------------------------------------------------- | 源端口 | 目的端口 | 序号 | 确认号 | | 2字节 | 2字节 | 4字节 | 4字节 | ---------------------------------------------------…

2024年亚太地区数学建模大赛C题-宠物行业及相关行业的发展分析与策略

随着人们消费理念的发展&#xff0c;宠物产业这一新兴产业&#xff0c;由于经济的快速发展和人均收入的不断增长&#xff0c;在全球范围内逐渐发展起来。1992年&#xff0c;中国小动物保护协会成立&#xff0c;1993年&#xff0c;皇家犬犬和火星等国际宠物品牌进入中国市场。随…

11 —— 打包模式的应用

需求&#xff1a;在开发模式下想让webpack使用style-loader进行css样式的处理&#xff1b;让它把css代码内嵌在js中&#xff1b;在生产模式下提取css代码 —— 判断当前运行命令时所在的环境 方案&#xff1a;借助cross-env全局软件包&#xff0c;设置参数区分打包运行环境 …

Nodejs开发仿马蜂窝旅游小程序API接口,服务器端开发,商家后台 Vue3+微信小程序+koa+mongodb+node.js

文章目录 &#x1f680; 开启您的互联网创业新篇章一、&#x1f525; 课程亮点&#xff1a;二、&#x1f310; 适合人群&#xff1a;学习这个课程后&#xff0c;您将会收获到三、旅游后台管理系统1.后台登录界面2.后台首页 四、前台旅游小程序1.首页展示2.目的地界面3.搜索功能…

P1 练习卷(C++4道题)

1.纷繁世界 内存限制&#xff1a;256MB 时间限制&#xff1a;1s 问题描述 这是一个纷繁复杂的世界。 某一天清晨你起床很迟&#xff0c;没有吃上早饭。于是你骑着自行车去超市&#xff0c;但是你又发现商店的工作人员已经重新贴上了价格标签&#xff0c;零食价格都涨了50%。你…

C++ 函数全解

引言 在C编程中&#xff0c;函数是程序的基本构建块之一。函数可以将代码组织成可重用的模块&#xff0c;提高代码的可读性和可维护性。本文将详细介绍C函数的各种特性&#xff0c;包括函数的定义、调用、参数传递、返回值、重载、内联函数、递归函数、函数指针、Lambda 函数、…

Unity中动态生成贴图并保存成png图片实现

实现原理&#xff1a; 要生成长x宽y的贴图&#xff0c;就是生成x*y个像素填充到贴图中&#xff0c;如下图&#xff1a; 如果要改变局部颜色&#xff0c;就是从x1到x2(x1<x2),y1到y2(y1<y2)这个范围做处理&#xff0c; 或者要想做圆形就是计算距某个点&#xff08;x1,y1&…