我正在尝试在Linux Mint下使用--enable-R-shlib标志从源代码安装R3.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
无济于事,我仍然得到相同的错误消息。
发布于 2021-06-02 06:21:15
以防其他人遇到这个问题。
问题是在没有-fpic
选项的情况下已经编译了目标文件".o“。
正确的解决方案是从第一次构建中删除目标文件并重新编译:
make clean
./configure --enable-R-shlib
make -j 4
sudo make install
-j 4
告诉make一次产生四个编译进程。调整该数字以匹配处理器核心的数量。
发布于 2018-06-01 07:48:03
在为Ubuntu
添加了这些PPAs
之后,我能够将我的Linux Mint17.3ROSA的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
https://stackoverflow.com/questions/50135440
复制相似问题