We are about to start using TBB in a software package with high requirements for portability, and in preparation for this we are checking the OSS version on a bunch of different platforms and compilers.
I'll get back with patches for a few new combinations, but while testing I realized that the latest open source version fails one built-in test when using gcc on Ubuntu 14.04. When building with "make" followed by "make test", the test_tbb_version.exe test fails with a segmentation fault, both for the release and debug flavors.
Below is an output from gdb.
Starting program: /nethome/lindahl/tbb_gcc/tbb43_20140724oss/build/linux_intel64_gcc_cc4.8_libc2.19_kernel3.11.0_debug/test_tbb_version.exe
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Segmentation fault (core dumped)
Error (step 1): Internal test error
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff7b8c1c6 in __itt_fini_ittlib () at ../../src/tbb/tools_api/ittnotify_static.c:907
#2 0x00007ffff7bb1a53 in tbb::internal::__TBB_InitOnce::remove_ref () at ../../src/tbb/tbb_main.cpp:132
#3 0x00007ffff7bb1e13 in tbb::internal::__TBB_InitOnce::~__TBB_InitOnce (
this=0x7ffff7dd9642 <tbb::internal::__TBB_InitOnceHiddenInstance>, __in_chrg=<optimized out>) at ../../src/tbb/tbb_main.h:76
#4 0x00007ffff70ae4da in __cxa_finalize (d=0x7ffff7dd55c0) at cxa_finalize.c:56
#5 0x00007ffff7b7f193 in __do_global_dtors_aux ()
#6 0x00007fffffffde80 in ?? ()
#7 0x00007ffff7dea73a in _dl_fini () at dl-fini.c:252
Backtrace stopped: frame did not save the PC
Oh, thanks, that was fast!
My apologies in advance that I might be submitting a number of these bug reports the next week or two as we try things on various operating systems, so feel free to point us in ways where we can write some of the fixes too.
I got quite a few failing tests on my Mac with gcc-4.9 too, but since I'm running a prerelease version of Yosemite I need to test things on a vanilla machine before I send you those.
Thanks for an amazing library, by the way.
I decided to track down this bug, since it was the likely cause of failed regression tests on some other (new) platforms too.
The problem occurs in src/tbb/tools/api/ittnotify_static.c, around line 907 (in release 4.3). When the itt library is not present the handle will be NULL, which makes it illegal to call __itt_get_proc().
The fix is simple: Just check that _N_(_ittapi_global).lib is non-NULL before calling the function. If it is NULL, set __itt_api_fini_ptr to NULL instead. With this fix all unit tests pass with gcc-4.8 and gcc-4.9.