我尝试使用生物信息学软件Jellyfish。在[make]和[make install]中一切顺利。可执行bin文件也可以。我想要的是针对Jellyfish包含文件和共享库编译我自己的代码。
我尝试编译以下简单代码,这很简单,只有一个hash_counter声明。
#include <iostream>
#include <jellyfish/mer_dna.hpp>
#include <jellyfish/hash_counter.hpp>
typedef jellyfish::cooperative::hash_counter<jellyfish::mer_dna> mer_hash_type;
int main(int argc, char *argv[]) {
jellyfish::mer_dna::k(25); // Set length of mers (k=25)
const uint64_t hash_size = 10000000; // Initial size of hash.
const uint32_t num_reprobes = 126;
const uint32_t num_threads = 16; // Number of concurrent threads
const uint32_t counter_len = 7; // Minimum length of counting field
const bool canonical = true; // Use canonical representation
// create the hash
mer_hash_type mer_hash(hash_size, jellyfish::mer_dna::k()*2, counter_len, num_threads, num_reprobes);
return 0;
}
可以使用以下命令在Mac上成功编译此代码
$g++ -std=c++11 -I/home/jellyfish_lib/include/jellyfish-2.2.5 -L/home/jellyfish_lib/lib -lpthread -ljellyfish-2.0 test.c -o test
但在Ubuntu(使用g ++ 4.9)上编译时失败,出现以下错误,
/tmp/ccKzjmVq.o: In function `main':
test.c:(.text+0x56): undefined reference to `jellyfish::quadratic_reprobes'
/tmp/ccKzjmVq.o: In function `jellyfish::random_bits()':
test.c:(.text._ZN9jellyfish11random_bitsEv[_ZN9jellyfish11random_bitsEv]+0xa): undefined reference to `jellyfish::random_bits(int)'
/tmp/ccKzjmVq.o: In function `allocators::mmap::~mmap()':
test.c:(.text._ZN10allocators4mmapD2Ev[_ZN10allocators4mmapD5Ev]+0x14): undefined reference to `allocators::mmap::free()'
/tmp/ccKzjmVq.o: In function `jellyfish::RectangularBinaryMatrix::RectangularBinaryMatrix(unsigned int, unsigned int)':
test.c:(.text._ZN9jellyfish23RectangularBinaryMatrixC2Ejj[_ZN9jellyfish23RectangularBinaryMatrixC5Ejj]+0x1d): undefined reference to `jellyfish::RectangularBinaryMatrix::alloc(unsigned int, unsigned int)'
/tmp/ccKzjmVq.o: In function `jellyfish::RectangularBinaryMatrix::RectangularBinaryMatrix(jellyfish::RectangularBinaryMatrix const&)':
test.c:(.text._ZN9jellyfish23RectangularBinaryMatrixC2ERKS0_[_ZN9jellyfish23RectangularBinaryMatrixC5ERKS0_]+0x23): undefined reference to `jellyfish::RectangularBinaryMatrix::alloc(unsigned int, unsigned int)'
/tmp/ccKzjmVq.o: In function `jellyfish::RectangularBinaryMatrix::randomize_pseudo_inverse()':
test.c:(.text._ZN9jellyfish23RectangularBinaryMatrix24randomize_pseudo_inverseEv[_ZN9jellyfish23RectangularBinaryMatrix24randomize_pseudo_inverseEv]+0x24): undefined reference to `jellyfish::RectangularBinaryMatrix::randomize_pseudo_inverse(unsigned long (*)())'
/tmp/ccKzjmVq.o: In function `jellyfish::locks::pthread::barrier::barrier(unsigned int)':
test.c:(.text._ZN9jellyfish5locks7pthread7barrierC2Ej[_ZN9jellyfish5locks7pthread7barrierC5Ej]+0x1f): undefined reference to `pthread_barrier_init'
/tmp/ccKzjmVq.o: In function `jellyfish::locks::pthread::barrier::~barrier()':
test.c:(.text._ZN9jellyfish5locks7pthread7barrierD2Ev[_ZN9jellyfish5locks7pthread7barrierD5Ev]+0x14): undefined reference to `pthread_barrier_destroy'
/tmp/ccKzjmVq.o: In function `jellyfish::large_hash::array_base<jellyfish::mer_dna_ns::mer_base_static<unsigned long, 0>, unsigned long, atomic::gcc, jellyfish::large_hash::array<jellyfish::mer_dna_ns::mer_base_static<unsigned long, 0>, unsigned long, atomic::gcc, allocators::mmap> >::array_base(unsigned long, unsigned short, unsigned short, unsigned short, jellyfish::RectangularBinaryMatrix, unsigned long const*)':
test.c:(.text._ZN9jellyfish10large_hash10array_baseINS_10mer_dna_ns15mer_base_staticImLi0EEEmN6atomic3gccENS0_5arrayIS4_mS6_N10allocators4mmapEEEEC2EmtttNS_23RectangularBinaryMatrixEPKm[_ZN9jellyfish10large_hash10array_baseINS_10mer_dna_ns15mer_base_staticImLi0EEEmN6atomic3gccENS0_5arrayIS4_mS6_N10allocators4mmapEEEEC5EmtttNS_23RectangularBinaryMatrixEPKm]+0x269): undefined reference to `jellyfish::RectangularBinaryMatrix::pseudo_inverse() const'
/tmp/ccKzjmVq.o: In function `jellyfish::large_hash::array<jellyfish::mer_dna_ns::mer_base_static<unsigned long, 0>, unsigned long, atomic::gcc, allocators::mmap>::alloc_data(unsigned long)':
test.c:(.text._ZN9jellyfish10large_hash5arrayINS_10mer_dna_ns15mer_base_staticImLi0EEEmN6atomic3gccEN10allocators4mmapEE10alloc_dataEm[_ZN9jellyfish10large_hash5arrayINS_10mer_dna_ns15mer_base_staticImLi0EEEmN6atomic3gccEN10allocators4mmapEE10alloc_dataEm]+0x1f): undefined reference to `allocators::mmap::realloc(unsigned long)'
collect2: error: ld returned 1 exit status
链接期间似乎出现了问题。有没有人有这方面的经验?