BLESS安装方法
首先新建一个目录
mkdir bless_c++
cd bless_c++
然后把源码克隆到本地
git clone https://github.com/thirtyeggs/bless.git
进入目录,执行编译
cd bless
make -j8
编译报错
mpicxx kmc/kmc_api/kmc_file.o kmc/kmc_api/kmer_api.o kmc/kmc_api/mmer.o murmurhash3/MurmurHash3.o check_inputs.o correct_errors.o count_solid_kmers.o main.o parse_args.o -o bless ./boost/lib/libboost_filesystem.a ./boost/lib/libboost_system.a ./boost/lib/libboost_iostreams.a ./zlib/install/lib/libz.a -fopenmp -std=c++11
/usr/bin/ld: ./boost/lib/libboost_filesystem.a(operations.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./boost/lib/libboost_filesystem.a(path.o): relocation R_X86_64_32S against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./boost/lib/libboost_system.a(error_code.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ./boost/lib/libboost_iostreams.a(mapped_file.o): relocation R_X86_64_32S against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:10: recipe for target 'bless' failed
make: *** [bless] Error 1
进入Makefile
文件查看问题
看样子是第十行有点问题
他这里说是执行到这一行的时候报错,让我们研究一下这一行具体做了什么
了解过Makefile
的同学都知道,这一行实际意思就是将LAFLAGS
这些库链接为$(OBJ)
也就是bless
,应该是整个编译过程比较靠后的位置,使用的编译器为mpicxx
,那么这个mpicxx
又是何方神圣呢
不妨新开一个终端,在命令行输入一下这个命令
mpicxx --version master ✗
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
查阅资料发现,这个其实就是编译链接使用c++开发的MPI项目,没听说过是干什么的(暴露了知识的贫乏),不过似乎感觉类似于g++
官网这里给出了一些参数,输入--help
查看一下比较详细的情况
里面有一个pie
参数
-pie Create a position independent executable.
立刻想到之前的报错信息
/usr/bin/ld: ./boost/lib/libboost_filesystem.a(operations.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC
查阅资料发现PIE(Position-Independent-Executable)
是位置无关的程序,产生的每一条指令,全部使用相对地址,可以被加载到内存的任意位置,就像共享库一样。那么在这个问题中,又是怎么回事呢?
看起来是要加上参数-fPIC
,但是仔细一看,却发现真正的原因其实是boost库的问题,也就是那些.a
文件不匹配,这些文件既然不匹配,那么推测就不能使用-fPIC
参数,所以需要在编译参数中加上-no-pie
即可
加上后果然正常了,不过发现cd到下面的目录又是相同的错误
只需要再次找到出错的Makefile位置即可
cd kmc
vim makefile
没有报错!已经正常安装了
试一下看看,成功了!