This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using thread sanitizer


I am attempting to use -fsanitize=thread but am getting an error one
of a two ways:

Way 1: g++ dummy.cpp -g -fsanitize=thread -pthread -shared -fPIC

This compiles just fine, and claims it links fine, but in reality, it
just sits at 0 and then segfaults at start (options determined by
following error messages)

Way 2: g++ dummy.cpp -g -fsanitize=thread -pthread -pie -fPIC
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../lib64/libasan_preinit.o:(.preinit_array+0x0):
undefined reference to `__asan_init_v1'
collect2: error: ld returned 1 exit status

The program compiles just fine with g++ dummpy.cpp

Is this problem related to the fact that gcc seems to think that it is
running on "unknown linux" as opposed to "linux-gnu"? If so, how can I
fix that issue (setting --target=x86_64-linux-gnu configurers just
fine but fails to build, even after make distclean)?

uname returns:
daniel@daniel-Virtual-Machine:~$ uname -a
Linux daniel-Virtual-Machine 3.2.0-38-generic #61-Ubuntu SMP Tue Feb
19 12:18:21 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

gcc --v:
daniel@daniel-Virtual-Machine:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../SomeLocalDir/configure --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20130305 (experimental) (GCC)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]