I am trying to obtain opencv on my raspberry pi 3B. I noticed there is no official guide for this so I am following the linux guide on the opencv website.
and as many others have encountered, libtbb is unavailable. I read from this stack exchange thread that it is unnecessary but beneficial for my multi core chip, so I still want it.
I followed the step:
# Download and unpack
wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb43_20150611oss_src.tgz
tar xvf tbb43_20150611oss_src.tgz
cd tbb43_20150611oss
# Make flags from https://software.intel.com/en-us/forums/topic/500680
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"
# Export the required environment variables
cd ~/tbb43_20150611oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release
source tbbvars.sh
Downloading and building was smooth, however somehow stuck at the last step.
I understand it being a bash script that generates certain environmental variable necessary for compilation of opencv. However it doesn't seem to take effect, situation goes as this.
I examined the script, it looks like this:
#!/bin/bash
export TBBROOT="/home/mytbbroot" #
tbb_bin="/home/mytbbroot/build/linux_armv7_gcc_cc4.9.2_libc2.19_kernel14.9.35_release"
if [ -z "$CPATH" ]; then #
export CPATH="${TBBROOT}/include" #
else #
export CPATH="${TBBROOT}/include:$CPATH" #
fi #
if [ -z "$LIBRARY_PATH" ]; then #
export LIBRARY_PATH="${tbb_bin}" #
else #
export LIBRARY_PATH="${tbb_bin}:$LIBRARY_PATH" #
fi #
if [ -z "$LD_LIBRARY_PATH" ]; then #
export LD_LIBRARY_PATH="${tbb_bin}" #
else #
export LD_LIBRARY_PATH="${tbb_bin}:$LD_LIBRARY_PATH" #
fi #
#
I figured that it would at least add the env var TBBROOT=/home/mytbbroot/
, however even I have set the script to chmod 755, and run it directly from its current directory, when I examine env, using either env
or env | grep TBB
, the TBBROOT does not show. I have tried running the script by both bash and sh but both yield no env.
Strangely, if I run the command directly export TBBROOT=/home/mytbbroot/
, then it actually adds the env var, I verified that multiple times.
So my question(s)
- was there something about the script that was not correct?
- is there anyway to ask bash or sh to be verbose and tell me whats wrong in the script? or
- On top of that, which ,bashrc script should I ask the pi to put the execution in? Pi, User or root? I am using realvnc server, xserver-xorg, both Pi and user is in sudo group.
UPDATE:
My bad, misread the thread, the script has to be ran by source, not sh.
putting source /root/tbbvars/
into .bashrc generated correct environment, question can be closed now.