简体   繁体   English

R install.packages编译时出现错误的ELF类错误

[英]R wrong ELF class errors while install.packages is compiling

I'm running Ubuntu Budgie 64 bit: 我正在运行Ubuntu Budgie 64位:

lsb_release -a : lsb_release -a

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:    18.04
Codename:   bionic

lscpu : lscpu

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  1
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               76
Model name:          Intel(R) Celeron(R) CPU  N3050  @ 1.60GHz
Stepping:            3
CPU MHz:             2160.000
CPU max MHz:         2160.0000
CPU min MHz:         480.0000
BogoMIPS:            3200.00
Virtualization:      VT-x
L1d cache:           24K
L1i cache:           32K
L2 cache:            1024K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch epb pti tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat

I did a fresh install of R 3.5 (r-base & r-base-dev) by following the directions here: https://cran.cnr.berkeley.edu 我按照此处的说明重新安装了R 3.5(r-base和r-base-dev): https : //cran.cnr.berkeley.edu

Everything seems to be working, 一切似乎都正常,

R

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

However, when I go to install new packages (eg install.packages("ggplot2") ) the compilation fails with the following error: 但是,当我去安装新软件包时(例如install.packages("ggplot2") ),编译失败,并显示以下错误:

/usr/bin/x86_64-linux-gnu-ld: /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so:
error loading plugin: /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so:
wrong ELF class: ELFCLASS64
collect2: error: ld returned 1 exit status

It has failed with this error for the other packages I have tried installing (dplyr, Rcpp) also. 我尝试安装的其他其他软件包(dplyr,Rcpp)也因此错误而失败。

So far, I have tried playing around with the gcc/g++ compilation flags in /usr/lib/R/etc/Makeconf by adding a -m64 flag. 到目前为止,我已经尝试通过添加-m64标志来处理/usr/lib/R/etc/Makeconf的gcc / g ++编译标志。 But I'm still getting the same problem. 但是我仍然遇到同样的问题。

UPDATE : 更新:

file -L /usr/bin/x86_64-linux-gnu-ld gives: file -L /usr/bin/x86_64-linux-gnu-ld给出:

x86_64-linux-gnu-ld: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0,
BuildID[sha1]=8263ec62232df7411c36026e7e3e02afbfeb8b4f, stripped

UPDATE 2 : 更新2:

I figured out that I can just go through the synaptic package manager and download packages via r-cran . 我发现我可以通过synaptic软件包管理器并通过r-cran下载软件包。 For example, instead of running install.packages("ggplot2") in R, I simply run sudo apt-get install r-cran-ggplot2 例如,我只运行sudo apt-get install r-cran-ggplot2 ,而不是在R中运行install.packages("ggplot2")

Your GCC installation is screwed up. 您的GCC安装已被拧紧。

In particular, you have 32-bit linker ( x86_64-linux-gnu-ld ), but a 64-bit LTO plugin liblto_plugin.so . 特别是,您具有32位链接器( x86_64-linux-gnu-ld ),但具有64位LTO插件liblto_plugin.so

These are supposed to match. 这些应该匹配。 You should figure out which package(s) provide above two files, and install a 32-bit or a 64-bit version of each. 您应该找出哪个软件包提供了以上两个文件,并为每个软件包安装32位或64位版本。

I recently encountered almost the same problem, except with an armhf liblto_plugin.so on an aarch64 linker. 我最近遇到了几乎相同的问题,除了在aarch64链接器上使用armhf liblto_plugin.so。 I got into this situation after I had (intentionally) installed gcc:armhf and binutils:armhf on an aarch64 host. 在(有意)在aarch64主机上安装gcc:armhf和binutils:armhf之后,我陷入了这种情况。 The solution was to install the not-so-obvious package named binutils-arm-linux-gnueabihf:armhf . 解决方案是安装不太明显的名为binutils-arm-linux-gnueabihf:armhf

Along the lines of what @Employed Russian said, you need to get the proper binutils installed. 按照@Employed Russian所说的内容,您需要安装适当的binutils。 Try: 尝试:

sudo apt install --reinstall binutils:amd64 binutils-x86_64-linux-gnu:amd64

If those packages aren't found or don't work, next try searching for the proper package name via apt-file just as I had to. 如果找不到或无法使用这些软件包,请尝试像以前一样通过apt-file搜索正确的软件包名称。

sudo apt install -y apt-file
sudo apt-file update
apt-file search x86_64-linux-gnu-ld
apt-file search x86_64-linux-gnu-ld.bfd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM