R wrong ELF class errors while install.packages is compiling - r

I'm running Ubuntu Budgie 64 bit:
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
I did a fresh install of R 3.5 (r-base & r-base-dev) by following the directions here: 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 (e.g. install.packages("ggplot2")) the compilation fails with the following error:
/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.
So far, I have tried playing around with the gcc/g++ compilation flags in /usr/lib/R/etc/Makeconf by adding a -m64 flag. But I'm still getting the same problem.
UPDATE :
file -L /usr/bin/x86_64-linux-gnu-ld gives:
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 :
I figured out that I can just go through the synaptic package manager and download packages via r-cran. For example, instead of running install.packages("ggplot2") in R, I simply run sudo apt-get install r-cran-ggplot2

Your GCC installation is screwed up.
In particular, you have 32-bit linker (x86_64-linux-gnu-ld), but a 64-bit LTO plugin 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.

I recently encountered almost the same problem, except with an armhf liblto_plugin.so on an aarch64 linker. I got into this situation after I had (intentionally) installed gcc:armhf and binutils:armhf on an aarch64 host. The solution was to install the not-so-obvious package named binutils-arm-linux-gnueabihf:armhf.
Along the lines of what #Employed Russian said, you need to get the proper binutils installed. 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.
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

Related

Trouble installing R from homebrew formula (Intel Mac Pro)

I'm having trouble installing R from a homebrew formula on our Intel garbage can mac pro at work. I was having trouble installing tidyverse from source code so I removed and have been attempting to reinstalling R, as I thought it might have been a version mismatch somewhere.
I used
brew install R
and after a bunch of output where it's downloading other packages, I get back the following
==> Installing dependencies for r: libpng, freetype, fontconfig, gettext, libffi, pcre, glib, pkg-config, libpthread-stubs, xorgproto, libxau, libxdmcp, libxcb, libx11, libxext, libxrender, lzo, pixman, cairo, gmp, isl, mpfr, libmpc, lz4, xz, zstd, gcc, jpeg-turbo, openblas, pcre2, readline, ca-certificates, openssl#1.1 and tcl-tk
==> Installing r dependency: libpng
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
Error: Command failed with exit 129: git
Is this in fact a git error? What is the -C command?
Things I've tried:
removing and reinstalling command line tools
removing and reinstalling Homebrew
My machine:
Mac Pro (Late 2013)
2.7 GHz 12-Core Xeon E5
Thanks!
Sam
I think it tries to use an old version of git at /usr/bin/git, but you need to run brew install git to install a newer version of git to /usr/local/bin/git.
If /usr/local/bin/ isn't on your PATH before /usr/bin/, then you can add a line like this to ~/.bash_profile:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
However /usr/local/bin is included in /etc/paths by default, so it should be added to PATH by programs that run path_helper (like Terminal and iTerm 2 but not Script Editor or Emacs.app).

Cannot install R in RHEL 8.5 using a Dockerfile script

I can install R and RStudio with no problem from the RHEL 8.5 CLI.
However, when I try to automate the installation process using a Dockerfile following the instructions at https://docs.rstudio.com/resources/install-r-source/, I get the following error when trying to pass the value defined in my "export R_VERSION=4.0.2" instruction:
[ 6/11] **RUN yum install -y R-${R_VERSION}-1-1.x86_64.rpm --nogpgcheck**:
#9 0.957 Last metadata expiration check: 0:00:04 ago on Fri Mar 25 19:22:44 2022.
#9 1.066 Can not load RPM file: R--1-1.x86_64.rpm.
#9 1.071 Could not open: R--1-1.x86_64.rpm
executor failed running [/bin/sh -c yum install -y R-${R_VERSION}-1-1.x86_64.rpm --nogpgcheck]: exit code: 1
Help is appreciated.
sh-4.4# **yum install -y R-${R_VERSION}-1-1.x86_64.rpm --nogpgcheck**
Last metadata expiration check: 0:02:02 ago on Fri Mar 25 15:56:49 2022.
Dependencies resolved.
=============================================================================================================================================================== Package Architecture Version Repository Size
===============================================================================================================================================================Installing:
R-4.0.2 x86_64 1-1 #commandline 58 M
Upgrading:
glibc x86_64 2.28-164.el8_5.3 ubi-8-baseos 3.6 M
glibc-common x86_64 2.28-164.el8_5.3 ubi-8-baseos 1.3 M
glibc-minimal-langpack x86_64 2.28-164.el8_5.3 ubi-8-baseos 58 k
......
...........
.............
..................
**Complete!**
sh-4.4# r
sh: r: command not found
sh-4.4# /opt/R/${R_VERSION}/bin/R --version
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

Benchmarking Qt5 and C++17 containers for perfomance and memory usage

I need an up-to-date benchmark of both Qt5 and C++17 containers in both performance and heap memory-usage, both on latest GCC and CLang compilers, for my own project.
The results was helpful for my decisions in the project and I think it might be helpful for others too, so I decided to share it.
So it is a benchmark with these parameters in mind:
Qt5 Containers vs C++17 Containers
Performance vs Memory Usage
Container Initialization/Generation Time vs Access/Find/Iteration Time
GCC 11 vs CLang 11
Benchmark platform:
Hardware:
CPU: 6-Core AMD 6200
RAM: 32GB DDRIII
Software:
OS: OpenSUSE 15.2 x64
Qt: 15.1 (Official Binary)
GCC: 11.0.0
CLang: 11.0.0
HeapTrack 1.1.0
Standard:
C++17
Flags
-O3
Code:
https://github.com/AshkanV/Qt5vsCpp17ContainerBench

