Crash when linking statically with tbb on OS X

Crash when linking statically with tbb on OS X

When I build and link to a static version of libtbb on OS X using gcc, my program crashes when constructing tbb::task_scheduler_init.

Here's the details of my environment:

$ uname -a
Darwin Ryans-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
$ g++-7 --version
g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

It builds from

I attached the coredump, executable, and source code. To build and run the executable on OSX with homebrew, run

brew install gcc
brew install bazel
cd tbb-crash
BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 bazel build -s --action_env CC=$PWD/g++-wrapper //...

Also, backtrace from core

(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


Descargarapplication/octet-stream core.63682.bz2213.65 MB
Descargarapplication/octet-stream fib.bz2933 KB
Descargarapplication/octet-stream tbb-crash.tar.bz216.19 KB
publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Any updates on this? Was there anything else needed to debug?

The program is pretty minimal

#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;

It works if you don't link in protobuf, but there definitely seems to be an issue otherwise. Could you please advise what the problem is? I don't believe I'm doing anything wrong here.

Coping GitHub duplicated issue thread:

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya