Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

std::shared_future on Raspberry Pi toolchain

I'm trying to cross-compile a large project for the Raspberry Pi. I'm using a toolchain built by crosstool-ng, gcc version 4.7.3. The compilation chokes when it sees std::shared_future. I get this error:

test.cpp:5:27: error: aggregate 'std::shared_future<int> xxx' has incomplete type and cannot be defined

And here's the source file that generates that error:

#include <future>

int main()
{
  std::shared_future<int> xxx;
  return 0;
}

This same source file compiles successfully on the Rapsberry Pi itself. Is this a bug in the crosstool toolchain? Is there a workaround? How can I get this to successfully compile?

like image 555
sagargp Avatar asked Apr 21 '13 17:04

sagargp


1 Answers

To have shared_future implementation class and not just the forward declaration, you must have the following preprocessor condition equal to true : #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) && (ATOMIC_INT_LOCK_FREE > 1)

According to your previous answer to @juanchopanza, it seems that you have the following part of the condition equal to true : if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) because it's necarry to have the implementation of thread class.

Finaly, we could say that this part of the condition is false ATOMIC_INT_LOCK_FREE > 1.

like image 72
backlash Avatar answered Sep 23 '22 08:09

backlash