实验记录 | shimmer运行过程中的lib依赖问题(1)

问题描述:
perl /home/xxzhang/workplace/software/Shimmer/shimmer.pl --minqual 25 --ref ./geneome/hg19/hg19.fa /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --outdir ./output_RNA

/home/xxzhang/workplace/software/Shimmer/shimmer.pl --counts --ref ./geneome/hg19/hg19.fa /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --min_som_reads 10 –som_file /home/xxzhang/workplace/QBRC/./output_RNA/som_counts.txt –het_file /home/xxzhang/workplace/QBRC/./output_RNA/het_counts.txt --indel_file /home/xxzhang/workplace/QBRC/./output_RNA/indel_counts.txt --minqual 25 --minindel 10

/usr/bin/perl: symbol lookup error: /opt/perl5/lib/perl5/x86_64-linux-thread-multi/auto/List/Util/Util.so: undefined symbol: Perl_xs_handshake
Failed to run /home/xxzhang/workplace/software/Shimmer/shimmer.pl --counts!

参考链接:https://www.cnblogs.com/dzqk/archive/2018/01/08/8236627.html

这种类型的错误通常发生在使用Perl的一个版本编译的二进制文件被不同版本的Perl使用时。
更新版本的Perl使用旧版本的二进制文件。

参考链接:https://cloud.tencent.com/developer/ask/128274

删除perl的l所有的local环境变量:
eval $(perl -Mlocal::lib=--deactivate-all)
perl -e '{print "$_\n" foreach @INC

/home/xxzhang/miniconda3/
/opt/ActivePerl-5.26/lib/
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

重新运行perl。
perl /home/xxzhang/workplace/software/Shimmer/shimmer.pl --minqual 25 --ref ./geneome/hg19/hg19.fa /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --outdir ./output_RNA
不再出现相同的错误:

Can’t read file /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam!
Failed to run /home/xxzhang/workplace/software/Shimmer/shimmer.pl --counts!

但是,对于其能否正常的运行下去,依然比较存疑。


我现在继续看一下somatic.pl的原始代码。看一下对于RNA的数据,它每一步是如何处理的?这里,我并没有仔细看过。
突然想到之前是删去了空格,才使得命令得以正常的运行。于是,又对somatic.pl进行了处理,删去了“>”符号之后的空格(这也是自己比较怀疑的一个地方,对于比对进行校正的过程中,chr总是比较乱)。

重新运行,得到结果文件。
对实验记录,再次进行分析。
几次的calling还是有问题。

  • mutect
/home/xxzhang/workplace/software/java/jdk1.7.0_80/bin/java -Djava.io.tmpdir=./output_RNA/mutmp -Xmx31g -jar /home/xxzhang/workplace/QBRC//somatic_script/mutect-1.1.7.jar --analysis_type MuTect --reference_sequence ./geneome/hg19/hg19.fa --dbsnp ./geneome/hg19/hg19.fa_resource/dbsnp.hg19.vcf --cosmic ./geneome/hg19/hg19.fa_resource/CosmicCodingMuts.hg19.vcf  --input_file:tumor /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --input_file:normal /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam --vcf ./output_RNA/mutect.vcf --out ./output_RNA/mutect.out

Reading left_mutect.vcf
Warning: failed to read left_mutect.vcf . Maybe this caller didn’t find any variants
Warning message:
In file(file, “rt”) :
cannot open file ‘left_mutect.vcf’: No such file or directory
Filtering mutect somatic

  • shimmer
perl  /home/xxzhang/workplace/software/Shimmer/shimmer.pl --minqual 25 --ref ./geneome/hg19/hg19.fa /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --outdir ./output_RNA

/home/xxzhang/workplace/software/Shimmer/shimmer.pl --counts --ref ./geneome/hg19/hg19.fa /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --min_som_reads 10 --som_file /home/xxzhang/workplace/QBRC/./output_RNA/som_counts.txt --het_file /home/xxzhang/workplace/QBRC/./output_RNA/het_counts.txt --indel_file /home/xxzhang/workplace/QBRC/./output_RNA/indel_counts.txt --minqual 25 --minindel 10

