我无法在我的Ubuntu16.04上安装"mclust“R软件包。我有以下问题:
> install.packages("mclust")
>Installing package into ‘/home/ivan/R/x86_64-pc-linux-gnu-library/3.4’
>(as ‘lib’ is unspecified)
>trying URL 'https://cloud.r-project.org/src/contrib/mclust_5.4.2.tar.gz'
>Content type 'application/x-gzip' length 2699941 bytes (2.6 MB)
>==================================================
>downloaded 2.6 MB
>* installing *source* package ‘mclust’ ...
>** package ‘mclust’ successfully unpacked and MD5 sums checked
>** libs
>gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
>gfortran -fpic -g -O2 -fstack-protector-strong -c mclust.f -o mclust.o
>gfortran -fpic -g -O2 -fstack-protector-strong -c mclustaddson.f -o mclustaddson.o
>g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mclust.so init.o mclust.o mclustaddson.o -llapack -lblas -lgfortran
-lm -lquadmath -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
>/usr/bin/x86_64-linux-gnu-ld: /usr/lib/gcc/x86_64-linux-gnu/6/libgfortran.a(memory.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
>/usr/lib/gcc/x86_64-linux-gnu/6/libgfortran.a: error adding symbols: Bad value
>collect2: error: ld returned 1 exit status
>/usr/share/R/share/make/shlib.mk:6: recipe for target 'mclust.so' failed
>make: *** [mclust.so] Error 1
>ERROR: compilation failed for package ‘mclust’
>* removing ‘/home/ivan/R/x86_64-pc-linux-gnu-library/3.4/mclust’
>Warning in install.packages :
> installation of package ‘mclust’ had non-zero exit status
>The downloaded source packages are in
> ‘/tmp/Rtmppg0XWs/downloaded_packages’
>sessionInfo()
>R version 3.4.4 (2018-03-15)
>Platform: x86_64-pc-linux-gnu (64-bit)
>Running under: Ubuntu 16.04.5 LTS
>atrix products: default
>BLAS: /usr/lib/libblas/libblas.so.3.6.0
>LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
>locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=ru_RU.UTF-8
> [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C LC_ADDRESS=C
>[10] LC_TELEPHONE=C LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C
>attached base packages:
>[1] stats graphics grDevices utils datasets methods base
>loaded via a namespace (and not attached):
>[1] compiler_3.4.4 tools_3.4.4 yaml_2.2.0我已经尝试更新libgfortran和gcc-6的最新版本,运行apt-获取更新和升级。提前谢谢你的帮助。
编辑:根据Norbert的要求: dpkg的输出-S /usr/lib/gcc/x86_64-linux-gnu/6/libgfortran.a
dpkg-query: no path found matching pattern /usr/lib/gcc/x86_64-linux-gnu/6/libgfortran.a虽然,文件夹/usr/lib/gcc/x86_64-linux-gnu/6/包含一个链接到/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a为dpkg -S /usr/lib/运动会/x86_64-linux-gnu/5/libgfortran.a提供输出。
libgfortran-5-dev:amd64: /usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.aEdit2:将/usr/lib/gcc/x86_64-linux-gnu/6移动到不同的位置会导致以下错误:
Installing package into ‘/home/ivan/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/mclust_5.4.2.tar.gz'
Content type 'application/x-gzip' length 2699941 bytes (2.6 MB)
==================================================
downloaded 2.6 MB
* installing *source* package ‘mclust’ ...
** package ‘mclust’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc: error trying to exec 'cc1': execvp: No such file or directory
/usr/lib/R/etc/Makeconf:162: recipe for target 'init.o' failed
make: *** [init.o] Error 1
ERROR: compilation failed for package ‘mclust’
* removing ‘/home/ivan/R/x86_64-pc-linux-gnu-library/3.5/mclust’
Warning in install.packages :
installation of package ‘mclust’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpU0X2uP/downloaded_packages’Edit3:我也尝试将R更新为3.5.2。错误消息保持不变,下面是新的sessioinfo:
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=ru_RU.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] BiocManager_1.30.4 compiler_3.5.2 tools_3.5.2 yaml_2.2.0 Edit4:我在安装igraph时也有一个非常相似的错误:
/usr/bin/x86_64-linux-gnu-ld: /usr/lib/gcc/x86_64-linux- gnu/6/libgfortran.a(etime.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/6/libgfortran.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'igraph.so' failed
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/ivan/R/x86_64-pc-linux-gnu-library/3.5/igraph’
Warning in install.packages :
installation of package ‘igraph’ had non-zero exit statuslib="/home/ivan/R/x86_64-pc-linux-gnu-library/3.5"):我也尝试过运行install.packages("mclust",通过sudo通过Rscript运行install.packages),并导致同样的错误。
发布于 2019-01-28 12:30:32
因此,如果有人遇到同样的问题-我已经解决了它,通过删除gcc,r,并建立基本包,然后重新安装,然后重新安装R根据R 3.5.0用于Ubuntu,回答为@krlmlr。
https://askubuntu.com/questions/1110241
复制相似问题