How to use Intel MKL instead of libopenblas in Julia

I would like to know if there is a way i can use Intel MKL library instead of OpenBlas. I have installed MKL. Below is the version info
Julia Version 0.6.0
Commit 903644385b (2017-06-19 13:05 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin13.4.0)
CPU: Intel(R) Core(TM) i7-4770HQ CPU # 2.20GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
Kindly let me know if this can be done
This is the procedure I have used to install Julia (0.6.0) with Intel MKL (compiling from source) in macOS Sierra. Remember to uninstall previous versions of Julia first.
Install Xcode.
Launch a Terminal and update the command line tools:
$ xcode-select --install
Install Homebrew.
Use Homebrew to install gfortran:
$ brew install gfortran
Take advantage of Homebrew and install also wget:
$ brew install wget
Go to the Intel Performance Libraries webpage, register yourself and download these free libraries for OS X and install them (as with a regular DMG package):
Intel Threading Building Blocks (TBB)
Intel Math Kernel Library (MKL)
Download the Julia source (Tarball with dependencies):
$ wget https://github.com/JuliaLang/julia/releases/download/v0.6.0/julia-0.6.0-full.tar.gz
Uncompress the file and move the folder to your $HOME directory.
Launch a Terminal and change to the Julia source directory:
$ cd ~/julia-0.6.0
With your preferred tool, edit the file Make.inc and enable the use of Intel MKL and Intel MKL FFT. Save and close the file. Use the picture as a guide:
Set up the Intel MKL environment, for Intel64 architecture with 8 bytes integer support (ILP64):
$ source /opt/intel/mkl/bin/mklvars.sh intel64 ilp64
Compile Julia:
$ make
If there is a problem compiling Julia, create a symbolic link in the Julia's lib folder to the Intel MKL library and run make again:
$ ln -s /opt/intel/mkl/lib/libmkl_rt.dylib usr/lib/libmkl_rt.dylib
$ make
I did not try to run make install because I do not have Administrator privileges in my Mac, but you are free to do it. Anyway, you can run Julia from this folder:
$ ./julia
Next time you open a Terminal probably your Intel MKL variables would have gone. Just add these lines to your ~/.bash_profile:
# Intel MKL
source /opt/intel/mkl/bin/mklvars.sh intel64 ilp64
Yes this is possible but much easier to do if you are happy to re-install a clean version of julia.
You will need to edit the Make.user file as described here: https://github.com/JuliaLang/julia#intel-compilers-and-math-kernel-library-mkl

NVIDIA OpenCL on Trusty or Mint 17

I am having a really hard time getting OpenCL working in Trusty or Mint 17. Im using ppa:xorg-edgers, tried updates and even nvidia-340.
sudo apt-get install nvidia-331 nvidia-331-uvm nvidia-cuda-toolkit nvidia-cuda-dev opencl-headers nvidia-opencl-dev clinfo
Rebooting and then
babak#ASUS-G750JH:~$ clinfo
clinfo: /usr/lib/x86_64-linux-gnu/libOpenCL.so.1: no version information available (required by clinfo)
I: ICD loader reports no usable platforms
I have tried this on two Intel based systems with Nvidia GPU's a desktop with a GeForce 280, and a laptop with GeForce 780M with a physically disabled Optimus by the Asus, it only has the Nvidia GPU. A G750JH.
Has anyone done this successfully? Can I roll back and remove the PPA and use the default repo's, would that even make a difference?
For the xorg-edgers nvidia-346 packages, I get it working by installing also the nvidia-opencl-icd-346 package and its dependency ocl-icd-libopencl1.
Im not 100% sure what the issue was, but seems that the ppa:xorg-edgers, may have an issue. Whatever is broken the process below fixes the issue and results in both Cuda and OpenCL working with Nvidia and Ubuntu 14.04 x64
sudo apt-get install dkms linux-headers-generic fakeroot build-essential
sudo apt-get remove --purge nvidia-*
sudo apt-get purge nvidia*
sudo ./NVIDIA-Linux-x86_64-346.47.run
Downloaded from Nvidia, 340.xx supports legacy cards
Yes for all options
sudo reboot chmod +x cuda-repo-ubuntu1404_6.5-14_amd64.deb
dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
chmod +x cuda_6.5.14_linux_64.run sudo ./cuda_6.5.14_linux_64.run
Choose option to leave out the GPU Driver
sudo apt-get update
sudo apt-get install cuda
add to bottom of bashrc
export CUDA_HOME=/usr/local/cuda-6.5
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
export GLPATH=/usr/lib/
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
sudo reboot
./ocore_601_OpenCL_v20 --devices
Downloaded from http://stanford.edu/~yutongz/ocores/
Outputs:
OpenCL compatible devices:
name: GeForce GTX 780M | platformId: 0 deviceId: 0
cd ~/NVIDIA_CUDA-6.5_Samples/1_Utilities/deviceQuery
make
./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 780M"
......
Truncated

Resources