https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87457

--- Comment #2 from SebastiansPublicAddress at googlemail dot com ---
(In reply to Jonathan Wakely from comment #1)
> I think the problem is that the std::thread code in libstdc++.so isn't built
> with ThreadSanitizer.

Wasn't easy to build libstdc++ with different flags (*), but now I think I did
it, and I still get the errors. So I think this was not the cause.

I'm quite sure that now I'm using a libstdc++ that's built with
-fsanitize=thread because:
- I added a printf to thread::join() and I see it when I reproduce the failure.
- I see -fsanitize=thread in the output of "make" when I build libstdc++.


(*) here's how I built libstdc++:
- Build the whole gcc-8 debian source package
  $ sudo apt-get build-dep gcc-8
  $ sudo apt-get source gcc-8
  gcc-8-8.2.0$ debuild -b -uc -us
- backup and remove gcc-8-8.2.0/build/x86_64-linux-gnu/libstdc++-v3
- configure with the same commandline as in the backup
  gcc-8-8.2.0/build/x86_64-linux-gnu/libstdc++-v3/config.log
  (fix quoting of --program-transform-name=s&$&-8&;s&^&x86_64-linux-gnu-&)
  but with prefix /usr/local/tsan
- set a few environment variables as suggested by the error messages
  repeat until build is sucessful
- add --enable-cxx-flags=-fsanitize=thread
- make, make install
- export LD_LIBRARY_PATH=/usr/local/tsan/lib
- build my test program with -L/usr/local/tsan/lib -I/usr/local/tsan/include
- export LD_LIBRARY_PATH=/usr/local/tsan/lib

Reply via email to