MashMap icon indicating copy to clipboard operation
MashMap copied to clipboard

MashMap 2.0 Compiling error: undefined reference to '__wrap_memcpy'

Open uoabowen opened this issue 6 years ago • 3 comments

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::allocatorskch::MappingResult > > std::vector<skch::MappingResult, std::allocatorskch::MappingResult >::insert<__gnu_cxx::__normal_iterator<skch::MappingResult*, std::vector<skch::MappingResult, std::allocatorskch::MappingResult > >, void>(__gnu_cxx::__normal_iterator<skch::MappingResult const*, std::vector<skch::MappingResult, std::allocatorskch::MappingResult > >, __gnu_cxx::__normal_iterator<skch::MappingResult*, std::vector<skch::MappingResult, std::allocatorskch::MappingResult > >, __gnu_cxx::__normal_iterator<skch::MappingResult*, std::vector<skch::MappingResult, std::allocatorskch::MappingResult > >): error: undefined reference to '__wrap_memcpy' collect2: error: ld returned 1 exit status make: *** [mashmap] Error 1

uoabowen avatar May 08 '18 04:05 uoabowen

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.

AGI-chandler avatar May 15 '18 00:05 AGI-chandler

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.

uoabowen avatar May 15 '18 07:05 uoabowen

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

AGI-chandler avatar May 17 '18 00:05 AGI-chandler