动态库报错用软链接瞒天过海

以下报错显示缺少libcrypto.so.1.0.0动态库。

1
2
$ samtools
samtools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

通过ldd查看samtools依赖库

1
2
3
4
5
6
7
8
9
10
11
$ which samtools
~/miniconda2/envs/rna2/bin/samtools
$ ldd ~/miniconda2/envs/rna2/bin/samtools
linux-vdso.so.1 => (0x00007ffcd9138000)
libz.so.1 => /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libz.so.1 (0x00007f7a9eaaa000)
libm.so.6 => /lib64/libm.so.6 (0x00007f7a9e5a2000)
libbz2.so.1.0 => /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libbz2.so.1.0 (0x00007f7a9ea74000)
liblzma.so.5 => /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/liblzma.so.5 (0x00007f7a9ea4b000)
libcurl.so.4 => /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libcurl.so.4 (0x00007f7a9e9bb000)
libcrypto.so.1.0.0 => not found
...

查看已有的动态库

1
2
3
$ ls /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libcrypto*
/public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libcrypto.so
/public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libcrypto.so.1.1

使用软链接瞒天过海的时候到了!
在上述的lib目录下面,创建一个链接到已有动态库libcrypto.so.1.1的假的libcrypto.so.1.0.0骗过samtools

1
ln -s /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libcrypto.so.1.1 /public/home/huangsisi/miniconda2/envs/rna2/bin/../lib/libcrypto.so.1.0.0

然后就成功了。/滑稽