TGAC / KAT

The K-mer Analysis Toolkit (KAT) contains a number of tools that analyse and compare K-mer spectra.
http://www.earlham.ac.uk/kat-tools
GNU General Public License v3.0
206 stars 52 forks source link

make fails - undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)' #68

Closed shyamrallapalli closed 6 years ago

shyamrallapalli commented 7 years ago

Hi,

make fails with following errors I have tried v 2.2.0 and 2.3.0 and both result in the same errors.

I don't understand the errors, complete logs are attached at the end of the post. Could you please help me to fix this.

  CXX      kat-kat.o
  CXXLD    kat
kat-plot_spectra_mx.o: In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-plot.o: In function `kat::Plot::convertCharToWideChar(char const*)':
/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/src/plot.cc:112: undefined reference to `__cxa_throw_bad_array_new_length'
kat-filter_kmer.o: In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-filter_sequence.o: In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-histogram.o: In function `at':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-sect.o: In function `at':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-sect.o:/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: more undefined references to `std::__throw_out_of_range_fmt(char const*, ...)' follow
../lib/.libs/libkat.a(libkat_la-jellyfish_helper.o): In function `jflib::basic_circular_buffer<unsigned long, 32u, 4294967295ul>::basic_circular_buffer(unsigned long)':
/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/lib/../deps/jellyfish-2.2.0/include/jellyfish/circular_buffer.hpp:51: undefined reference to `__cxa_throw_bad_array_new_length'
../lib/.libs/libkat.a(libkat_la-jellyfish_helper.o): In function `jellyfish::mer_heap::heap<jellyfish::mer_dna_ns::mer_base_static<unsigned long, 0>, jellyfish::large_hash::region_iterator_base<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> > > >::initialize(unsigned long)':
/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/lib/../deps/jellyfish-2.2.0/include/jellyfish/mer_heap.hpp:72: undefined reference to `__cxa_throw_bad_array_new_length'
../deps/jellyfish-2.2.0/.libs/libkat_jellyfish.a(misc.o): In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
collect2: error: ld returned 1 exit status
make[2]: *** [kat] Error 1
make[2]: Leaving directory `/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0'
make: *** [all] Error 2

grep "no" in configure log

grep "no$" kat_configure_log.txt
checking whether we are cross compiling... no
checking whether g++ supports C++11 features by default... no
checking for dlltool... no
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking if gcc supports -fno-rtti -fno-exceptions... no
checking if gcc static flag -static works... no
checking whether -lc should be explicitly linked in... no
checking if g++ static flag -static works... no
checking if compiler needs -Werror to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... no
checking whether we are cross compiling... no
checking for dlltool... no
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking if gcc supports -fno-rtti -fno-exceptions... no
checking if gcc static flag -static works... no
checking whether -lc should be explicitly linked in... no
checking if g++ static flag -static works... no
checking for _NSGetExecutablePath... no

complete logs

kat_configure_log.txt kat_make_log.txt

Many thanks

maplesond commented 7 years ago

I suspect that this is an issue with the version of GCC you are using. We use C++11 features quite heavily and it maybe that GCC 4.9 doesn't fully support all C++11 options. Having said that I have previously used GCC 4.8 and that worked fine, although I haven't tried recently. Is it possible for you to try a more recent version of GCC?

shyamrallapalli commented 7 years ago

thanks @maplesond sure will try with a recent version of GCC. any recommendation on recent GCC version Also if you can recollect, can you please share the version of KAT that worked with GCC 4.8

maplesond commented 7 years ago

Ok, I am able to reproduce this one in my travis environment. But only when including python. Can you rerun your make command like this: make V=1? Then post the log. That will show the actual compilation and linking commands used.

shyamrallapalli commented 7 years ago

here is the log

Making all in src
make[2]: Entering directory `/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/src'
/bin/sh ../libtool  --tag=CXX   --mode=link g++ -g -O3 -fwrapv -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-command-line-argument -ansi -pedantic -std=c++11 -DCPLUSPLUS -g -O2 -std=gnu++11 -L../lib/.libs -L../deps/jellyfish-2.2.0/.libs -L/gpfs/software/boost/1.62.0/gcc//lib -Xlinker -export-dynamic -L/gpfs/software/libtool/2.4.6/lib -L/gpfs/software/bwa/0.7.12/lib -L/gpfs/software/samtools/1.3.1/gcc/lib -L/gpfs/software/libtool/2.4.6/lib -L/gpfs/software/bwa/0.7.12/lib -L/gpfs/software/samtools/1.3.1/gcc/lib -o kat kat-plot_density.o kat-plot_profile.o kat-plot_spectra_cn.o kat-plot_spectra_mx.o kat-plot_spectra_hist.o kat-plot.o kat-filter_kmer.o kat-filter_sequence.o kat-filter.o kat-comp.o kat-gcp.o kat-histogram.o kat-sect.o kat-kat.o -pthread /gpfs/software/boost/1.62.0/gcc//lib/libboost_timer.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_chrono.a -lrt /gpfs/software/boost/1.62.0/gcc//lib/libboost_filesystem.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_program_options.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_system.a  -lpthread -ldl  -lutil -lrt -lm -L/gpfs/software/python/anaconda/4.2/anaconda3/lib -lpython3.5m -l:libkat.a -l:libkat_jellyfish.a -lrt 
libtool: link: g++ -g -O3 -fwrapv -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-command-line-argument -ansi -pedantic -std=c++11 -DCPLUSPLUS -g -O2 -std=gnu++11 -Wl,-export-dynamic -o kat kat-plot_density.o kat-plot_profile.o kat-plot_spectra_cn.o kat-plot_spectra_mx.o kat-plot_spectra_hist.o kat-plot.o kat-filter_kmer.o kat-filter_sequence.o kat-filter.o kat-comp.o kat-gcp.o kat-histogram.o kat-sect.o kat-kat.o -pthread  -L../lib/.libs -L../deps/jellyfish-2.2.0/.libs -L/gpfs/software/boost/1.62.0/gcc//lib -L/gpfs/software/libtool/2.4.6/lib -L/gpfs/software/bwa/0.7.12/lib -L/gpfs/software/samtools/1.3.1/gcc/lib /gpfs/software/boost/1.62.0/gcc//lib/libboost_timer.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_chrono.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_filesystem.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_program_options.a /gpfs/software/boost/1.62.0/gcc//lib/libboost_system.a -lpthread -ldl -lutil -lm -L/gpfs/software/python/anaconda/4.2/anaconda3/lib -lpython3.5m -l:libkat.a -l:libkat_jellyfish.a -lrt -pthread
kat-plot_spectra_mx.o: In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-plot.o: In function `kat::Plot::convertCharToWideChar(char const*)':
/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/src/plot.cc:112: undefined reference to `__cxa_throw_bad_array_new_length'
kat-filter_kmer.o: In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-filter_sequence.o: In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-histogram.o: In function `at':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-sect.o: In function `at':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
kat-sect.o:/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/stl_vector.h:803: more undefined references to `std::__throw_out_of_range_fmt(char const*, ...)' follow
../lib/.libs/libkat.a(libkat_la-jellyfish_helper.o): In function `jflib::basic_circular_buffer<unsigned long, 32u, 4294967295ul>::basic_circular_buffer(unsigned long)':
/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/lib/../deps/jellyfish-2.2.0/include/jellyfish/circular_buffer.hpp:51: undefined reference to `__cxa_throw_bad_array_new_length'
../lib/.libs/libkat.a(libkat_la-jellyfish_helper.o): In function `jellyfish::mer_heap::heap<jellyfish::mer_dna_ns::mer_base_static<unsigned long, 0>, jellyfish::large_hash::region_iterator_base<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> > > >::initialize(unsigned long)':
/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/lib/../deps/jellyfish-2.2.0/include/jellyfish/mer_heap.hpp:72: undefined reference to `__cxa_throw_bad_array_new_length'
../deps/jellyfish-2.2.0/.libs/libkat_jellyfish.a(misc.o): In function `_M_check':
/gpfs/software/compilers/gcc/4.9.3/include/c++/4.9.3/bits/basic_string.h:324: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
collect2: error: ld returned 1 exit status
make[2]: *** [kat] Error 1
make[2]: Leaving directory `/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/gpfs/home/veb06hwu/programs/kat-2.3.0/kat-2.3.0'
make: *** [all] Error 2
maplesond commented 7 years ago

Thanks for the log @shyamrallapalli . I still don't have a definitive answer to this but I think I've narrowed the problem down to an incompatibility with the toolchains that were used to build the various dependencies. Most likely the dependency that's causing the issue is python. I've made some modifications to the configuration script. Could you checkout the top of the develop branch, then run ./autogen.sh && ./configure --disable-plotting && make. Hopefully, that bypasses the issue your facing, although it will mean that the plotting functionality is disabled. If that fixes the problem, I'll try and make further changes, or suggest workarounds, that can avoid the issue you are facing while still retaining the plotting functionality.

shyamrallapalli commented 7 years ago

Many thanks for looking in to this @maplesond I now have compiled using sources from latest develop branch, as suggested and kat has compiled fine.

but when tried to run kat, gave following error ./kat: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

so ran using python lib path (based on a suggestion from stack exchange) and has been working fine LD_LIBRARY_PATH=/gpfs/software/python/anaconda/4.2/anaconda3/lib ./kat

I have tested using small read data sets and is working fine and kat could plot density and spectra as well

maplesond commented 7 years ago

Brilliant. Great that it's working for you and thanks for letting me know.

In my travis environment I still encounter the original issue you posted here but only when using python plotting. I'll leave this case open for now until I'm sure I've got a proper fix.

maplesond commented 6 years ago

Hi @shyamrallapalli, I'm currently putting together a new version of KAT, and hopefully all these build issues should be fixed.
I'll close this case when the new release is out, but in the meantime you can try the develop branch to see if that addresses these issues.

maplesond commented 6 years ago

Fixed in latest release.