refresh-bio / kmer-db

Kmer-db is a fast and memory-efficient tool for large-scale k-mer analyses (indexing, querying, estimating evolutionary relationships, etc.).
GNU General Public License v3.0
81 stars 16 forks source link

v1.6.2 not compiling in CentOS7 and pre-compiled binary missing libraries #10

Closed fpusan closed 4 years ago

fpusan commented 4 years ago

Hi,

I'm trying to use kmer-db in a CentOS machine with the default g++ 4.8.5 compiler.

The pre compiled binary fails to start with the following message:

./kmer-db-1.6.2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by ./kmer-db-1.6.2)
./kmer-db-1.6.2: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./kmer-db-1.6.2)
./kmer-db-1.6.2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./kmer-db-1.6.2)
./kmer-db-1.6.2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./kmer-db-1.6.2)
./kmer-db-1.6.2: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./kmer-db-1.6.2)

On the other hand, trying to compile with g++ 4.8.5 (which is supported according to the ReadMe) fails with

g++: error: unrecognized command line option ‘-std=c++14’

Following https://stackoverflow.com/questions/31965413/compile-c14-code-with-g y tried to change the option -std=c++14 to -std=c++1y in the makefile. It compiles for a while but then fails with

In file included from /usr/include/c++/4.8.2/algorithm:62:0,
                 from src/similarity_calculator.cpp:4:
/usr/include/c++/4.8.2/bits/stl_algo.h: In instantiation of ‘_FIter std::upper_bound(_FIter, _FIter, const _Tp&, _Compare) [with _FIter = __gnu_cxx::__normal_iterator<std::tuple<unsigned int, unsigned int, unsigned int>*, std::vector<std::tuple<unsigned int, unsigned int, unsigned int> > >; _Tp = std::tuple<unsigned int, unsigned int, unsigned int>; _Compare = SimilarityCalculator::operator()(PrefixKmerDb&, LowerTriangularMatrix<unsigned int>&) const::__lambda10]’:
src/similarity_calculator.cpp:348:56:   required from here
/usr/include/c++/4.8.2/bits/stl_algo.h:2543:31: error: no match for call to ‘(SimilarityCalculator::operator()(PrefixKmerDb&, LowerTriangularMatrix<unsigned int>&) const::__lambda10) (const std::tuple<unsigned int, unsigned int, unsigned int>&, std::tuple<unsigned int, unsigned int, unsigned int>&)’
    if (__comp(__val, *__middle))
                               ^
src/similarity_calculator.cpp:348:6: note: candidates are:
     [](auto x, auto y) {return get<0>(x) < get<0>(y); }); // Necessary, because we are looking for end of sample data
      ^
In file included from /usr/include/c++/4.8.2/algorithm:62:0,
                 from src/similarity_calculator.cpp:4:
/usr/include/c++/4.8.2/bits/stl_algo.h:2543:31: note: void (*)() <conversion>
    if (__comp(__val, *__middle))
                               ^
/usr/include/c++/4.8.2/bits/stl_algo.h:2543:31: note:   candidate expects 1 argument, 3 provided
src/similarity_calculator.cpp:348:22: note: SimilarityCalculator::operator()(PrefixKmerDb&, LowerTriangularMatrix<unsigned int>&) const::__lambda10
     [](auto x, auto y) {return get<0>(x) < get<0>(y); }); // Necessary, because we are looking for end of sample data
                      ^
src/similarity_calculator.cpp:348:22: note:   candidate expects 0 arguments, 2 provided
make: *** [src/similarity_calculator.o] Error 1

Is there any way I can use kmer-db without upgrading my compiler and system libraries? I know I could create a custom conda environment, but I'd rather avoid that, as I would like to use kmer-db in conjunction with other software that already works well with the standard CentOS7 libraries.

Thank you very much in advance for your help,

Fernando

agudys commented 4 years ago

Dear Fernando, I'll take a look on that ASAP. Regards, Adam

fpusan commented 4 years ago

Dear Adam, I managed to get around the issue by manually compiling gcc 5.4 and using it to compile kmer-db from source. I then link the right versions of libstdc++ and libgomp with LD_LIBRARY_PATH when calling the program. So far the program seems to be working ok in different systems (CentOS7, Ubuntu14, Ubuntu18) as long as I also link to the right libstdc++ and libgomp. Best, Fernando

agudys commented 4 years ago

Dear Fernando, Sorry for the delay. I am happy you've found a workaround. However, we've made a code C++11 compatible and now it compiles properly on g++ 4.8.5. Best, Adam