【问题标题】:Installing R 3.5.0 with --enable-R-shlib使用 --enable-R-shlib 安装 R 3.5.0
【发布时间】:2018-10-12 14:39:12
【问题描述】:

我正在尝试在 Linux Mint 下使用标志 --enable-R-shlib 从源代码安装 R 3.5.0。在没有标志的情况下配置和安装它可以正常工作,但 RStudio 需要设置标志。但是,运行时

./configure --enable-R-shlib
make

我得到了错误

/usr/bin/ld: CommandLineArgs.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
CommandLineArgs.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:177: recipe for target 'libR.so' failed
make[3]: *** [libR.so] Error 1
make[3]: Leaving directory '/home/hps/Downloads/R-3.5.0/src/main'
Makefile:135: recipe for target 'R' failed
make[2]: *** [R] Error 2
make[2]: Leaving directory '/home/hps/Downloads/R-3.5.0/src/main'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/hps/Downloads/R-3.5.0/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1

我尝试按照 [1] 的建议设置错误消息中提到的 -fPIC 标志

CC="gcc -fPIC" ./configure --enable-R-shlib

无济于事,我仍然收到相同的错误消息。

[1]Passing a gcc flag through makefile

【问题讨论】:

    标签: r ubuntu gcc makefile linux-mint


    【解决方案1】:

    以防万一其他人遇到这个问题。

    问题是目标文件“.o”已经在没有-fpic 选项的情况下编译。

    正确的解决方案是从第一次构建中删除目标文件并重新编译:

    make clean
    ./configure --enable-R-shlib
    make -j 4
    
    sudo make install
    

    -j 4 告诉 make 一次产生四个编译进程。调整数量以匹配处理器内核的数量。

    【讨论】:

      【解决方案2】:

      在为Ubuntu 添加这些PPAs 后,我能够为我的Linux Mint 17.3 Rosa 将R 更新为3.5.0

      sudo add-apt-repository ppa:marutter/rrutter3.5
      sudo add-apt-repository ppa:marutter/c2d4u
      sudo apt-get update
      

      参考:https://cran.r-project.org/bin/linux/ubuntu/

      编辑:要从源代码编译,请按照建议here

      sudo apt-get update
      sudo apt-get build-dep r-base
      wget https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz
      tar -xvf R-3.5.0.tar.gz
      cd R-3.5.0
      ./configure --enable-R-shlib
      make
      

      【讨论】:

      猜你喜欢
      • 2015-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-04
      • 2020-08-07
      • 1970-01-01
      • 2013-12-25
      相关资源
      最近更新 更多