使用 --enable-R-shlib 安装 R 3.5.0 [英] Installing R 3.5.0 with --enable-R-shlib
问题描述
我正在尝试在 Linux Mint 下使用 --enable-R-shlib 标志从源代码安装 R 3.5.0.在没有标志的情况下配置和安装它可以正常工作,但 RStudio 需要设置标志.但是,在运行时
I am trying to install R 3.5.0 from source with the flag --enable-R-shlib under Linux Mint. Configuring and installing it without the flag works fine, but RStudio requires the flag to be set. However, when running
./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 标志
I tried setting the -fPIC flag as mentioned in the error message following the advice from [1]
CC="gcc -fPIC" ./configure --enable-R-shlib
无济于事,我仍然收到相同的错误消息.
to no avail, I still get the same error message.
推荐答案
以防万一其他人遇到这个问题.
Just in case someone else runs into this problem.
问题是目标文件.o"已经在没有 -fpic
选项的情况下编译.
The issue is the object files ".o" are already compiled without the -fpic
option.
正确的解决方案是从第一次构建中删除目标文件并重新编译:
The proper solution is to remove the object files from the first build and recomplile:
make clean
./configure --enable-R-shlib
make -j 4
sudo make install
-j 4
告诉 make 一次产生四个编译进程.调整数量以匹配处理器内核数.
The -j 4
tells make to spawn four compile processes at a time. Adjust the number to match the number of processor cores.
这篇关于使用 --enable-R-shlib 安装 R 3.5.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!