/usr/bin/perl: symbol lookup error: /opt/perl5/lib/perl5/x86_64-linux-thread-multi/auto/List/Util/Util.so: undefined symbol: Perl_xs_handshake
Failed to run /home/xxzhang/workplace/software/Shimmer/shimmer.pl --counts!

Reading left_somatic_diffs.readct.vcf
Warning: failed to read left_somatic_diffs.readct.vcf . Maybe this caller didn’t find any variants
Warning message:
In file(file, “rt”) :
cannot open file ‘left_somatic_diffs.readct.vcf’: No such file or directory
Filtering shimmer somatic

主要就是这两个还存在问题。我们留着明天解决。
明天的任务:
(1)解决这两个软件。
(2)弄清楚使用GATK进行alignment以及使用这6种caller的意义?作用上是否有重叠?
明天继续编辑这一页。


(9:04)早上来的时候,发现DNA的pipeline非常的顺利的跑出来了。得到了我们想要的流程记录的文件。
今天的任务就是,完成上述的工作。争取继续跑完这个pipeline。
先解决第一个问题:
(1)mutect的问题。
我们先使用我们之前得到的bam文件来运行这个指令,看一下,这个文件是否能够很好的得出结果,如果能,则说明mutect的jar没有问题。如果不能,则需要重新下载。
我们现在来尝试。

/home/xxzhang/workplace/software/java/jdk1.7.0_80/bin/java -Djava.io.tmpdir=./output_RNA/mutmp -Xmx31g -jar /home/xxzhang/workplace/QBRC//somatic_script/mutect-1.1.7.jar --analysis_type MuTect --reference_sequence ./geneome/hg19/hg19.fa --dbsnp ./geneome/hg19/hg19.fa_resource/dbsnp.hg19.vcf --cosmic ./geneome/hg19/hg19.fa_resource/CosmicCodingMuts.hg19.vcf  --input_file:tumor /home/xxzhang/workplace/QBRC/output_RNA/tumor/tumor.bam --input_file:normal /home/xxzhang/workplace/QBRC/output_RNA/normal/normal.bam --vcf ./output_RNA/mutect.vcf --out ./output_RNA/mutect.out

我们先将tumor.bam和normal.bam生成。我们看一下流程记录,这两个文件是如何生成的。
在我一步一步地运行这个文件的过程中,我发现了一个有趣的现象。
在我使用GATK运行RealignerTargetCreator这一步骤的时候,出现了错误(这个错误是我整体的运行pipeline的过程中并没有报出来的)。

代码详情:

 /home/xxzhang/workplace/software/java/jdk1.8.0_291/bin/java -Djava.io.tmpdir=./output_RNA/tumor/tmp -jar /home/xxzhang/workplace/QBRC//somatic_script/GenomeAnalysisTK.jar -T RealignerTargetCreator -R ./geneome/hg19/hg19.fa --num_threads 20 -known ./geneome/hg19/hg19.fa_resource/Mills_and_1000G_gold_standard.indels.hg19.vcf -known ./geneome/hg19/hg19.fa_resource/1000G_phase1.snps.high_confidence.hg19.vcf  -o ./output_RNA/tumor/tumor_intervals.list -I ./output_RNA/tumor/dupmark.bam

出现的错误则是:

Unsupported CIGAR operator N in read SRR5297065.364824 at chr1:1337589.
Perhaps you are trying to use RNA-Seq data?
While we are currently actively working to support this data type unfortunately the GATK cannot be used with this data in its current form.
You have the option of either filtering out all reads with operator N in their CIGAR string (please add --filter_reads_with_N_cigar to your command line) or
assume the risk of processing those reads as they are including the pertinent unsafe flag (please add -U ALLOW_N_CIGAR_READS to your command line).
Notice however that if you were to choose the latter, an unspecified subset of the analytical outputs of an unspecified subset of the tools will become unpredictable.
Consequently the GATK team might well not be able to provide you with the usual support with any issue regarding any output.

