当前位置: 首页 > article >正文

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

目录

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.kler.cn/a/408256.html

相关文章:

  • 如何配置 Gitea 的邮箱功能
  • SpringBoot多文件上传
  • IDEA配置本地maven
  • AMD(Xilinx) FPGA配置Flash大小选择
  • Java 基础知识 (集合框架 + 并发编程 + JVM 原理 + 数据结构与算法)
  • webpack基础配置
  • 骑砍2霸主MOD开发(29)-顶点动画
  • # DBeaver 连接hive数仓
  • 标贝科技大模型声音复刻 快速获取高品质专属AI声音
  • 【Rhino】【Python】Create a series of Blocks according to Value of object Property
  • 【042C】基于51RFID门禁系统(LCD12864显示)【Proteus仿真+Keil程序+报告+原理图】
  • Java基础:日期时间相关类
  • python基础导包
  • springmvc-04-Controller及RestFul
  • cocos creator 3.8 3D模型、天空盒、雾 6
  • 基于SpringBoot的京东绿谷旅游信息服务平台设计与实现(源码+定制+开发)
  • 第六届国际科技创新学术交流大会暨新能源科学与电力工程国际学术会议(NESEE 2024)
  • [高阶数据结构三] B-树详解
  • 【Linux】线程的互斥和同步
  • AirScreen 安卓平板作为MacOS副屏
  • 【淘汰9成NLP面试者的高频面题】LSTM中的tanh和sigmoid分别用在什么地方?为什么?
  • postgresql按照年月日统计历史数据
  • VMware16安装macOS12【详细教程】
  • docker 相关命令
  • 力扣 最大数组和-53
  • SQL99版全外连接和交叉连接和总结