http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354
Markus Trippelsdorf <markus at trippelsdorf dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |markus at trippelsdorf dot | |de --- Comment #8 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-11-17 21:08:21 UTC --- (In reply to comment #7) > (In reply to comment #6) > > Answering my own question: we can get static linking with > > -Wl,-Bstatic -lasan -Wl,-Bdynamic -ldl -lpthread > > > > The -static-libasan option was added by > > http://gcc.gnu.org/ml/gcc-cvs/2012-11/msg00536.html Can you please add "-ldl -lpthread" to it? Otherwise the user has to set this by hand: markus@x4 ~ % g++ -faddress-sanitizer -static-libasan -g test.cpp /home/markus/gcc/libsanitizer/sanitizer_common/sanitizer_linux.cc:135: error: undefined reference to 'pthread_getattr_np' /home/markus/gcc/libsanitizer/sanitizer_common/sanitizer_linux.cc:138: error: undefined reference to 'pthread_attr_getstack' /home/markus/gcc/libsanitizer/asan/asan_posix.cc:103: error: undefined reference to 'pthread_key_create' /home/markus/gcc/libsanitizer/asan/asan_posix.cc:108: error: undefined reference to 'pthread_getspecific' /home/markus/gcc/libsanitizer/asan/asan_posix.cc:113: error: undefined reference to 'pthread_setspecific' /home/markus/gcc/libsanitizer/interception/interception_linux.cc:22: error: undefined reference to 'dlsym' collect2: error: ld returned 1 exit status