报错的大意是,GATK目前并不能够处理RNA-seq数据。我们可以选择过滤掉RNA的数据,也可以选择默认的风险读取。
但是,奇怪的是,当我将这串代码封装到perl程序中运行的时候,却没有报出类似的错误。而且,生成了结果文件。

我们选择跳过这一步,使用之前在运行pipeline的过程中下载的过程性文件,接着下一步运行。
运行 IndelRealigner这一步骤的时候,遇到了同样的问题。

Unsupported CIGAR operator N in read SRR5297065.62485 at chr1:340951. Perhaps you are trying to use RNA-Seq data? While we are currently actively working to support this data type unfortunately the GATK cannot be used with this data in its current form. You have the option of either filtering out all reads with operator N in their CIGAR string (please add --filter_reads_with_N_cigar to your command line) or assume the risk of processing those reads as they are including the pertinent unsafe flag (please add -U ALLOW_N_CIGAR_READS to your command line). Notice however that if you were to choose the latter, an unspecified subset of the analytical outputs of an unspecified subset of the tools will become unpredictable. Consequently the GATK team might well not be able to provide you with the usual support with any issue regarding any output

流程进展到这里,算是卡住了。
我们需要到GATK官网上去查,是否存在这个错误。即GATK不能转换RNA-seq数据,又或者我们的程序在这个过程中做了怎样的转换。
以及我们重新从头开始跑一遍pipeline,获取这些中间文件(将rm指令注释掉),再接下来继续运行。

现在距离吃饭还有一个小时的时候,我先尝试在服务器上安装shimmer。昨天坐地铁的时候,有顿悟到,symbol undefined的错误具体是什么意思。我突然想到,我的shimmer当初编译安装的时候,使用的是我自己的Linux系统中的perl,而我后来将shimmer直接移植到了服务器上,所以,在使用服务器上的perl运行shimmer的程序的时候,可能会出现perl版本不匹配的问题——即编译shimmer的perl和运行shimmer的perl的版本不一致,这是我猜想的错误的原因。
于是,现在我打算尝试一下,我的这个想法是否正确。


重新安装shimmer。
git clone git://github.com/nhansen/Shimmer.git
perl Build.PL

which: no samtools in (/opt/perl5/bin:/opt/curl/bin:/opt/jdk/bin:/opt/go/bin:/opt/SimpleQueue:/opt/tsce4/maui/sbin:/opt/tsce4/maui/bin:/opt/tsce4/torque6/sbin:/opt/tsce4/torque6/bin:/usr/lib64/qt-3.3/bin:/home/xxzhang/perl5/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin)
ERROR: samtools executable is not found.
This script requires the samtools binary to be in the user’s PATH

which: no R in (/opt/perl5/bin:/opt/curl/bin:/opt/jdk/bin:/opt/go/bin:/opt/SimpleQueue:/opt/tsce4/maui/sbin:/opt/tsce4/maui/bin:/opt/tsce4/torque6/sbin:/opt/tsce4/torque6/bin:/usr/lib64/qt-3.3/bin:/home/xxzhang/perl5/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin)
ERROR: R executable is not found.
This script requires the R executable to be in the user’s PATH

ERROR: You have R installed, but it doesn’t seem to have the statmod library.
Shimmer requires the R statmod library to be installed.
Created MYMETA.yml and MYMETA.json
Creating new ‘Build’ script for ‘shimmer’ version ‘0.1’

我自己对出错的信息进行分析的话,

(/opt/perl5/bin:/opt/curl/bin:/opt/jdk/bin:/opt/go/bin:/opt/SimpleQueue:/opt/tsce4/maui/sbin:/opt/tsce4/maui/bin:/opt/tsce4/torque6/sbin:/opt/tsce4/torque6/bin:/usr/lib64/qt-3.3/bin:/home/xxzhang/perl5/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin)

尝试1:
上述的这些都是perl的依赖的路径。也就是说在这些路径下,找不到我们运行该程序所需要的R,samtools、以及安装包statmod,所以,我们下一步的计划就是,找到我们前期所使用的R,statmod,samtools所在的位置,然后将这些路径添加到perl的lib路径下(具体的添加的方式我们之前有尝试过)。

  • R

/home/xxzhang/workplace/software/R/R-3.6.3/bin

  • statmod library

/home/xxzhang/workplace/software/R/R-3.6.3/library

  • samtools

/home/xxzhang/miniconda3/bin

所以,我尝试一下,将这些路径添加到perl的lib路径下不知道是否可以?
首先看一下,perllib下都有啥:
perl -V

@INC:
/home/xxzhang/miniconda3/bin/home/xxzhang/workplace/software/R
/opt/perl5/lib/perl5/5.26.3/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.3
/opt/perl5/lib/perl5/x86_64-linux-thread-multi
/opt/perl5/lib/perl5
/home/xxzhang/perl5/lib/perl5
/opt/ActivePerl-5.26/lib/perl5/site_perl/5.26.3/x86_64-linux-thread-multi
/opt/ActivePerl-5.26/lib/perl5/site_perl/5.26.3
/opt/ActivePerl-5.26/lib/perl5/5.26.3/x86_64-linux-thread-multi
/opt/ActivePerl-5.26/lib/perl5/5.26.3
/opt/perl5/lib/perl5/5.26.2/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.2
/opt/perl5/lib/perl5/5.26.1/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.1
/opt/perl5/lib/perl5/5.26.0/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.0
/opt/ActivePerl-5.26/lib/perl5/site_perl

添加路径到perl5lib处:
export PERL5LIB=/home/xxzhang/workplace/software/R:$PERL5LIB
export PERL5LIB=/home/xxzhang/miniconda3/bin:$PERL5LIB

再次运行还是不行,我感觉我思路错了。应该将路径添加到bin中。
再次尝试,依然不行。
将数据文件拷贝到perl5路径下可以吗?

尝试2:
cp -r /home/xxzhang/miniconda3/ /home/xxzhang/perl5/
cp -r /home/xxzhang/workplace/software/R/R-3.6.3 /home/xxzhang/perl5/
拷贝结束之后,重新运行:
perl Build.PL
还是不行。
尝试,再将两个文件夹移动到perl5下面的bin文件夹内。
实验记录 | shimmer运行过程中的lib依赖问题(1)查看最后的输出的结果。
同样报相似的错误。

which: no samtools in (/opt/perl5/bin:/opt/curl/bin:/opt/jdk/bin:/opt/go/bin:/opt/SimpleQueue:/opt/tsce4/maui/sbin:/opt/tsce4/maui/bin:/opt/tsce4/torque6/sbin:/opt/tsce4/torque6/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/s bin:/usr/sbin:/opt/ibutils/bin)
ERROR: samtools executable is not found.
This script requires the samtools binary to be in the user’s PATH
which: no R in (/opt/perl5/bin:/opt/curl/bin:/opt/jdk/bin:/opt/go/bin:/opt/SimpleQueue:/opt/tsce4/maui/sbin:/opt/tsce4/maui/bin:/opt/tsce4/torque6/sbin:/opt/tsce4/torque6/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/us r/sbin:/opt/ibutils/bin)
ERROR: R executable is not found.
This script requires the R executable to be in the user’s PATH
ERROR: You have R installed, but it doesn’t seem to have the statmod library.
Shimmer requires the R statmod library to be installed.
Created MYMETA.yml and MYMETA.json
Creating new ‘Build’ script for ‘shimmer’ version ‘0.1’

不过我发现了一个关键的报错信息:

This script requires the R executable to be in the user’s PATH

而且,在路径下也不再发现“/home/xxzhang/perl5/bin”这个提示(我刚刚就是将依赖文件移动到这个路径下的)。

