GCC 9.2.0 C++ and Threading Building Blocks

Pages: 12
I have installed GCC 9.2.0 C++ compiler on Windows 10 Laptop.
g++-9.2.0 command is working fine and compiling C++ programs from cygwin64 terminal window.

Then I have downloaded Threading Building Blocks (TBB).

How to install TBB from Cygwin64 terminal window please?



Last edited on
This should be simple. Since it seems to be template only you just need to set the include path. See the tutorial:

https://software.intel.com/en-us/tbb-tutorial
https://software.intel.com/en-us/node/505529
If you want convenience, just install VS and enjoy the pre-built binaries.

Otherwise you need to compile the code from source, and it will "maybe" work, some forum post says someone patched it to work, but on the list of supported compilers, mingw and cygwin is not included.
Thank you coder777 for the excellent links.
However, I did not see information about installing the TBB in the above links from cygwin64 terminal.

From the Google search, I found following information

git clone https://github.com/wjakob/tbb.git (I got my TBB from different github link)
cd tbb/build
cmake ..
make -j
sudo make install

at the bottom of the following link:

https://stackoverflow.com/questions/10726537/how-to-install-tbb-from-source-on-linux-and-make-it-work

However, when I typed cmake ..
I am getting following error:

bash: cmake: command not found.

I need information about how to have cmake from cygwin64 terminal please?
Thanks

Last edited on
I have installed cmake from
https://cmake.org/install/

And when I ran cmake command, it is giving following error:

tbb-tbb_2019 does not appear to contain CMakeLists.txt
When I ran make command from src folder, it is giving following error:


cd ~/tbb-tbb_2019/src
$ make
'\"cscript /nologo /E:jscript ../build/detect.js  /arch \""' is not recognized as an internal or external command,
operable program or batch file.
'\"cscript /nologo /E:jscript ../build/detect.js  /runtime \""' is not recognized as an internal or external command,
operable program or batch file.
../build/common.inc:81: *** Architecture not detected.  Stop.

$


Any suggestions for fixing TBB installation errors please?
Last edited on

Per poteto: If you want convenience, just install VS and enjoy the pre-built binaries.


Visual Studio 2019 do not have latest C++ features as in GCC 9.2.0.
And GCC 9.2.0 is free to download. I bought Visual Studio 2019 for $500 and using C++17 features.

The tbb-tbb_2019 folder that I have downloaded has vs2013 folder that has .sln file.

I have completed TBB installation VS2019.
Compiled and built a simple Hello TBB from the following Book:
Pro TBB by three authors Michael Voss et. al. from Apress. 2019 Edition.

Getting Link errors upon running the program from Visual Studio IDE.








Last edited on
If you really insist, there is a thing called clang-cl which gives the best of both worlds, but it is a pain to set up, not recommended unless you really don't want anyone to compile your code.

Overall you need to learn how to read documentation, Coder777 gave a very specific explanation on how to setup TBB for msvc.

You probably just forgot to link either tbb_debug.lib or tbb.lib since you have linking errors. Otherwise you need to put more info into your problems.
@AlexCantor, you BOUGHT VS 2019?!?

It's free with the Community edition.

Are you are making money using VS 2019, making over US$1 million? Or using it on over 250 PCs? If not, then you threw away money.

Visual Studio 2019 do not have latest C++ features as in GCC 9.2.0.

C++17, it does.
https://en.cppreference.com/w/cpp/compiler_support#cpp17

If you are talking about C++2a features then no one really does it all. The standard hasn't been released yet.
Sorry poteto, Fury Guy and all, I was out of town and delay in posting to this forum.
I read the links by coder777. However, in the Prepare the Environment, I was confused by the following sentence:

"After successfully installing IntelĀ® Threading Building Blocks (IntelĀ® TBB) on your system, you need to do the following:
Register the environment variables to locate the necessary library and include files."

I did not find installing TBB instructions or install.txt file.

I compiled but, there were many choices, Win32, Debug, x64, release etc while compiling TBB library. Some choices got mixed up and compiled successfully but the Hello TBB program was giving link error.

Now I built x86 & x64 tbb.dll and tbb_debug.dll

Now I am having difficulty in installing these dll files by running regsvr32.exe commands on Windows 10 laptop.

I did compile the following program using VS2019 from above Apress Pro TBB book, but is not running because the two tbb dll s are not installed correctly:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <tbb/tbb.h>

int main() { 

  tbb::parallel_invoke(
    []() { std::cout << " Hello " << std::endl; },
    []() { std::cout << " TBB! " << std::endl; }
  );

  return 0;
}


Thanks again


Last edited on
Hello Furry Guy,

