Q:

Undefined symbol error with -static-libasan

I use address sanitizer to sanitize  my application,  Which is linked with SOCI. But that prompt followijg error message while using with Oracle. 
./SociUT: symbol lookup error: /home/testhome/libs/libsoci_oracle.d.so.1.4.18: undefined symbol: __asan_unregister_globals

Here is the build output of aplication
/home/rel/GCC/asan-gcc-4.9.3/bc0232/bin/g++ -std=c++11  -g3 -static-libasan -fsanitize=address -fno-omit-frame-pointer  -L/home/mt_1/4/4.7.c/build/bc0397/tech/MB/link/API/63  -L/usr/lib64  -L/usr/lib64  -L/home/janaka077/mt-git/mt-database/mt_1/database_SOCI_Core/bin  -L/usr/local/boost_1_59_0/stage/lib  -L/usr/local/boost_1_59_0/stage/lib  -L/usr/local/gtest-1.7.0/lib/.libs   -o SociUT Main.o version.o  -lmb.d -lrdmacm -libverbs -lxml2 -lmsoci.d -lboost_date_time -lboost_filesystem -lboost_system -lboost_serializion -lboost_thread -lboost_chrono -lgtest -lz  -lnsl -lrt -ldl -lz -lcrypt -lnuma

A:

This is GCC PR 64234. At some point I may even get to fixing it)
Can you use dynamic runtime instead (i.e. remove -static-libasan)? Another option is adding -lsoci_oracle.d to LDFLAGS (this would inform GCC to export necessary symbols). Or you can add a really silly workaround i.e. force a reference to missing symbol from your code:
extern "C" void __asan_unregister_globals(void *globals, size_t n);
void *force_missing_symbol = (void *)__asan_unregister_globals;

(you'll need to do this for all missing symbols, prototypes can be obtained from this header).

