Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
2452 Discussions

Using TDD with Cygwin, G++ and Eclipse CDT on windows



I dont use MSVC and want to use TBB with Eclipse CDT and cygwin/g++. I downloaded binary release and source, bb20_20070927oss_win and tbb20_20070927oss_srcrespectively.

In the Eclipse CDT, I configured "tbb20_20070927oss_srcinclude" as include directory

and added "tbb20_20070927oss_winia32vc7.1in" in library search path.

I also added libraries tbb_debug and tbbmalloc_debug.

So, g++ is invoked as follows

g++ -L"F:cygwinlib" -L"H: bb20_20070927oss_winia32vc7.1in" -o"TBB.exe" ./HelloTBB.o -ltbb_debug -ltbbmalloc_debug

But I get linking errors as follows

./HelloTBB.o: In function `_ZNK3tbb13blocked_rangeIjE12is_divisibleEv':

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZN3tbb19task_scheduler_initD1Ev[tbb::task_scheduler_init::~task_scheduler_init()]+0x15): undefined reference to `tbb::task_scheduler_init::terminate()'

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZN3tbb19task_scheduler_initC1Ei[tbb::task_scheduler_init::task_scheduler_init(int)]+0x28): undefined reference to `tbb::task_scheduler_init::initialize(int)'

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZdlPvRKN3tbb8internal19allocate_root_proxyE[operator delete(void*, tbb::internal::allocate_root_proxy const&)]+0xd): undefined reference to `tbb::internal::allocate_root_proxy::free(tbb::task&)'

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZnwjRKN3tbb8internal19allocate_root_proxyE[operator new(unsigned int, tbb::internal::allocate_root_proxy const&)]+0xd): undefined reference to `tbb::internal::allocate_root_proxy::allocate(unsigned int)'

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZdlPvRKN3tbb8internal20allocate_child_proxyE[operator delete(void*, tbb::internal::allocate_child_proxy const&)]+0x14): undefined reference to `tbb::internal::allocate_child_proxy::free(tbb::task&) const'

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZnwjRKN3tbb8internal20allocate_child_proxyE[operator new(unsigned int, tbb::internal::allocate_child_proxy const&)]+0x14): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned int) const'

H:/software/tbb20_20070927oss_src/include/tbb/blocked_range.h:(.text$_ZnwjRKN3tbb8internal27allocate_continuation_proxyE[operator new(unsigned int, tbb::internal::allocate_continuation_proxy const&)]+0x14): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const'

collect2: ld returned 1 exit status

Has anyone tried using TBB with Eclipse CDT and g++ on windows?



0 Kudos
6 Replies

You can not use with GCC the TBB binaries prepared for use with MSVC. The linkage problems you see happen due to different name decoration schemas used by these compilers. So you first need to build the TBB itself in your environment with GCC. Unfortunately, this environment is not directly supported so you will not be able to do that by just running a command or two; you will need to extend the TBB build scripts and makefiles to support such environment. So far, we (TBB maintainers at Intel) are not aware of anyone working on this task for Cygwin & GCC. Kevin Farnham is pursuing a similar task for UWIN, and he describes this experience in his TBB blog.


If its just a name decoration scheme, is there some way to just convert names while linking. I tried solution described here

But somehow its not working. I am probably missing something.

(BTW, I just realized I wrote TDD instead of TBB in the original post, Sorry for that)

Black Belt
mingw is not the same as cygwin. cygwin does include a mingw compiler, currently invoked by the additional option -mno-cygwin .
If its just a name decoration scheme, is there some way to just convert names while linking. I tried solution described here

But somehow its not working. I am probably missing something.

The solution you refer to does not work because, as far as I can judge, it only deals with name decoration for C-style symbols. These schemas are simple and quite compatible. The schemas for C++ names should include namespace names, class names, and method names, also should care about overloading (so parameter types should be encoded as well), so these vary much more. And this will probably continue unless the name mangling is standardized in the language.

Name decoration is done at compilation stage, not while linking. So if you somehow can tell the MinGW compiler to use MSVC name decoration schema, then linkage should go rather smoothly. But then, there could be many kinds of run-time errors, because mangling is just one part of Application Binary Interface (ABI) for C++ programs. Object layout in memory, calling conventions, exception handling are several others to be named.

The bottom line is that in C++ you really can not combine modules compiled by different compilers, unless the compilers use the same ABI. For example, Intel compilers are ABI-compatible with MSVC on Windows, and with GCC on Linux. I doubt this is possible for MinGW and MSVC.

For more information, I recommend you read calling_conventions.pdf from

I've run into similar trouble with something i'm trying to do. I am recompiling the open cv face detection code with tbb::parallel_for ( i get the following three errors )
--------->/home/sahil.malhotra/data/opencv-1.0.0/cv/src/.libs/ undefined reference to `tbb::internal::allocate_root_proxy::allocate(unsigned int)'
------------------->/home/sahil.malhotra/data/opencv-1.0.0/cv/src/.libs/ undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const'
------------------------>/home/sahil.malhotra/data/opencv-1.0.0/cv/src/.libs/ undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned int) const'
its possible that i'm missing out on some detail.
p.s. i compiled tbb on kernel on Suse using gmake and had to remove the -Werror flag while compiling.
any thoughts out there....?

Valued Contributor II
Hmmm. Well, allocate_root_proxy::allocate, allocate_continuation_proxy::allocate and allocate_child_proxy::allocate are all declared in task.hand all are defined in the library source, task.cpp. To first approximation, it looks like your cv build is finding the TBB header files but not Do you have a LD_LIBRARY_PATH or other configuration setting to allow the linker to find the lib? That's where I'd start looking.