How to install shared library and include files manually in linux?

964 Views Asked by At

I am trying to build and install TBB library from source so that it can be used for OpenCV to take advantages of multiple cores on my raspberry pi.

I was able to build TBB from source without any problems using this steps. (Source : How do I build OpenCV with TBB on Raspberry Pi?)

wget -O ~/tbb43_20150316oss_src.tgz --no-check-certificate https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb43_20150316oss_src.tgz tar -xvzf tbb43_20150316oss_src.tgz cd tbb43_20150316oss make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"

However, it's not getting detected while cmake step of building OpenCV.

Where do I add generated .so files and .h files to system paths so that cmake can detect it ?

Thanks.

3

There are 3 best solutions below

0
On BEST ANSWER

As a work around, I created tbb.pc file to /usr/lib/pkgconfig/.

Here is a sample of that file. https://github.com/openembedded/meta-oe/blob/master/meta-oe/recipes-support/tbb/tbb/tbb.pc

Change prefix, libdir and include dir path according to your own tbb path and you're good to go. Hope it helps.

1
On

Run 'make install' in the TBB source directory after running make it should install the files to the correct locations.

1
On

You can use the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH environment variables to help CMake find your custom-built TBB by prefixing your cmake command like so:

CMAKE_INCLUDE_PATH=~/tbb43_20150611oss/include/ \
  CMAKE_LIBRARY_PATH=~/tbb43_20150611oss/build/*_release/ \
  cmake -DWITH_TBB=ON -DCMAKE_BUILD_TYPE=RELEASE \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DBUILD_NEW_PYTHON_SUPPORT=ON \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_PYTHON_EXAMPLES=ON \
    -DBUILD_EXAMPLES=ON ..