尝试3:
使用conda安装的perl文件,运行,查看会产生什么样的结果。
perl路径:

/home/xxzhang/miniconda3/bin/perl

整体的代码的书写:

/home/xxzhang/miniconda3/bin/perl Build.PL

出现报错信息:

Can’t locate Module/Build.pm in @INC (you may need to install the Module::Build module) (@INC contains: /opt/perl5/lib/perl5/5.26.2/x86_64-linux-thread-multi /opt/perl5/lib/perl5/5.26.2 /opt/perl5/lib/perl5/x86_64-linux-thread-multi /opt/perl5/lib/perl5 /home/xxzhang/miniconda3/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/site_perl/5.26.2 /home/xxzhang/miniconda3/lib/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/5.26.2 .) at Build.PL line 3.
BEGIN failed–compilation aborted at Build.PL line 3.

同样的需要一个build模块。
显示不能够定位这样一个build模块。但是!我们使用whereis路径是可以找得到的!
whereis Module::Build

Module::Build: /usr/share/man/man3/Module::Build.3pm.gz

其实,这里就涉及到了,我们使用何者去编译的问题。在系统中有一个perl指令,而与此同时,在conda路径下也有。所以,在这种情况下,如果我们使用我们自己路径下的perl,是找不到build。所以,问题的最终指向了:

在我们自己的perl中安装模块Module::Build

参考链接: https://www.cnblogs.com/xianguang/p/9845375.html
由于没有root权限,所以选择手动的编译安装。

首先确认一下,模块安装的位置。

/home/xxzhang/miniconda3/lib/5.26.2/

wget https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz
tar -xvzf  Module-Build-0.4231.tar.gz
rm -f Module-Build-0.4231.tar.gz
cd Module-Build-0.4231/
/home/xxzhang/miniconda3/bin/perl  Makefile.PL

最后,报出错误。

running Build.PL
Checking optional features…
inc_bundling_support…disabled
requires:
! inc::latest is not installed
ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions
of the modules indicated above before proceeding with this installation
Created MYMETA.yml and MYMETA.json
Creating new ‘Build’ script for ‘Module-Build’ version ‘0.4231’

安装inc::latest模块。

wget https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/inc-latest-0.500.tar.gz
tar -xvzf inc-latest-0.500.tar.gz
rm -f inc-latest-0.500.tar.gz
cd inc-latest-0.500/
/home/xxzhang/miniconda3/bin/perl  Makefile.PL

Checking if your kit is complete…
Looks good
Generating a Unix-style Makefile
Writing Makefile for inc::latest
Writing MYMETA.yml and MYMETA.json

make
make install DESTDIR=/home/xxzhang/miniconda3/lib/5.26.2/

cp lib/inc/latest/private.pm blib/lib/inc/latest/private.pm
cp lib/inc/latest.pm blib/lib/inc/latest.pm
Manifying 2 pod documents

查看模块是否安装完成,却同样的出现错误。

Can’t locate inc/latest.pm in @INC (you may need to install the inc::latest module) (@INC contains: /usr/share/man/man3 /usr/share/man /opt/perl5/lib/perl5/5.26.2/x86_64-linux-thread-multi /opt/perl5/lib/perl5/5.26.2 /opt/perl5/lib/perl5/x86_64-linux-thread-multi /opt/perl5/lib/perl5 /home/xxzhang/miniconda3/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/site_perl/5.26.2 /home/xxzhang/miniconda3/lib/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/5.26.2 .).
BEGIN failed–compilation aborted.

这个问题,其实和我们之前遇到的问题是一样的。
通过查阅,我们现在从以下几个步骤来解决。
(1)查看模块是否可用。

/home/xxzhang/miniconda3/bin/perl -e ‘use inc::latest;’

如果并未报错,则可用。如果报出上述错误,则说明模块目前不可用。

(2)查看perl模块已有的路径。

perl -e ‘print join("\n", @INC);’

/usr/share/man/man3
/usr/share/man /opt/perl5/lib/perl5/5.26.3/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.3 /opt/perl5/lib/perl5/x86_64-linux-thread-multi
/opt/perl5/lib/perl5
/opt/ActivePerl-5.26/lib/perl5/site_perl/5.26.3/x86_64-linux-thread-multi
/opt/ActivePerl-5.26/lib/perl5/site_perl/5.26.3 /opt/ActivePerl-5.26/lib/perl5/5.26.3/x86_64-linux-thread-multi
/opt/ActivePerl-5.26/lib/perl5/5.26.3 /opt/perl5/lib/perl5/5.26.2/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.2
/opt/perl5/lib/perl5/5.26.1/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.1
/opt/perl5/lib/perl5/5.26.0/x86_64-linux-thread-multi
/opt/perl5/lib/perl5/5.26.0
/opt/ActivePerl-5.26/lib/perl

这个作者提出的问题,太贴心了。这就是我现在所面临的问题:

But if you don’t have root access and you need to install your Perl modules in non-standard directories, how will you get your programs to find your modules?

Assuming that goes okay and you now have the module installed in /home/george/modules, how do you get your Perl/CGI programs to find the module? Fortunately, that too is easy. All you have to do is modify your Perl/CGI program slightly to tell the program where else it should look for modules.

Then I’d modify my Perl/CGI program to find the module by adding this line near the top of my Perl programs;The use lib command is the easiest way I know to modify @INC.

use lib '/home/george/modules';

我明白作者所说的了,就是说我们可以创建一个perl文件,将我们要使用的地址添加到lib中。
编辑perl文本文件。

#!/usr/bin/perl

use lib "/home/xxzhang/miniconda3/lib/5.26.2/";

print "\@INC is @INC\n";

尝试无效。
这种方法,只能够暂时性的,让perl程序使用这个依赖的lib,无法从根本上解决问题。

所以最后的最后,还是求助学长,通过root用户,来将我们的路径添加到里面。


回到shimmer那边。
实验记录 | shimmer运行过程中的lib依赖问题(1)我问了师兄,遇到这种情况,需要把有效的Samtools,R的路径,添加到perl的bin路径下嘛?以及这个过程需要root权限嘛?
师兄淡淡的一句说,添加到自己的PATH路径下就可以了。
然后我按照师兄的解释,做了如下的操作。
我的R以及statmod包的路径是:

export PATH=/home/xxzhang/workplace/software/R/R-3.6.3/bin:$PATH

我的Samtools的路径是:

export PATH=/home/xxzhang/miniconda3/bin:$PATH

然后,居然不再报出相似的错误了!这一步就结束了!(靠谱真好啊!以及遇到问题,自己尝试了很久,也许勤劳的多问,是最后的方法!要向身边的前辈多多学习!)
下面遇到了新的问题。
就是找不到Module::Build模块的问题。我就很奇怪,明明,前面我们通过whereis Module::Build是找到它在:

Module::Build: /usr/share/man/man3/Module::Build.3pm.gz

并且,我还像模像样,将它所在的位置(/usr/share/man/man3/)添加到PERL5LIB路径下,为什么还是会报相同的错误呢?
后来,经过自己的顿悟,我发现这个文件可能并不是我们想要找到的。一般而言,模块文件应该是以.pm为后缀的。所以。这个并不是我们需要的。

===>到现在的这种情况,唯一的办法就是自己安装。
接上面的在执行perl Build.PL语句的时候,报出相似的错误。

Can’t locate inc/latest.pm in @INC (you may need to install the inc::latest module) (@INC contains: /usr/share/man/man3 /usr/share/man /opt/perl5/lib/perl5/5.26.2/x86_64-linux-thread-multi /opt/perl5/lib/perl5/5.26.2 /opt/perl5/lib/perl5/x86_64-linux-thread-multi /opt/perl5/lib/perl5 /home/xxzhang/miniconda3/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/site_perl/5.26.2 /home/xxzhang/miniconda3/lib/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/5.26.2 .).
BEGIN failed–compilation aborted.

