언어 설정

Menu
Sites
Language
C++ std::thread completely broken

Even something as simple as

#include <thread>

int main()
{
  std::thread t([] () { return; });
  t.join();
}

compiled with Tizen Studio 1.1 just crashes... (but using C-style pthread_create works fine)

Responses

2 댓글
Shaswati Saha

At first, please make sure that you've followed the steps described in this link carefully. And also please try to run the application in real device instead of emulator. 

Mikhail Kremnyov

Hi,


I also stumbled over this problem recently, it's just been more random for me.


My system is Linux Mint 17.3 64-bit. The problem happens only on the emulator and only with std::thread (boost::thread works). Right now I use Tizen Studio 1.2 (CLI version), but it happened with older versions too.

 

Investigation shows that the problem is very similar to this old GCC issue - gcc.gnu.org/bugzilla/show_bug.cgi?id=42734
Long story short, with older versions of libstdc++ you can't mix object files built for the i386 architecture with ones built for a newer architecture; if you do, std::thread will crash (it happens because older implementations of std::thread use atomic builtins indirectly, which are not available on i386).

 

And indeed, verbose compiler output shows that Tizen Studio uses -march=i386 by default and passing (for example) -march=i686 instead solves the problem.

 

P.S. it appears that for the LLVM-based toolchain the value of the -march option is hardcoded in configuration files SDK_PATH/tools/smart-build-interface/plugins/llvm37.i386.core.* and the only way to override it is to edit the files.