I don't know if you're still looking for the answer, but the choice of statically/dynamically linking is done through the linker you are using. If you are using the linker that comes with icl on Windows, for example, then instead of using the /MD switch use the /MT switch.
Whoa, hold on a sec. Is there a source distribution of the TBB library that can be rebuilt with /mt? The version I have built into the Intel C++ Pro compiler only seems to provide stub libs and DLLs - no source code or static libraries. I guess this also makes me wonder why there are vc7.1, vc8, and vc9 versions of the libraries. If these really are stub libs, they should be compiler independent right?
you can try open source version from http://www.threadingbuildingblocks.org/ver.php?fid=135
official page for commercial version is
Have you tried to use recently povided vs projects for tbb where you can building statically changing configuration type from .dll to .lib in general project option, project defaults? but as you correctly pointed there might be issues in runtime.
I'm trying to accomplish the same thing as OP and have been using the standard make files that come with tbb_oss. I haven't found the VS projects you are refering to but I have been able to modify the make scripts such that the compiler uses the /MT
To do this I changed all references to /MD to /MT (in windows.cl.inc)
#MS_CRT_KEY = /MD$(if $(findstring debug,$(cfg)),d)
MS_CRT_KEY = /MT$(if $(findstring debug,$(cfg)),d)
and I also commented out the following lines to do with manifest generation
#TBB.MANIFEST = tbbmanifest.exe.manifest
I'm trying to do it this way rather than by modifying my project to use dynamic linking because the output of my project is a dll which is then loaded by an application which is dynamically linked using the RELEASE versions of the CRT. By static linking my project I've been able to debug it even tho the host application is using release runtimes. When I followed the instructions of tbb to use dynamic linking I ended up with the host application loading msvc[prt]80.dll and my plugin trying to load msvc[prt]80d.dll which didn't seem to work AT ALL (understandably).
I guess I'd just like to ask if anyone has had any luck with this approach and what the impact to the scheduler is that the OP mentioned?
That's great, thanks for the link. What are the differences between the the commercial and open source versions? Is it support, or are there any functional differences?
The forum post is quite old, but still wanted to mention that now the Intel Compilers support static linking of libraries for creation of standalone binaries. One can use "-static-intel" flag to statically link libraries such as Intel TBB, this flag can be provided to icpc binary with other options. This will obviously make the binary larger in size. One can distribute this binary without the need of having the libtbb.so present at the destination system and eventually no need of LD_Config.
"-static-intel" does statically linked the tbb bindings in my case. When I removed the flag, I couldn't execute the binary on system having no tbb installed. With the flag, I can execute the binary on any system. Besides here is the excerpt from the man page of icpc.
-shared-intel Causes Intel-provided libraries to be linked in dynamically. Arguments: None Default: OFF Intel(R) libraries are linked in statically, with the exception of Intel's OpenMP* runtime support library, which is linked in dynamically. Description: This option causes Intel-provided libraries to be linked in dynamically. It is the opposite of -static-intel. If you specify option -mcmodel=medium or -mcmodel=large, it sets option -shared-intel.
It mentions specifically "-static-intel" is opposite of "-shared-intel".
Any comments on this?
You are looking at Intel Compiler options and compiler runtime. Intel TBB is not a part of compiler, it is a part of Intel Parallel Studio. AFAIR the only option recognized by compiler is "-tbb". You need to check your system. Many Linux distributions include TBB libraries. Run ldd on your executable to check how you link with tbb.