marbl / MashMap

A fast approximate aligner for long DNA sequences
Other
269 stars 39 forks source link

MashMap 2.0 Compiling error: undefined reference to '__wrap_memcpy' #10

Open uoabowen opened 6 years ago

uoabowen commented 6 years ago

MashMap version: 2.0 Using: gcc/g++ 5.4.0 GSL 2.4 Boost/1.61.0

[a1695820@l01 MashMap-2.0]$ ./bootstrap.sh [a1695820@l01 MashMap-2.0]$ ./configure --prefix=/home/a1695820/fastdir/SR531867/MashMap checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking zlib.h usability... yes checking zlib.h presence... yes checking for zlib.h... yes checking gsl/gsl_cdf.h usability... yes checking gsl/gsl_cdf.h presence... yes checking for gsl/gsl_cdf.h... yes configure: creating ./config.status config.status: creating Makefile [a1695820@l01 MashMap-2.0]$ make g++ -O3 -DNDEBUG -std=c++11 -Wno-deprecated-declarations -Isrc -I /usr/local//include -include src/common/memcpyLink.h -Wl,--wrap=memcpy src/map/mash_map.cpp -o mashmap -L/usr/local//lib -lgsl -lgslcblas -lstdc++ -lz -lm -lpthread /tmp/ccU9syl1.o:mash_map.cpp:function void std::cxx11::basic_string<char, std::char_traits, std::allocator >::_M_construct<char>(char, char*, std::forward_iterator_tag) [clone .isra.299]: error: undefined reference to 'wrap_memcpy' /tmp/ccU9syl1.o:mash_map.cpp:function kseq_read(kseq_t): error: undefined reference to '__wrap_memcpy' /tmp/ccU9syl1.o:mash_map.cpp:function kseq_read(kseq_t): error: undefined reference to 'wrap_memcpy' /tmp/ccU9syl1.o:mash_map.cpp:function gnu_cxx::normal_iterator<skch::MappingResult*, std::vector<skch::MappingResult, std::allocator > > std::vector<skch::MappingResult, std::allocator >::insert<__gnu_cxx::normal_iterator<skch::MappingResult, std::vector<skch::MappingResult, std::allocator > >, void>(__gnu_cxx::__normal_iterator<skch::MappingResult const, std::vector<skch::MappingResult, std::allocator > >, gnu_cxx::__normal_iterator<skch::MappingResult*, std::vector<skch::MappingResult, std::allocator > >, gnu_cxx::__normal_iterator<skch::MappingResult*, std::vector<skch::MappingResult, std::allocator > >): error: undefined reference to '__wrap_memcpy' collect2: error: ld returned 1 exit status make: *** [mashmap] Error 1

AGI-chandler commented 6 years ago

I had this error too and found this document, https://stackoverflow.com/questions/36461555/is-it-possible-to-statically-link-libstdc-and-wrap-memcpy

So I edited the src/common/memcpyLink.h file so it looked like this:

#include <string.h>

__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");

extern "C"
{
void *__wrap_memcpy(void *dest, const void *src, size_t n)
{
    return memcpy(dest, src, n);
}
}

Then the compilation was successful.

uoabowen commented 6 years ago

Thanks @AGI-admin

After editing the src/common/memcpyLink.h as the description, I could compile it without any errors.

But when I executed

./mashmap -h

it hung without any outputs.

AGI-chandler commented 6 years ago

Sorry I'm not sure then, @uoabowen ... it ran OK over here.