Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Crash when linking statically with tbb on OS X

rnickb
Beginner
712 Views

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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It builds from https://github.com/01org/tbb/archive/2018_U3.tar.gz.

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 //...
./bazel-bin/fib

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

 

0 Kudos
2 Replies
rnickb
Beginner
712 Views

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.

0 Kudos
Nikita_P_Intel
Employee
712 Views

Coping GitHub duplicated issue thread: https://github.com/01org/tbb/issues/59

0 Kudos
Reply