工具链安装
LACHESIS依赖boost库,且经过测试1.52~1.67版本的boost库可以顺利编译LACHESIS,版本过高会导致报错,而低版本的boost库在高版本的gcc下也会编译错误,因此经过测试,本文采用的相关软件版本如下:
- gcc 6.4.0
- boost 1.67.0
GCC 6.4 安装
gcc 6.4下载
# 下载GCC 6.4.0
wget https://gcc.gnu.org/pub/gcc/releases/gcc-6.4.0/gcc-6.4.0.tar.gz
tar zxvf gcc-6.4.0.tar.gz
依赖下载
cd gcc-6.4.0
# 执行:
./contrib/download_prerequisites
# 或者手工执行下列命令
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
tar jxvf mpfr-2.4.2.tar.bz2
ln -s mpfr-2.4.2 mpfr
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
tar jxvf gmp-4.3.2.tar.bz2
ln -s gmp-4.3.2 gmp
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
tar zxvf mpc-0.8.1.tar.gz
ln -s mpc-0.8.1 mpc
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.15.tar.bz2
tar jxvf isl-0.15.tar.bz2
ln -s isl-0.15 isl
高版本gcc下编译安装gcc 6.4需要修改源码
vim x86_64-pc-linux-gnu/libgcc/md-unwind-support.h
# 修改61行的
struct ucontext *uc_ = context->cfa;
# 为
struct ucontext_t *uc_ = context->cfa;
编译安装gcc
./configure --prefix=/path/to/gcc-6.4.0 --enable-bootstrap --enable-languages=c,c++,fortran --enable-threads=posix --disable-multilib --disable-libsanitizer
make
make install
Boost库安装
下载boost库
wget https://boostorg.jfrog.io/artifactory/main/release/1.67.0/source/boost_1_67_0.tar.bz2
tar jxvf boost_1_67_0.tar.bz2
cd boost_1_67_0
编译安装boost库
export PATH=/path/to/gcc-6.4.0/bin:$PATH
export LD_LIBRARY_PATH=/path/to/gcc-6.4.0/lib64:$LD_LIBRARY_PATH
./bootstrap.sh --prefix=/path/to/boost-1.67.0
./b2 install
注意:由于boost库后续移除了库文件的-mt后缀,如果之前系统上装了boost库,由于LACHESIS会优先搜索带-mt后缀的库,可能会导致检索到错误的库,解决方法如下:
添加-mt后缀
./b2 --layout=tagged install
或者在configure LACHESIS后搜索LACHESIS目录下的每个Makefile(包括子目录),并执行
//注意当且仅当上一步操作中未添加--layout=tagged使得自己编译的boost库文件不存在-mt版本,
//并且系统中存在-mt的boost库版本时才需要执行此操作
sed -i 's/-mt//g' Makefile
再进行make操作。
LACHESIS安装
下载LACHESIS
git clone https://github.com/shendurelab/LACHESIS.git
mv LACHESIS LACHESIS-src
cd LACHESIS-src
// 解压samtools 0.1.19
cd src/include
tar zxvf samtools-legacy_0.1.19_debian.tar.gz
cd samtools-legacy_0.1.19_debian
make
cd ../../..
// 修改源代码
// 编辑src/include/gtools/SAMStepper.h和src/include/gtools/SAMStepper.cc,把
#include <bam/sam.h>
// 改为
#include <sam.h>
// 配置LACHESIS
./configure --prefix=/path/to/LACHESIS --with-samtools=/path/to/LACHESIS-src/src/include/samtools-legacy_0.1.19_debian --with-boost=/path/to/boost-1.67.0
make CFLAGS="-I/path/to/LACHESIS-src/src/include/samtools-legacy_0.1.19_debian -I/path/to/boost-1.67.0/include -L/path/to/boost-1.67.0/lib" CXXFLAGS=$CFLAGS
make install
添加环境变量
# 将下列语句添加到.bash_profile或.bashrc或.zshrc中(取决于你的shell环境)
export PATH=/path/to/LACHESIS/bin:$PATH
测试LACHESIS
cd /path/to/LACHESIS-src/
cd src/bin
Lachesis INIs/test_case.ini