Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
We have moved to a new forum at http://jevois.usc.edu, please check it out. The forum at jevois.org/qa will not allow new user registrations but is maintained alive for its useful past questions and answers.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

Cannot build tiny-dnn on platform , missing tbb.h

0 votes

Trying to build for platform but tiny-dnn cannot build because it is missing tbb.h

/tiny-dnn/tiny_dnn/util/parallel_for.h

#ifdef CNN_USE_TBB
#ifndef NOMINMAX
#define NOMINMAX  // tbb includes windows.h in tbb/machine/windows_api.h
#endif
#include <tbb/task_group.h>
#include <tbb/tbb.h>

#endif

Looking at the source , it is not there either:

https://github.com/tiny-dnn/tiny-dnn/tree/master/tiny_dnn/util

asked Apr 14, 2019 in Programmer Questions by patrickpoirier (360 points)
edited Apr 14, 2019 by patrickpoirier

1 Answer

0 votes
Are you trying to build your own version, using the latest tiny-dnn code from GitHub?

tbb is installed on platform as part of OpenCV. There are indeed various issues with compiling this. But jevoisbase should provide the correct combination of libraries to make it compile. Have a look at CMakeLists.txt in jevoisbase, and you can take the section related to tiny-dnn and add it to your own module's CMakeLists.txt. You should also look at jevoisbase/Contrib/reinstall.sh which will pull a specific tiny-dnn version that works.

In the CMakeLists.txt of JeVois, we have:

# Use TBB and kernel includes for platform from the buildroot installation.  On the host, we may have local packages,
# eg, latest opencv compiled from source:
set(JEVOIS_KERNEL_INCLUDE "-I${JEVOIS_BUILDROOT_BASE}/build/linux-headers-3.4.113/usr/include")
set(JEVOIS_TBB_INCLUDE "-I${JEVOIS_BUILDROOT_BASE}/build/opencv3-${JEVOIS_OPENCV_VERSION}/buildroot-build/3rdparty/tbb/tbb-2018_U1/include")

and then TBB_INCLUDE gets integrated into JEVOIS_PLATFORM_INCLUDE which get pushed to modules via jevois_config.cmake.
answered Apr 16, 2019 by JeVois (46,580 points)
Hello,

It is compiling OK on HOST but cannot make on Platform.
We need to get from source in order to cross compile, but  the current https://github.com/tiny-dnn/tiny-dnn/tree/master/tiny_dnn/util   does not contain the tbb.h anymore.

Do you have a complete tiny_dnn with the missing  library somewhere on your servers ?  That would make thing much easier.

In the meantime , I removed it from the source, but I have to remove 2 modules that are using it , including JeVois Demo....
yes, if you want our version of tiny-dnn, see the reinstall.sh script mentioned above.

Also, JEVOIS_TBB_INCLUDE currently resolves to this:

/usr/share/jevois-sdk/out/sun8iw5p1/linux/common/buildroot/build/opencv3-4.0.1/buildroot-build/3rdparty/tbb/tbb-2018_U1/include/

this is where tbb/tbb.h is for platform.
OK it is fixed :-)
Thanks to your pointer I added this conditional include in  ~/jevoisbase/CMakeLists.txt

# tiny-dnn support:
include_directories(Contrib)
include_directories(Contrib/pthreadpool/include)
include_directories(Contrib/tiny-dnn)

if (JEVOIS_PLATFORM)
  include_directories(/usr/share/jevois-sdk/out/sun8iw5p1/linux/common/buildroot/build/opencv3-4.0.0/buildroot-build/3rdparty/tbb/tbb-2018_U1/include)
endif (JEVOIS_PLATFORM)

target_sources(jevoisbase PRIVATE Contrib/pthreadpool/src/threadpool-pthreads.c)

please note that i have opencv3-4.0.0 and I had to change info into ~/jevois/CMakeLists.txt as well:

# OpenCV version to use with JeVois:
set(JEVOIS_OPENCV_MAJOR 4)
set(JEVOIS_OPENCV_MINOR 0)
set(JEVOIS_OPENCV_PATCH 0)
...