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

basic error when making with gcc

cstork9
Beginner
405 Views
I get the following error for all TBB versions when making with gcc 4.1.1 on RedHat 4.4 for x86-64:

gmake[1]: Entering directory `/opt/TBB/tbb20_014oss_src/build/linux_em64t_gcc_cc4.1.1_libc2.3.4_kernel2.6.9_release'
../../build/Makefile.tbb:38: CONFIG: cfg=release arch=em64t compiler=gcc os=linux runtime=cc4.1.1_libc2.3.4_kernel2.6.9
sh ../../build/generate_tbbvars.sh
g++ concurrent_hash_map.o concurrent_queue.o concurrent_vector.o itt_notify.o cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o spin_rw_mutex.o spin_mutex.o task.o tbb_misc.o mutex.o -lpthread -lrt -ldl -fPIC -o libtbb.so -shared -m64
/opt/amd/gnutools-4.1.1/bin/ld: /opt/amd/gnutools-4.1.1/lib/gcc/x86_64-redhat-linux/4.1.1-amd-rhel4/libstdc++.a(stdexcept.o): relocation R_X86_64_32S against `vtable for std::logic_error' can not be used when making a shared object; recompile with -fPIC
/opt/amd/gnutools-4.1.1/lib/gcc/x86_64-redhat-linux/4.1.1-amd-rhel4/libstdc++.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
gmake[1]: *** [libtbb.so] Error 1

A web search for "TBB -fPIC" or "TBB R_X86_64_32S" produces no hits.

I'm sure this is simple, dumb problem, but it's got me stumped.

Thanks.

0 Kudos
2 Replies
Alexey-Kukanov
Employee
405 Views

/opt/amd/gnutools-4.1.1/bin/ld: /opt/amd/gnutools-4.1.1/lib/gcc/x86_64-redhat-linux/4.1.1-amd-rhel4/libstdc++.a(stdexcept.o): relocation R_X86_64_32S against `vtable for std::logic_error' can not be used when making a shared object; recompile with -fPIC
/opt/amd/gnutools-4.1.1/lib/gcc/x86_64-redhat-linux/4.1.1-amd-rhel4/libstdc++.a: could not read symbols: Bad value

Judging from the above, I think that your GCC compiler is not configured to use shared libraries by default, so it takes a static version of libstdc++, which is not suitable to produce shared objects. As far as I know, Red Hat 4.4 has an older compiler version than 4.1.1, so I assume it was upgraded later, and might be misconfigured that time.

I looked in GCC online docs but did not find an option to forcefully use shared libraries (though the opposite option, -static, is present). So it's unclear if we could force using shared libraries with TBB and eliminate dependency on a particular compiler configuration.

0 Kudos
TimP
Honored Contributor III
405 Views
As Alexei said, RH 4.4 doesn't support gcc 4.x. In addition, ld is separate from gcc. It's certainly common to require a better ld than what comes with RH 4.4, but it's generally done at your risk. You give us no clue where yours came from, or whether it's a standard configuration. A standard ld would use .so libraries by default if those are present, so the presumption is that required .so libraries aren't present on the paths set in your g++ installation (g++ -print-search-dirs)
If you file an issue with Intel support, you should at least give the result of ld --version, in addition to the standard requested information. However, with so much non-standard about your configuration, it could be difficult to pin down.
0 Kudos
Reply