换句话说,就是我们前面安装的inc:latest(虽然安装成功了),perl依旧找不到。
这个时候,我就很慌,该怎么办才好呢?需不需要root权限呢(我一直纠结于这件事)?
突然,我顿悟了。我在之前的inc:latest的安装路径下(/home/xxzhang/miniconda3/lib/5.26.2/,这是我们自己规定的),找到了
我们要找的.pm文件。路径如下:

/home/xxzhang/miniconda3/lib/5.26.2/inc-latest-0.500/lib/inc/latest.pm

于是,我弄明白了!
我将路径/home/xxzhang/miniconda3/lib/5.26.2/inc-latest-0.500/lib/inc/,添加到PERL5LIB的路径下。

export PERL5LIB=/home/xxzhang/miniconda3/lib/5.26.2/inc-latest-0.500/lib/inc/:PERL5LIB

经过上述尝试之后,build指令就执行成功了!后来,我顿悟发现,我们需要的模块的路径需要满足以下的条件:
(1)路径下必须直接存放有.pm文件,隔几层路径都不行。
(2)一般而言,如Module::Build的形式,.pm文件会存放在module文件夹下的build文件夹内,是一种嵌套的关系。

执行完成build的编译安装之后,我们继续回到shimmer路径下,对shimmer进行build操作。
/home/xxzhang/miniconda3/bin/perl Build.PL

Created MYMETA.yml and MYMETA.json
Creating new ‘Build’ script for ‘shimmer’ version ‘0.1’

另外我发现,使用系统自带的perl和我们自己下载的绝对路径的perl运行中所依赖的lib是不一样的。
如前面所示,系统自带的perl,其lib常常是opt等(这种情况下,我就很害怕,不是root无法修改)。但是使用我们自己安装的绝对路径下的perl,就很好的解决了这个顾虑。就是说,/home/xxzhang/miniconda3/bin/perl,这是可以很好的用起来的。

(经验总结完毕)


现在遇到了新的问题。
./Build

Building shimmer
cd printCompCounts && make all
make[1]: Entering directory /home/xxzhang/workplace/software/Shimmer/printCompCounts' gcc -O3 -c -o main.o main.c gcc -O3 -c -o params.o params.c gcc -O3 -o printCompCounts main.o params.o -lm make[1]: Leaving directory/home/xxzhang/workplace/software/Shimmer/printCompCounts’
mkdir -p blib/bin && cp printCompCounts/printCompCounts blib/bin/

Can’t locate Module/Build/ConfigData.pm in @INC (you may need to install the Module::Build::ConfigData module) (@INC contains: /home/xxzhang/workplace/software/Shimmer/_build/lib /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib /home/xxz hang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/ /home/xxzhang/workplace/software/Shimmer/_build/lib /home/xxzhang/minico nda3/lib/5.26.2/Module-Build-0.4231/lib/ /home/xxzhang/miniconda3/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/site_perl/5.26.2 /home/xxzhang/miniconda3/lib/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/5.26.2 .) at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build/Base.pm line 679.

