oneTBB: Crash when statically linking TBB 2018_U3 on OS X

Statically linking with gcc on OS X can cause TBB to segfault.

This simple program segfaults when TBB is built with GCC 7.3 and linked in statically.

#include <tbb/task_scheduler_init.h>
#include <iostream>
#include <cstdlib>
#include "a.pb.h"

using namespace tbb;

int main(int argc, char* argv[]) {
  A a;
  tbb::task_scheduler_init tbb_init{};
  std::cout << a.DebugString() << "\n";
  return 0;
}

Note: that it works if protobuf isn’t linked in.

I posted here and included the coredump, exectuable, and a bazel build that can reproduce the issue.

This is the backtrace from the crash:

(lldb) bt
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x000000010bc12dc9 fib`tbb::internal::governor::sign_off(tbb::internal::generic_scheduler*) + 41
    frame #1: 0x000000010bc17fb8 fib`tbb::internal::generic_scheduler::free_scheduler() + 152
    frame #2: 0x000000010bc18686 fib`tbb::internal::generic_scheduler::cleanup_master(bool) + 438
    frame #3: 0x000000010bc0ebb4 fib`tbb::task_scheduler_init::~task_scheduler_init() + 36
    frame #4: 0x000000010bc0ec5a fib`main + 151
    frame #5: 0x00007fff9f426235 libdyld.dylib`start + 1
    frame #6: 0x00007fff9f426235 libdyld.dylib`start + 1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16

Most upvoted comments

@rnburn, thanks for the information. Now I know what’s wrong: we do not specify -flifetime-dse=1 option in macos.gcc.inc. It will be fixed ASAP; meanwhile you can pass it with CXXFLAGS=“-flifetime-dse=1” specified in the make command line.