Guys, I've build tbb with gcc 4.6.1 and when I'm trying to compile project in Qt where I've included tbb.h and parallel_for I'm getting following errors:
c:\\mingw32\\bin\\..\\lib\\gcc\\mingw32\\4.6.1\\include\\c++\\ext\\atomicity.h:48: error: undefined reference to `__sync_fetch_and_add_4'
Does anyone knows what to do about it?
I'm using gcc 4.6.1.
I #define'edTBB_USE_GCC_BUILTINS 0 but I'm still getting those errors. And this is so frustrating because I've already had this working. Unfortunately I've reinstalled Windows and since then I cannot compile it. Previously (in the old Windows installation) I've had the same problem but then I remember I've defined in c++config.h this
and it went through. (without this I was getting error c:\...\include\tbb\tbb_exception.h:340: error: 'exception_ptr' in namespace 'std' does not name a type)
But now it seems to be stack on this not defined reference to sync_fetch_and_add_4 and it seems that there is no way to overcome it.
P.S. The Windows system is same, the qt is same there are just reinstalled.
Also, I've env vars set to:
INCLUDE = C:\Downloads\libraries\tbb40_297oss\include\tbb
LIB = C:\Downloads\libraries\tbb40_297oss\build\windows_ia32_gcc_mingw_debug
adding CXXFLAGS="-march=i686" to the make command most likely will help.
make compiler=gcc CXXFLAGS="-march=i686"
PS: asking at TBB devoted forum (http://software.intel.com/en-us/forums/intel-threading-building-blocks/) will most likely increase chances of getting help :)
Thank you for your reply. I'm affraid that it didn't help unfortunately.
At the end I fixed that but:
this was terrible (3 days, 2 full system reinstallations, numberous reinstallations of boost (I had to because I'm using it in my project), numerous different reinstallation of tbb (with different options)), in the end I had to:
a) add in ORIGINAL header from tbb (tbb_exception)#include
b) in exception_ptr.h had to #define _GLIBCXX_ATOMIC_BUILTINS_4
and this fortunately works.
Thank you and all people who tried to help me.
Thank you and regards.