I used VS2015 and VS2017 community editions. But there were some restrictions such as it was saving my C++ programs only to cloud and it did not allow me to build static build, so I can't take exe file to my work computer where I was not allowed to install the community edition.

So I bought VS2017 and recently VS2019.

At present I am primarily interested in developing scientific and engineering, genetics genome sequence analysis applications by writing parallel C++ programs using ranges features of C++ 2a using functional programming techniques to reduce code lines of the C++ programs.

Some one recently wrote in this forum, "Visual Studio C++ 2a features implementation are about four years behind the GCC g++ compiler.

Based on past years releases of GCC G++, following link shows approximate development cycle of GCC g++ compiler:

https://www.gnu.org/software/gcc/develop.html

So I am hoping by mid next year <ranges> include file may be available in g++ CPP.

At present I am using GCC g++ 9.1.0 and C++ range-v3 of Eric Niebler.

I am not sure when <ranges> include file will be available in VS? in VS20 or VS21 or VS22?

Thanks again,







@AlexCantor, is range-v3 causing you problems?
You seriously need to help yourself by reading the official setup instructions that coder777 has given the links for. If you really don't know where the DLL's are I will give you a hint, it is quite common for dll's to be put in a folder called /bin (in other cases in a heavy VS style it uses "x64" or "Release" but this library is cross platform so it makes sense to use the gcc /bin style), the intel install instructions gives you a list of directories on that page.

edit: dll's are the easiest part of linking a library, but you still don't give me the information about whether you installed tbb2019_20190605oss_win and you should also tell us if you are using x86 or x64.

also you have misread me I said:
link either tbb_debug.lib or tbb.lib

not both.

Also you built TBB? So I assume you installed VS 2013's compiler and built it from the 2013 sln file from the source code of TBB? Hopefully you didn't do that, and the only reason I think you did this is because I think the only way to compile the code with vs2015 is by cmake, which is a gigantic hurdle (or you just typo'd that you built the library).

What you should've done is just install the win binary release, the one I downloaded to check is called tbb2019_20190605oss_win.zip from github's tbb repo, it has version 14, which is compiled by VS2015(14.0) (I think) but also works for VS2017(14.1) and VS2019(14.2), but not VS2013 (take this with a grain of salt, I haven't tested this, but I am pretty sure I am right).

You can try ranges out with VS, you should've googled this, you would use them by either <ranges> or <experimental/ranges>, haven't tested it, but should be about as good as GCC's version (you can even go to the ranges-v3 github page and compile it yourself with cmake or whatever).

https://devblogs.microsoft.com/cppblog/use-the-official-range-v3-with-msvc-2017-version-15-9/
Last edited on
poteto, thank you for replies. I am sorry for the misunderstanding.
I do not know how to install/register DLLs on Windows 10 computer.

I did read the or part of your "either tbb_debug.lib or tbb.lib".

I did not compile the Hello TBB program from command line and I did not use both debug and release versions of tbb lib on same command line.

I have compiled it from VS2019 (version 16.1.3) GUI IDE, and I have created debug and release configurations. When I select debug configuration it uses tbb_debug.lib and when I select release configuration from IDE GUI, it uses tbb.lib.

Thus I have created two exe files of hello TBB program, one debug version and another release version. These exe files are not static builds and do not include TBB DDLs.

I am not able to run these hello TBB executable files, because Windows 10 do not know where these TBB dll files are? Windows registry needs to know about these two DLLs?

I need to install/register these TBB dlls on Windows 10 laptop (correct?)
How to install/register these two TBB dlls? By running regsvr32.exe from system32 folder and/or SysWoW64 folder? regsvr32.exe is not installing/registering these two DDLs correctly.

I have two Windows 10 laptop computers. One with VS2019 installatioin and another with GCC g++ installation. For now I am focusing on VS2019 TBB laptop to work correctly, please.

Thank you very much for your help.




Windows registry needs to know about these two DLLs?
No, it suffice when you put the *.dlls in that directory where the *.exe is.
Thank you very much coder777.
I copied these DDLs to the exe folder and it is saying "The application was unable to start correctly.".

If I put TBB DDLs in exe folder, then do I have to copy these two TBB DLLs in each exe file folder for each TBB C++ program I code?

Thanks
Copy only the needed dll.


You may use dependency walker to determine which dll is needed (and/or missing):

http://dependencywalker.com/
@coder777,

Did you know there is a rewrite of dependency walker? Dependencies.

https://github.com/lucasg/Dependencies

Available in x64 and x86 versions.
@Furry Guy

Thanks, I didn't know it.
Last edited on
@coder777,

I didn't think you knew about it, I found it by accident looking for something else.

The rewrite finds quite a number of dependent Win 10 DLLs the older program never did.
Pages: 12