Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
uoabowen opened this issue May 8, 2018 · 3 comments
Open

Comments

@uoabowen
Copy link

uoabowen commented May 8, 2018

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

@AGI-chandler
Copy link

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
Copy link
Author

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants