<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Linux 下 R 源碼安裝指南

      ?? 本文章同步自作者的語雀知識庫,請點擊這里閱讀原文。

      如果你使用的 Linux 系統 GCC 版本太低, 又沒有 root 權限 (即使有 root 權限又擔心升級 GCC 帶來的風險) ; 同時你又不想入坑 conda, 但是你又希望安裝一個最新版本的 R, 那么恭喜你, 這篇普通用戶在 Linux 下源碼編譯安裝 R 的記錄剛好滿足了你想要的一切.。

      ?? 說明

      1. 本文檔以 R-3.6.0 為例, 但對于 R-3.6.x, R-4.0.x 的安裝同樣適用。
      2. 根據本教程,經過測試,以下版本均可以正常安裝成功。
        • R-4.0.3
        • R-4.1.2
        • R-4.3.0

      本教程在以下的安裝環境中,經過測試都可以正常操作:

      系統(版本) GCC 版本
      Red Hat Enterprise Linux Server release 6.5 (Santiago), x86_64 gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
      CentOS Linux release 7.6.1810 (Core), x86_64 gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
      openEuler 20.03 (LTS) gcc (GCC) 7.3.0

      1. 安裝命令

      R 源碼編譯安裝基本命令。

      # Rpy:--enable-R-shlib
      # download list:https://mirrors.ustc.edu.cn/CRAN/src/base/
      $ wget https://mirrors.ustc.edu.cn/CRAN/src/base/R-3/R-3.6.0.tar.gz 
      $ tar zxvf R-3.6.0.tar.gz
      $ cd R-3.6.0
      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0  --enable-R-shlib --enable-BLAS-shlib  --with-blas   --with-lapack
      

      關于 R 相關的動態庫:

      • R 編譯的過程中,如果想要在其他語言中集成 R 就必須選擇--enable-R-shlib選項,將 R 編譯成 lib 模式,在此模式下,會生成 path-to-R/lib/libR.so庫——將 R 編譯成動態庫(libR.so),然后 R 的執行程序與之鏈接;
        • 例如,如果不編譯生成 libR.so,在安裝 rpy2(Python 中的 R 語言接口模塊) 時就無法正確編譯。
      • 同時,確保同目錄下 libRblas.so,libRlapack.so 兩個鏈接庫也被正確生成,這兩個庫默認會生成,如果沒有,需要添加參數:--enable-BLAS-shlib,--with-blas,--with-lapack

      2. 基礎環境

      • configure: error: No Fortran compiler found
      # Ubuntu/Debian
      apt install gfortran
      
      # RHEL/openEluer
      yum install gcc-gfortran
      
      • configure: error: C++ preprocessor "/lib/cpp" fails sanity check
      # Ubuntu/Debian
      apt install build-essential
      apt install g++
      
      # RHEL/openEluer
      yum install glibc-headers
      yum install gcc-c++
      

      3. 各種庫和依賴解決

      R 源碼編譯安裝的時候需要的各種依賴庫比較多,如果你有 root 的權限,建議使用 yum/apt 等系統命令解決;如果沒有 root 權限,可以手動一個個去解決。

      3.1 自動處理

      針對 RHEL/Debian 一些常見的依賴,使用 yum/apt 自動解決的示例。

      • configure: error: --with-readline=yes (default) and headers/libs are not available
      # Ubuntu/Debian
      apt install install libreadline-dev
      
      # RHEL/openEluer
      yum install readline-devel 
      
      • configure: error: --with-x=yes (default) and X11 headers/libs are not available
      # Ubuntu/Debian
      apt install libx11-dev xorg-dev libcurl4-openssl-dev
      
      # RHEL/openEluer
      yum install xorg-x11-server-devel libX11-devel libXt-devel
      
      • configure: error: "liblzma library and headers are required"
      # Ubuntu/Debian
      apt install liblzma-dev
      
      # RHEL/openEluer
      yum install lzma-devel xz xz-devel
      
      • configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support
      # Ubuntu/Debian
      apt install libpcre2-dev
      
      # RHEL/openEluer 
      yum install pcre pcre-devel			# 安裝 PCRE1
      yum install pcre2 pcre2-devel		# 安裝 PCRE2
      
      • configure: error: libcurl >= 7.28.0 library and headers are required with support for https
      # Ubuntu/Debian
      apt install libcurl4-openssl-dev
      
      # RHEL/openEluer 
      yum install libcurl-devel
      

      JPEG

      R 安裝過程中默認開啟 --with-jpeglib(use jpeglib library (if available) [yes]),但是相關的依賴沒有,依然可以正常安裝(沒有任何報錯),但最后會提示:Capabilities skipped: JPEG!

      # Ubuntu/Debian
      yum install libjpeg-dev
      
      # RHEL/openEluer 
      yum install libjpeg-devel
      

      TIFF

      R 安裝過程中默認開啟 --with-tifflib(use libtiff library (if available) [yes]),但是相關的依賴沒有,依然可以正常安裝(沒有任何報錯),但最后會提示:Capabilities skipped: TIFF!

      # Ubuntu/Debian
      yum install libtiff-dev
      
      # RHEL/openEluer 
      yum install libtiff-devel
      

      cairo

      R 安裝過程中默認開啟 --with-cairo(use cairo (and pango) if available [yes]),但是相關的依賴沒有,依然可以正常安裝(沒有任何報錯),但最后會提示:Capabilities skipped: cairo!

      # Ubuntu/Debian
      apt install libcairo2-dev libxt-dev
      
      # RHEL/openEluer 
      yum install cairo-devel
      

      ICU

      R 安裝過程中默認開啟 --with-ICU(use ICU library (if available) [yes]),如果不可用,最后會提示:Capabilities skipped: ICU!

      # Ubuntu/Debian
      apt install libicu-dev
      
      # RHEL/openEluer 
      yum install libicu libicu-devel
      

      3.2 手動處理

      以下是一些常見的依賴手動解決的示例,可以參考。

      zlib

      根據《R Installation and Administration: A.1 Essential programs and libraries》官方文檔,zlib (version 1.2.5 or later),至少需要 1.2.5 及以上版本。

      Installations ofzlib(version 1.2.5 or later), libbz2(version 1.0.6 or later: called bzip2-libs/bzip2-devel or libbz2-1.0/libbz2-dev by some Linux distributions) andliblzmaversion 5.0.3 or later are required.

      報錯:
      checking for zlib.h... yes
      checking if zlib version >= 1.2.5... no
      checking whether zlib support suffices... configure: error: zlib library and headers are required  
      ## 缺少zlib或者zlib版本過低, 要求 zlib 版本 >= 1.2.5 
      
      # download list:http://www.zlib.net/fossils/
      $ wget http://www.zlib.net/fossils/zlib-1.2.6.tar.gz
      $ tar xvf zlib-1.2.6.tar.gz
      $ cd zlib-1.2.6
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/zlib-1.2.6
      $ make && make install
      

      接著安裝 R-3.6.0:

      $ cd ../R-3.6.0
      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0  --enable-R-shlib LDFLAGS="-L/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/lib" CPPFLAGS="-I/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/include"
      
          報錯:
          checking for zlib.h... yes
          checking if zlib version >= 1.2.5... yes
          checking whether zlib support suffices... yes
          checking mmap support for zlib... yes
          checking for BZ2_bzlibVersion in -lbz2... yes
          checking bzlib.h usability... yes
          checking bzlib.h presence... yes
          checking for bzlib.h... yes
          checking if bzip2 version >= 1.0.6... no
          checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required
          ## zlib 版本已經符合要求,bzip2 版本要求 >= 1.0.6
      

      bzip2 or libbz2

      根據《R Installation and Administration: A.1 Essential programs and libraries》官方文檔, libbz2 (version 1.0.6 or later: called bzip2-libs/bzip2-devel or libbz2-1.0/libbz2-dev by some Linux distributions),至少需要 1.0.6 及以上版本.

      $ wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
      $ tar zvxf bzip2-1.0.6.tar.gz
      $ cd bzip2-1.0.6
      $ make -f Makefile-libbz2_so
      $ make clean
      $ make
      $ make install PREFIX=/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6
      

      重新安裝 R-3.6.0:

      $ cd ../R-3.6.0
      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0  --enable-R-shlib LDFLAGS="-L/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/lib -L/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/lib" CPPFLAGS="-I/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/include -I/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/include"
      
          報錯:
          checking if bzip2 version >= 1.0.6... yes
          checking whether bzip2 support suffices... yes
          checking for lzma_version_number in -llzma... yes
          checking lzma.h usability... yes
          checking lzma.h presence... yes
          checking for lzma.h... yes
          checking if lzma version >= 5.0.3... yes
          checking for pcre_fullinfo in -lpcre... no
          checking whether PCRE support suffices... configure: error: pcre >= 8.10 library and headers are required
          ## 要求 pcre >= 8.10 (同時要求 pcre < 10.0, 否則再次安裝 R-3.6.0 時報錯)
          
          # 安裝 pcre-8.12,configure 編譯 R-3.6.0 時報錯:
          checking for pcre/pcre.h... no
          checking if PCRE version >= 8.10, < 10.0 and has UTF-8 support... no
          checking whether PCRE support suffices... configure: error: pcre >= 8.10 library and headers are required
          # PCRE 安裝需要 --enable-utf8,同時版本 >= 8.10 且 < 10.0
      

      PCRE

      在《R Installation and Administration: A.1 Essential programs and libraries》官方文檔中要求, PCRE 版本最好在 8.32 及以上.

      Either PCRE1 (version 8.32 or later, formerly known as just PCRE) or PCRE2 is required: PCRE2 is preferred and using PCRE1 requires configure option --with-pcre1. Only the 8-bit library and headers are needed if these are packaged separately. JIT support (optional) is desirable for the best performance. For PCRE2 >= 10.30 (which is desirable as matching has been re-written not to use recursion and the Unicode tables were updated to version 10).

      # 源碼安裝 PCRE1
      $ wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz --no-check-certificate
      $ tar zvxf pcre-8.40.tar.gz
      $ cd pcre-8.40
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/pcre-8.40 --enable-utf8
      $ make -j3 && make install
      
      # root 安裝 PCRE1
      yum install pcre pcre-devel
      
      # 源碼的方式安裝 PCRE2,這里不介紹,跟源碼安裝 PCRE1 原理是一樣的,自己去谷歌就好
      # root 安裝 PCRE2
      yum install pcre2 pcre2-devel
      

      注意:

      1. R-3.4.2 要求 pcre 版本(>= 8.20, < 10.0);
      2. R-4.0.1 要求 PCRE >= 8.32 with UTF-8 support;
      3. configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support。R-4.0 以上在 configure 時,需要增加一個 --with-pcre1 參數;或者安裝 PCRE2!

      重新安裝 R-3.6.0:

      $ cd ../R-3.6.0
      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0  --enable-R-shlib LDFLAGS="-L/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/lib -L/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/lib -L/Bioinfo/SoftWare/NewLibs/pcre-8.40/lib" CPPFLAGS="-I/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/include -I/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/include -I/Bioinfo/SoftWare/NewLibs/pcre-8.40/include"
      
          報錯:
          checking curl/curl.h usability... yes
          checking curl/curl.h presence... yes
          checking for curl/curl.h... yes
          checking if libcurl is version 7 and >= 7.28.0... no
          configure: error: libcurl >= 7.28.0 library and headers are required with support for https
          # 需要安裝 curl >= 7.28.0
      

      curl or libcurl

      在《R Installation and Administration: A.1 Essential programs and libraries》要求, libcurl 大于或等于 7.22.0 版本。Library libcurl (version 7.22.0 or later) is required, with at least 7.28.0 being desirable.

      $ wget https://curl.haxx.se/download/curl-7.64.1.tar.gz --no-check-certificate
      $ tar zvxf curl-7.64.1.tar.gz
      $ cd curl-7.64.1
      
      ## 不指定證書
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/curl-7.64.1
      
      ## 指定證書(推薦)
      $ wget https://curl.haxx.se/ca/cacert.pem -O /Bioinfo/SoftWare/certs/ca-bundle.crt --no-check-certificate
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/curl-7.64.1 --with-ca-bundle=/Bioinfo/SoftWare/certs/ca-bundle.crt 
      
      $ make
      $ make install
      

      如果你有管理員的權限,你也可以使用 root 的方法直接安裝 libcurl:

      # CentOS 7.6 自帶的 libcurl 最新版本應該是 7.29.0-59.el7_9.1
      yum install libcurl libcurl-devel
      

      注意:

      1. 有些情況下,R 在鏈接一些在線數據庫,或者下載某些特殊包時,可能導致 SSL certificate problem: unable to get local issuer certificate 異常,這種情況可以通過 --with-ca-bundle 指定證書來解決。
      2. 參考下面的內容。

      R 語言關于 SSL 證書異常處理筆記

      重新安裝 R-3.6.0:

      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0  --enable-R-shlib LDFLAGS="-L/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/lib -L/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/lib -L/Bioinfo/SoftWare/NewLibs/pcre-8.40/lib -L/Bioinfo/SoftWare/NewLibs/curl-7.64.1/lib" CPPFLAGS="-I/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/include -I/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/include -I/Bioinfo/SoftWare/NewLibs/pcre-8.40/include -I/Bioinfo/SoftWare/NewLibs/curl-7.64.1/include"
      
      $ make 
      
          報錯:
          /Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/lib/libbz2.a: could not read symbols: Bad value
          collect2: ld returned 1 exit status
          make[3]: *** [libR.so] Error 1
          make[3]: Leaving directory `/home/shenweiyan/inst/R-3.6.0/src/main'
          make[2]: *** [R] Error 2
          make[2]: Leaving directory `/home/shenweiyan/inst/R-3.6.0/src/main'
          make[1]: *** [R] Error 1
          make[1]: Leaving directory `/home/shenweiyan/inst/R-3.6.0/src'
          make: *** [R] Error 1
          # 需要使用64位元的方法重新編譯 bzip2
      

      重裝 bzip2-1.0.6, 如下所示, 首先修改 bzip2-1.0.6 的 Makefile 文件:

      CC=gcc -fPIC
      AR=ar
      RANLIB=ranlib
      LDFLAGS=
      
      BIGFILES=-D_FILE_OFFSET_BITS=64
      

      然后, 重新編譯 bzip2-1.0.6:

      $ make clean
      $ make
      $ make install PREFIX=/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6
      

      liblzma

      在編譯過程中發現: "configure: error: "liblzma library and headers are required", 需要安裝 xz, 對應主頁: https://tukaani.org/xz/, 安裝如下:

      $ wget https://nchc.dl.sourceforge.net/project/lzmautils/xz-5.2.3.tar.gz
      $ tar zvxf xz-5.2.3.tar.gz
      $ cd xz-5.2.3/
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/xz-5.2.3
      $ make -j3
      $ make install
      

      libtiff

      R shell 中使用 capabilities() 可以查看 R 已經編譯支持的功能, 對于畫圖可以增加下面幾個參數, 使 R 支持對應格式的圖片保存, 與此同時要確保對應庫已經安裝.

      --with-cairo            use cairo (and pango) if available [yes]
      --with-libpng           use libpng library (if available) [yes]
      --with-jpeglib          use jpeglib library (if available) [yes]
      --with-libtiff          use libtiff library (if available) [yes]
      

      以 tiff 為例, 需要安裝 libtiff 庫:

      The bitmapped graphics devices jpeg(), png() and tiff() need the appropriate headers and libraries installed: jpeg (version 6b or later, or libjpeg-turbo) or libpng (version 1.2.7 or later) and zlib or libtiff(versions 4.0.[5-10] have been tested) respectively.

      $ wget ftp://download.osgeo.org/libtiff/tiff-4.0.9.zip
      $ unzip tiff-4.0.9.zip
      $ cd tiff-4.0.9
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/tiff-4.0.9
      $ make
      $ make install
      

      如果你有管理員權限,你也可以直接使用 root 直接安裝 libtiff:

      # CentOS 7.6 自帶的 libcurl 最新版本應該是 4.0.3-35.el7
      yum install libtiff libtiff-devel
      

      然后重新編譯 R-3.6.0:

      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0 --enable-R-shlib --with-libtiff LDFLAGS="-L/Bioinfo/SoftWare/NewLibs/tiff-4.0.9/lib" CPPFLAGS="-I/Bioinfo/SoftWare/NewLibs/tiff-4.0.9/include"
      

      如果 tiff 無法使用, 可以考慮在 ~/.bashrc 中添加 libtiff 庫路徑, 然后重新再編譯 R .

      export LD_LIBRARY_PATH=/Bioinfo/SoftWare/NewLibs/tiff-4.0.9/lib:$LD_LIBRARY_PATH
      export PKG_CONFIG_PATH=/Bioinfo/SoftWare/NewLibs/tiff-4.0.9/lib/pkgconfig:$PKG_CONFIG_PATH
      

      libjpeg and libpng16

      R 安裝完以后, 使用 plot 進行畫圖, 如果出現如下錯誤:

      > plot(1:0)
      Error in (function (display = "", width, height, pointsize, gamma, bg,  :
        X11 module cannot be loaded
      In addition: Warning message:
      In (function (display = "", width, height, pointsize, gamma, bg,  :
        unable to load shared object '/Bioinfo/SoftWare/R-3.6.0/lib64/R/modules//R_X11.so':
        libjpeg.so.9: cannot open shared object file: No such file or directory
      > quit()
      Save workspace image? [y/n/c]: n
      

      使用 ldd 命令如果看到 libjpeg.so.9、libpng16.so.16 not found,則可以考慮手動安裝這兩個包:

      $ /Bioinfo/SoftWare/R-3.6.0/bin/R CMD ldd /Bioinfo/SoftWare/R-3.6.0/lib64/R/modules//R_X11.so
              linux-vdso.so.1 =>  (0x00007fff3c79b000)
              libtiff.so.5 => /Bioinfo/SoftWare/NewLibs/tiff-4.0.9/lib/libtiff.so.5 (0x00007f75369dc000)
              libjpeg.so.9 => not found
              libpng16.so.16 => not found
              libpangocairo-1.0.so.0 => /usr/lib64/libpangocairo-1.0.so.0 (0x00007f75367ba000)
              libpango-1.0.so.0 => /usr/lib64/libpango-1.0.so.0 (0x00007f753656e000)
              libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f7536322000)
              ......
      

      libjpeg.so.9, libpng16.so.16 安裝步驟如下:

      $ wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz
      $ tar zvxf jpegsrc.v9c.tar.gz
      $ cd jpeg-9c
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/jpeg-9c
      $ make
      $ make install
      
      $ wget https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz
      $ tar zvxf libpng-1.6.37.tar.gz
      $ cd libpng-1.6.37
      $ ./configure --prefix=/Bioinfo/SoftWare/NewLibs/libpng-1.6.37
      $ make
      $ make install
      

      4. 完整編譯安裝命令

      如果使用了自定義安裝的 gcc/c++ 進行編譯, 需要在 configure 時候使用 CC/CXX 進行指定, 否則使用系統默認的 gcc/c++,由于 CentOS-6.5 默認的 gcc==4.4.7, 該版本的 gcc 會導致 R>=3.5.0 編譯出現各種錯誤,非 root 用戶手動升級 gcc 可以參考:
      非 root 用戶手動編譯安裝 GCC

      最后,CentOS 下 R 源碼安裝的完整 configure 命令如下(同樣適用于 Ubuntu/Debian):

      # 粘貼到命令行時,請把 \ 去掉,連成一行命令再回車執行
      $ ./configure --prefix=/Bioinfo/SoftWare/R-3.6.0 \
        CC=/Bioinfo/SoftWare/gcc-4.8.5/bin/gcc \
        CXX=/Bioinfo/SoftWare/gcc-4.8.5/bin/c++ \
        --enable-R-shlib --with-libtiff --with-libpng --with-jpeglib \
        --with-x --with-cairo --with-pcre1\
        LDFLAGS="-L/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/lib \
        -L/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/lib \ 
        -L/Bioinfo/SoftWare/NewLibs/pcre-8.40/lib \ 
        -L/Bioinfo/SoftWare/NewLibs/curl-7.64.1/lib \
        -L/Bioinfo/SoftWare/NewLibs/tiff-4.0.9/lib \
        -L/Bioinfo/SoftWare/NewLibs/jpeg-9c/lib \
        -L/Bioinfo/SoftWare/NewLibs/libpng-1.6.37/lib" \ 
        CPPFLAGS="-I/Bioinfo/SoftWare/NewLibs/zlib-1.2.6/include \ 
        -I/Bioinfo/SoftWare/NewLibs/bzip2-1.0.6/include \ 
        -I/Bioinfo/SoftWare/NewLibs/pcre-8.40/include \
        -I/Bioinfo/SoftWare/NewLibs/curl-7.64.1/include \
        -I/Bioinfo/SoftWare/NewLibs/tiff-4.0.9/include \
        -I/Bioinfo/SoftWare/NewLibs/jpeg-9c/include \
        -I/Bioinfo/SoftWare/NewLibs/libpng-1.6.37/include"
      
      # configure 的所有配置信息,都會保存在 ./Makeconf 文件中
      checking build system type... x86_64-pc-linux-gnu
      checking host system type... x86_64-pc-linux-gnu
      loading site script './config.site'
      ......
      config.status: executing libtool commands
      config.status: executing stamp-h commands
      
      R is now configured for x86_64-pc-linux-gnu
      
        Source directory:            .
        Installation directory:      /Bioinfo/SoftWare/R-3.6.0
      
        C compiler:                  gcc -std=gnu99  -g -O2
        Fortran fixed-form compiler: gfortran  -g -O2
      
        Default C++ compiler:        g++ -std=gnu++11  -g -O2
        C++14 compiler:
        C++17 compiler:
        C++20 compiler:
        Fortran free-form compiler:  gfortran  -g -O2
        Obj-C compiler:
      
        Interfaces supported:        X11, tcltk
        External libraries:          pcre2, readline, curl
        Additional capabilities:     PNG, JPEG, TIFF, NLS, cairo, ICU
        Options enabled:             shared R library, shared BLAS, R profiling
      
        Capabilities skipped:
        Options not enabled:         memory profiling
      
        Recommended packages:        yes
      
      configure: WARNING: you cannot build info or HTML versions of the R manuals
      configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally
      

      注意:

      • --with-x--with-cairo 是開啟 X11 圖形化的參數,應該增加一下。
      • R-4.0 以上需要增加一個 --with-pcre1 參數,或者直接使用 PCRE2。
      • 最后關于 HTML 的 WARNING 不會影響 R 的安裝和使用,可以忽略。

      最后,使用 make 和 make install 完成安裝。

      $ make 
      $ make install
      

      5. 設置環境變量

      最后, 把安裝完成的 R 添加至環境變量:

      export R_HOME=path-to-R
      export R_LIBS=$R_HOME/lib64/R/library
      export LD_LIBRARY_PATH=$R_HOME/lib:$LD_LIBRARY_PATH
      export PATH=$R_HOME/bin:$PATH
      
      • R_LIBS 的作用是 python 的 rpy2 調用安裝的 R 包時,根據該變量尋找對應的包;
      • LD_LIBRARY_PATH 則是相關動態依賴庫需要查找的路徑;
      • 環境變量設置中比較容易漏掉的是 PATHLD_LIBRARY_PATH,如果是用 root 安裝,可能會沒有問題,如果安裝到個人目錄下,不添加這兩個變量的話,就無法正確尋找需要的動態鏈接庫,如下:
      $ python
      Python 2.7.14 (default, Mar  9 2018, 08:39:17)
      [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import rpy2
      >>> import rpy2.robjects as robjects
      Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
       unable to load shared object '/Bioinfo/SoftWare/R-3.6.0/lib64/R/library/stats/libs/stats.so':
        libRlapack.so: cannot open shared object file: No such file or directory
      During startup - Warning message:
      package ‘stats’ in options("defaultPackages") was not found
      >>> robjects.r('library(splines)')
      Error: package or namespace load failed for ‘splines’ in dyn.load(file, DLLpath = DLLpath, ...):
       unable to load shared object '/Bioinfo/SoftWare/R-3.6.0/lib64/R/library/stats/libs/stats.so':
        libRlapack.so: cannot open shared object file: No such file or directory
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Bioinfo/SoftWare/Python-2.7.14/lib/python2.7/site-packages/rpy2/robjects/__init__.py", line 269, in __call__
          res = self.eval(p)
        File "/Bioinfo/SoftWare/Python-2.7.14/lib/python2.7/site-packages/rpy2/robjects/functions.py", line 170, in __call__
          return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
        File "/Bioinfo/SoftWare/Python-2.7.14/lib/python2.7/site-packages/rpy2/robjects/functions.py", line 100, in __call__
          res = super(Function, self).__call__(*new_args, **new_kwargs)
      rpy2.rinterface.RRuntimeError: Error: package or namespace load failed for ‘splines’ in dyn.load(file, DLLpath = DLLpath, ...):
       unable to load shared object '/Bioinfo/SoftWare/R-3.6.0/lib64/R/library/stats/libs/stats.so':
        libRlapack.so: cannot open shared object file: No such file or directory
      
      $ ldd /Bioinfo/SoftWare/R-3.6.0/lib64/R/library/stats/libs/stats.so
              linux-vdso.so.1 =>  (0x00007fffd65ba000)
              libRlapack.so => not found
              libRblas.so => not found
              libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007fed38cbb000)
              libm.so.6 => /lib64/libm.so.6 (0x00007fed389b9000)
              libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007fed3877c000)
              libR.so => not found
              libgomp.so.1 => /lib64/libgomp.so.1 (0x00007fed38556000)
              libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fed38339000)
              libc.so.6 => /lib64/libc.so.6 (0x00007fed37f76000)
              libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fed37d60000)
              /lib64/ld-linux-x86-64.so.2 (0x00005561aa2c3000)
      

      解決方法:

      $ export LD_LIBRARY_PATH="/Bioinfo/SoftWare/R-3.6.0/lib64/R/lib:$LD_LIBRARY_PATH"
      
      $ ldd /Bioinfo/SoftWare/R-3.5.0/lib64/R/library/stats/libs/stats.so
              linux-vdso.so.1 =>  (0x00007ffd0f3af000)
              libRlapack.so => /Bioinfo/SoftWare/R-3.6.0/lib64/R/lib/libRlapack.so (0x00007f6509c47000)
              libRblas.so => /Bioinfo/SoftWare/R-3.6.0/lib64/R/lib/libRblas.so (0x00007f6509a19000)
              libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007f65096ee000)
              libm.so.6 => /lib64/libm.so.6 (0x00007f65093ec000)
              libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f65091af000)
              libR.so => /Bioinfo/SoftWare/R-3.6.0/lib64/R/lib/libR.so (0x00007f6508b81000)
              libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f650895b000)
              libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f650873e000)
              libc.so.6 => /lib64/libc.so.6 (0x00007f650837b000)
              libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6508165000)
              /lib64/ld-linux-x86-64.so.2 (0x000055583c2da000)
              libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f6507f1e000)
              libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f6507cbc000)
              liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f6507a96000)
              libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f6507885000)
              libz.so.1 => /lib64/libz.so.1 (0x00007f650766f000)
              librt.so.1 => /lib64/librt.so.1 (0x00007f6507467000)
              libdl.so.2 => /lib64/libdl.so.2 (0x00007f6507262000)
              libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f6507038000)
      

      以上就是普通用戶源碼編譯安裝最新版本 R 的全部內容, 總的一句話就是缺什么安裝什么, 從最基本的 gcc 編譯器開始到 R 所需要的各種依賴庫,直至最終安裝完成.。

      6. 參考資料

      posted @ 2023-06-05 10:38  章魚貓先生  閱讀(2431)  評論(2)    收藏  舉報
      主站蜘蛛池模板: 狠狠躁夜夜躁人人爽蜜桃| 国产亚洲人成网站在线观看| 日本道之久夂综合久久爱| 天堂影院一区二区三区四区| 偏关县| 久久热这里只有精品66| 2019国产精品青青草原| 99国产精品久久久久久久日本竹| 免费十八禁一区二区三区| 亚洲国产韩国欧美在线| 亚洲国产欧美在线人成AAAA| 国产97人人超碰caoprom| 日韩亚洲精品国产第二页| 阿巴嘎旗| 极品尤物被啪到呻吟喷水| 国产免费午夜福利在线播放| 久久夜色精品国产亚av| 亚洲精品综合久久国产二区| 国产精品无码久久久久| av天堂亚洲天堂亚洲天堂| 又粗又硬又黄a级毛片| 亚洲鸥美日韩精品久久| 天天躁夜夜踩很很踩2022| 亚洲夂夂婷婷色拍ww47| 中文字幕国产在线精品| 国内精品无码一区二区三区| av无码一区二区大桥久未| 国产精品无码午夜福利| 欧美性猛交xxxx乱大交丰满| 成人伊人青草久久综合网| 花垣县| 亚洲成人av在线资源| 在线a人片免费观看| 九色国产精品一区二区久久| 东京热加勒比无码少妇| 亚洲中文字幕综合小综合| 亚洲精品无码成人aaa片| 亚洲第一最快av网站| 噜噜噜亚洲色成人网站∨| 精品无码国产不卡在线观看| 国产综合视频一区二区三区|