简体   繁体   中英

error installing sodium package on linux EC2 - unable to load shared object

I am trying to install the sodium R package on an AWS Linux (fedora) EC2 instance. The libsodium lib is installed and lives here:

[ec2-user@ip-xxx]$ sudo find / -iname libsodium.*
/usr/local/lib/libsodium.a
/usr/local/lib/libsodium.la
/usr/local/lib/libsodium.so.23.3.0
/usr/local/lib/libsodium.so
/usr/local/lib/pkgconfig/libsodium.pc
...

In R I ran the following commands which throw an error. As far as I can tell from the messages, libsodium is not found.

> Sys.setenv(PKG_CONFIG_PATH= "/usr/local/lib/pkgconfig")
> install.packages("sodium")
Installing package into ‘/usr/lib64/R/library’
...

** package ‘sodium’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/local/include
Using PKG_LIBS=-L/usr/local/lib -lsodium
** libs
...

** testing if installed package can be loaded
Error: package or namespace load failed for ‘sodium’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib64/R/library/sodium/libs/sodium.so':
  libsodium.so.23: cannot open shared object file: No such file or directory
...

I am not well-versed in linux and do not understand what to do now. For example, do I need to set any other environment vars etc.? Any ideas? :)

It looks like you either have the wrong version of libsodium or it's install in the wrong place.

If it was installed using yum you can check what version is installed by running yum info libsodium-devel

According to the package requirements https://cran.r-project.org/web/packages/sodium/index.html

SystemRequirements: libsodium (>= 1.0.3)

I think the latest version of libsodium-devel AWS have on their repos is Version: 0.4.5

To fix this you need to yum install the libsodium-devel from another repo that has a later version such as the lux repo: https://pkgs.org/download/libsodium-devel

First add the lux repo to yum:

sudo rpm -Uvh http://repo.iotti.biz/CentOS/6/noarch/lux-release-6-3.noarch.rpm
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-LUX

I then had to edit the .repo file to point to the right place for some reason. edit this file /etc/yum.repos.d/lux.repo to contain the following:

[lux]
name=CentOS $releasever - $basearch - Lux
baseurl=http://repo.iotti.biz/CentOS/6
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LUX  

once you've done that you should be good to yum install the package:

sudo yum install libsodium-devel

Then the R install.packages("sodium") should complete successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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