[Libav-user] gcc tsan ffmpeg

Gonzalo Garramuño ggarra13 at gmail.com
Tue Jul 3 02:30:21 EEST 2018

El 02/07/18 a las 19:17, Carl Eugen Hoyos escribió:
> 2018-07-02 23:48 GMT+02:00, Gonzalo Garramuño <ggarra13 at gmail.com>:
>> I would like to compile a version of the libav* libraries with tsan
>> knowledge.  The configure script seems to have gcc-tsan as one toolchain
>> option.  However that does not work for me, failing the compilation
>> test.  My configure line is:
>> ./configure --enable-gpl \
>>           --toolchain=gcc-tsan \
> I suggest you start with only "--toolchain-gcc-tsan" to debug.
> Are you sure your default compiler supports tsan? I just
> tested with vanilla gcc-6.4 and it works as expected.
Yes, I am using it to debug other code.
>>           --enable-shared \
>>           --enable-pic \
> Why are you using this option?
> Is there a bug in FFmpeg we don't know about?
I have other code that is compiled with -fPIC and mixing them is not 
allowed afaik.  Also, I want to have a shared debugging ffmpeg as much 
as possible. I am currently running into what I believe are false 
positives of tsan, but cannot tell for sure if there is no info in the 
libav* libraries, so anything to get the line numbers and function names 
is good.
>>               --enable-runtime-cpudetect \
> You don't need this option.
Glad to know.
> The ffbuild/config.log reports at the end:
> test_ld cc
> test_cc
> BEGIN /tmp/ffconf.AKKqustf/test.c
>       1    int main(void){ return 0; }
> END /tmp/ffconf.AKKqustf/test.c
> gcc -fsanitize=thread -fPIE -fPIC -c -o /tmp/ffconf.AKKqustf/test.o
> /tmp/ffconf.AKKqustf/test.c
> gcc -fsanitize=thread -pie -fPIC -o /tmp/ffconf.AKKqustf/test
> /tmp/ffconf.AKKqustf/test.o
> FATAL: ThreadSanitizer: unexpected memory mapping
> 0x55ebd936b000-0x55ebd936c000
> C compiler test failed.
> You apparently found this bug:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67308
Yes, it is exactly that bug!  Removing -fPIE from the configure script 
solves it for me.  I have progressed further.
Thank you, Carl.

Gonzalo Garramuño

More information about the Libav-user mailing list