Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2470 Discussions

Problem compiling the sample program with the tbb distribution

Mitchelle_Rasquinha
1,205 Views

I have just downloaded the src package and foolowed the getting strted tutorial but have the following error

g++ -O2 -DNDEBUG -o sub_string_finder sub_string_finder.cpp -ltbb
/usr/bin/ld: cannot find -ltbb
collect2: ld returned 1 exit status
make: *** [release] Error 1

I sourced the .sh file it created and am not sure what i am missing.

-Mitchelle.

0 Kudos
1 Solution
Alexey-Kukanov
Employee
1,205 Views
Please check that the release version of the library has been built in linux_ia32_gcc_cc4.2.3_libc2.7_kernel2.6.24_release (look there for libtbb.so.2 which is the actual binary and forlibtbb.so which is a linker script). Also it seems you should source the tbbvars.sh from the above release directory to use the release version of TBB needed to build the example with 'make all'.

View solution in original post

0 Kudos
6 Replies
TimP
Honored Contributor III
1,205 Views
Quoting - mrasquinha

I have just downloaded the src package and foolowed the getting strted tutorial but have the following error

g++ -O2 -DNDEBUG -o sub_string_finder sub_string_finder.cpp -ltbb
/usr/bin/ld: cannot find -ltbb
collect2: ld returned 1 exit status
make: *** [release] Error 1

I sourced the .sh file it created and am not sure what i am missing.

-Mitchelle.

The question might be dealt with more rapidly on the TBB forum. If you have downloaded source only, you would need to build that library before you could link against it.

0 Kudos
Alexey-Kukanov
Employee
1,205 Views
Mitchelle,
could you describe step by stepwhat you did since unpackaging the TBB source tarball? Howyou built TBB, what .sh file you sourced, how you built the example, etc.

0 Kudos
Mitchelle_Rasquinha
1,205 Views
Mitchelle,
could you describe step by stepwhat you did since unpackaging the TBB source tarball? Howyou built TBB, what .sh file you sourced, how you built the example, etc.

I downloaded the source package "tbb21_20080605oss_src.tgz"

Extracted it set tbb_root and ran a "make all" on the top level directory. I then sourced the "tbbvars.sh" shell script within linux_ia32_gcc_cc4.2.3_libc2.7_kernel2.6.24_debug

I have also tried make a link to libtbb_debug.so.2.

The following is the error in trying to compile the example

/examples/GettingStarted/sub_string_finder> make all
g++ -O2 -DNDEBUG -o sub_string_finder sub_string_finder.cpp -ltbb
/usr/bin/ld: cannot find -ltbb
collect2: ld returned 1 exit status
make: *** [release] Error 1

My gcc version is gcc version 4.2.3 with ubuntu 8.04

0 Kudos
Alexey-Kukanov
Employee
1,206 Views
Please check that the release version of the library has been built in linux_ia32_gcc_cc4.2.3_libc2.7_kernel2.6.24_release (look there for libtbb.so.2 which is the actual binary and forlibtbb.so which is a linker script). Also it seems you should source the tbbvars.sh from the above release directory to use the release version of TBB needed to build the example with 'make all'.
0 Kudos
Mitchelle_Rasquinha
1,205 Views
Please check that the release version of the library has been built in linux_ia32_gcc_cc4.2.3_libc2.7_kernel2.6.24_release (look there for libtbb.so.2 which is the actual binary and forlibtbb.so which is a linker script). Also it seems you should source the tbbvars.sh from the above release directory to use the release version of TBB needed to build the example with 'make all'.

The tbbvars.sh from the release folder worked. Thanks!

0 Kudos
RafSchietekat
Valued Contributor III
1,205 Views

The tbbvars.sh from the release folder worked. Thanks!

To link with the debug version you would need to specify -ltbb_debug instead of -ltbb.

0 Kudos
Reply