【问题标题】:R wrong ELF class errors while install.packages is compilingR 错误的 ELF 类错误,而 install.packages 正在编译
【发布时间】:2019-02-06 20:15:09
【问题描述】:

我正在运行 Ubuntu Budgie 64 位:

lsb_release -a:

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

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

我按照此处的说明重新安装了 R 3.5(r-base 和 r-base-dev):https://cran.cnr.berkeley.edu

似乎一切正常,

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)

但是,当我去安装新包(例如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

我尝试安装的其他软件包(dplyr、Rcpp)也因此错误而失败。

到目前为止,我已经尝试通过添加 -m64 标志来使用 /usr/lib/R/etc/Makeconf 中的 gcc/g++ 编译标志。但我仍然遇到同样的问题。

更新:

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

更新 2:

我发现我可以通过突触包管理器并通过r-cran 下载包。例如,我没有在 R 中运行 install.packages("ggplot2"),而是简单地运行 sudo apt-get install r-cran-ggplot2

【问题讨论】:

  • 如果您找到了解决方案,请提供它作为答案。谢谢。

标签: r linux gcc package elf


【解决方案1】:

你的 GCC 安装搞砸了。

特别是,您有 32 位链接器 (x86_64-linux-gnu-ld),但有一个 64 位 LTO 插件 liblto_plugin.so

这些是应该匹配的。您应该弄清楚哪些软件包提供了上述两个文件,并分别安装 32 位或 64 位版本。

【讨论】:

    【解决方案2】:

    我最近遇到了几乎相同的问题,除了 aarch64 链接器上的 armhf liblto_plugin.so。在我(有意)在 aarch64 主机上安装 gcc:armhf 和 binutils:armhf 后,我遇到了这种情况。解决方案是安装名为binutils-arm-linux-gnueabihf:armhf 的不太明显的包。

    按照@Employed Russian 所说的,您需要安装正确的 binutils。试试:

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

    如果这些包没有找到或不起作用,接下来尝试通过 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
    

    【讨论】:

      猜你喜欢
      • 2014-06-14
      • 1970-01-01
      • 2010-09-17
      • 1970-01-01
      • 1970-01-01
      • 2018-07-19
      • 2017-08-30
      • 2011-09-04
      • 2016-11-25
      相关资源
      最近更新 更多