I have the following linking command (sorry for it's length, but I tried to leave it as original as possible, except for shortening some paths):
CC
CMakeFiles/main.dir/main.cpp.o -o main -L/me/libs/cgal/lib -L/me/libs/tbb/tbb-2017_U7/build/linux_intel64_gcc_cc5.3.0_libc2.19_kernel3.12.61_release -rdynamic -lmpfr -lgmp /me/libs/cgal/lib/libCGAL_ImageIO.a /me/libs/cgal/lib/libCGAL.a -lboost_thread -lboost_system -lz /me/libs/cgal/lib/libCGAL_ImageIO.a /me/libs/cgal/lib/libCGAL.a -lboost_thread -lboost_system -lz -ltbb -ltbbmalloc -Wl,-rpath,/me/libs/cgal/lib:/me/libs/tbb/tbb-2017_U7/build/linux_intel64_gcc_cc5.3.0_libc2.19_kernel3.12.61_release
It will tell me:
/usr/bin/ld: cannot find -ltbb
/usr/bin/ld: cannot find -ltbbmalloc
Most probably relevant for the problem is that I have -L/me/libs/tbb/tbb-2017_U7/build/linux_intel64_gcc_cc5.3.0_libc2.19_kernel3.12.61_release
and -ltbb - ltbbmalloc
. In that -L
directory, there is a libtbb.so
and a libtbbmalloc.so
.
But why are those libraries not found by the linker, even though they clearly exist in a directory given by -L
?
EDIT1: I was asked to check with file
command. I get the following answers:
- The *.o file is
ELF 64-bit LSB relocatable, x86-64, version 1 (GNU/Linux), not stripped
- The libtbb.so.2 is
ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
Seems not exactly the same, but I have no idea whether it's compatible. Basically, I compiled it with the same compiler. But I'm not sure whether the build system of TBB might have sneaked in some other options.
EDIT2: I was also asked to use strace
. A short excerpt shows:
open("/me/libs/tbb/tbb-2017_U7/build/linux_intel64_CC_cc5.3.0_libc2.19_kernel3.12.61_release/libtbb.so", O_RDONLY) = 12
[pid 102330] open("/me/libs/tbb/tbb-2017_U7/build/linux_intel64_CC_cc5.3.0_libc2.19_kernel3.12.61_release/libtbb.so", O_RDONLY) = 11
[pid 102330] open("libtbb.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 102330] open("/me/libs/cgal/lib/libtbb.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 102330] open("/me/libs/tbb/tbb-2017_U7/build/linux_intel64_CC_cc5.3.0_libc2.19_kernel3.12.61_release/libtbb.so.2", O_RDONLY) = 11
It seems that it checks some files and then finally finds the one it is looking for.