使用--enable-R-shlib安装R 3.5.0

问题描述 投票:5回答:1

我正在尝试使用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 linuxmint
1个回答
3
投票

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

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
© www.soinside.com 2019 - 2024. All rights reserved.