同样的,还需要下载一个Module::Build::ConfigData的模块。
在网站中(https://metacpan.org/search?q=Build%3A%3AConfigData)检索关键词“configdata”。

cd   /home/xxzhang/miniconda3/lib/5.26.2/
wget https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz

突然,发现也许我们并不需要下载安装,这个文件应该就在Module/Build的文件夹下面。
设置模块所在的路径:
export PERL5LIB=/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build:$PERL5LIB
再次build。
cd /home/xxzhang/workplace/software/Shimmer
./Build
又出现了新的错误。

Global symbol “%Config” requires explicit package name (did you forget to declare “my %Config”?) at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build/Config.pm line 20.
Global symbol “%Config” requires explicit package name (did you forget to declare “my %Config”?) at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build/Config.pm line 56.
Compilation failed in require at /home/xxzhang/miniconda3/lib/5.26.2/File/Copy.pm line 14.
BEGIN failed–compilation aborted at /home/xxzhang/miniconda3/lib/5.26.2/File/Copy.pm line 14.
Compilation failed in require at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build/Base.pm line 14.
BEGIN failed–compilation aborted at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build/Base.pm line 14.
Compilation failed in require at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build.pm line 17.
BEGIN failed–compilation aborted at /home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build.pm line 17.
Compilation failed in require at /home/xxzhang/workplace/software/Shimmer/_build/lib/My/Build.pm line 2.
BEGIN failed–compilation aborted at /home/xxzhang/workplace/software/Shimmer/_build/lib/My/Build.pm line 2.
Compilation failed in require at ./Build line 45.
BEGIN failed–compilation aborted at ./Build line 45.

遇到这个问题,我觉得还是ConfigData.pm这个模块安装的不对,一般而言已经配置好的为什么还会出现“未声明变量”这种低级的错误呢?

cd   /home/xxzhang/miniconda3/lib/5.26.2/
wget https://cpan.metacpan.org/authors/id/F/FX/FXFX/Integrator-Module-Build-1.057.tar.gz
tar -xvzf Integrator-Module-Build-1.057.tar.gz
cd   Integrator-Module-Build-1.057/

我们找到了文件下的真正的我们需要的ConfigData.pm的文件的存放的位置。
实验记录 | shimmer运行过程中的lib依赖问题(1)
将该文件所在的路径写入到PERL5LIB的变量中。

export PERL5LIB=/home/xxzhang/miniconda3/lib/5.26.2/Integrator-Module-Build-1.057/lib/Integrator/Test:$PERL5LIB

但是,虽然经过了这一步的操作。依然会报错。猜测主要原因是没有把就有的那个lib清楚掉。
于是,在网上查找如何清除path变量中的值(参考链接: https://www.cnblogs.com/xiaopiyuanzi/p/11910107.html)。
得到了一个暂时性的方法(适用于目前,能够继续运行,对我们而言就是有价值的)。
echo $PERL5LIB

/home/xxzhang/miniconda3/lib/5.26.2/Integrator-Module-Build-1.057/lib/Integrator/Test:/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build:/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/:

原先:

export PERL5LIB=/home/xxzhang/miniconda3/lib/5.26.2/Integrator-Module-Build-1.057/lib/Integrator/Test:/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/Build:/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/:

修改:

export PERL5LIB=/home/xxzhang/miniconda3/lib/5.26.2/Integrator-Module-Build-1.057/lib/Integrator/Test:/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/Module/:/home/xxzhang/miniconda3/lib/5.26.2/Module-Build-0.4231/lib/:

修改之后,再次运行,果然不再出现之前的错误了。这一步算是成功。

出现了新的错误,不过这些错误问题不大。我们只需要非常有耐心的,将这些模块一个个安装完成即可。

-bash-4.2$ /home/xxzhang/miniconda3/bin/perl Build.PL
Checking prerequisites…
requires:
! Crypt::SSLeay is not installed
! Data::UUID is not installed
! Devel::Symdump is not installed
! Term::ReadKey is not installed
! Test::Cmd is not installed
! Test::Pod is not installed
! Test::Pod::Coverage is not installed
! XML::NamespaceSupport is not installed
! XML::Parser is not installed
! XML::SAX is not installed
! XML::SAX::Expat is not installed
! XML::Simple is not installed
build_requires:
! HTML::Parser is not installed
! HTML::Tagset is not installed
! LWP::UserAgent is not installed
! Method::Alias is not installed
! Module::Starter is not installed
! Test::TAP::Model is not installed
! URI is not installed
ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions
of the modules indicated above before proceeding with this installation
Run ‘Build installdeps’ to install missing prerequisites.
Created MYMETA.yml and MYMETA.json
Creating new ‘Build’ script for ‘Integrator-Module-Build’ version ‘1.057’

先去吃个饭,回头再来解决这件事。

上一篇:Test::Nginx 安装


下一篇:1. Overview of Amazon Web Services White Paper