R 软件 openssl 包与 libssl.so.1.0.0 的一个坑

在使用  enrichplot 包解决  openssl 包依赖的时候,发现提示 libssl.so.1.0.0 动态库找不到:

> install.packages("openssl")
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/openssl_1.3.tar.gz'
Content type 'application/x-gzip' length 1218896 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

* installing *source* package openssl ...
** package openssl successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/Bioinfo/Pipeline/SoftWare/Anaconda2/include
Using PKG_LIBS=-L/Bioinfo/Pipeline/SoftWare/Anaconda2/lib -l:libssl.so.1.0.0 -l:libcrypto.so.1.0.0
** libs
......
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for openssl in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Bioinfo/Pipeline/SoftWare/R/R-3.6.0/lib64/R/library/00LOCK-openssl/00new/openssl/libs/openssl.so':
  libssl.so.1.0.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing /Bioinfo/Pipeline/SoftWare/R/R-3.6.0/lib64/R/library/opensslThe downloaded source packages are in
        /tmp/RtmpTySsWL/downloaded_packagesUpdating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("openssl") :
  installation of package openssl had non-zero exit status

仔细翻查 log 才发现我所用的 R-3.6.0 在安装 R 包的时候,默认调用了 Anaconda2 下面的  PKG_CFLAGS 和  PKG_LIBS,想要更改这两个变量需要更改在安装 R 包时调用的 pkg-config,我的 R-3.6.0 默认使用的是 /Bioinfo/Pipeline/SoftWare/Anaconda2/bin/pkg-config。

重新安装  pkg-config-0.29.2:

$ wget https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz --no-check-certificate
$ tar zvxf pkg-config-0.29.2.tar.gz
$ cd pkg-config-0.29.2
$ ./configure --prefix=/Bioinfo/Pipeline/SoftWare/pkg-config-0.29.2
$ make
$ make install

把  pkg-config-0.29.2 添加到环境变量:

export PATH="/Bioinfo/Pipeline/SoftWare/pkg-config-0.29.2/bin:$PATH

最后,source \~/.bashrc,使用 install.packages(“openssl”) 安装,一切正常。