Issue 1:
System information (version)

OpenCV => 3.4.2

Operating System / Platform => Ubuntu 16.04

Compiler => CMAKE

Detailed description

Hello I tried to reinstalling my opencv with TBB support, but when I tried to install it, there is error in the video_stab when I tried to run -make j8 in the command. The reason why I re install because I need TBB support in my code. Is there anyone has same problem with me and solved this problem? Thank you

Steps to reproduce

cmake -D CMAKE_BUILD_TYPE=RELEASE

-D CMAKE_INSTALL_PREFIX=/usr/local

-D INSTALL_PYTHON_EXAMPLES=ON

-D INSTALL_C_EXAMPLES=OFF

-D WITH_CUDA=ON

-D ENABLE_FAST_MATH=1

-D CUDA_FAST_MATH=1

-D WITH_CUBLAS=1

-D OPENCV_EXTRA_MODULES_PATH="/home/ee401_2/opencv_install/opencv_contrib-3.4.2/modules"

-D BUILD_EXAMPLES=ON

-D WITH_TBB=ON

-D BUILD_opencv_xfeatures2d=ON ..

make -j8

Error

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_generalized_hough.dir/generalized_hough.cpp.o

[ 89%] Built target opencv_perf_superres

[ 89%] Linking CXX executable ../../bin/example_gpu_hog

Scanning dependencies of target example_gpu_cascadeclassifier

[ 89%] Built target example_gpu_stereo_match

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_cascadeclassifier.dir/cascadeclassifier.cpp.o

Scanning dependencies of target example_gpu_super_resolution

[ 89%] Built target opencv_test_superres

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_super_resolution.dir/super_resolution.cpp.o

Scanning dependencies of target example_gpu_multi

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_multi.dir/multi.cpp.o

[ 89%] Linking CXX executable ../../bin/example_gpu_opticalflow_nvidia_api

[ 89%] Linking CXX executable ../../bin/example_gpu_generalized_hough

[ 89%] Built target example_gpu_hog

[ 89%] Linking CXX executable ../../bin/example_gpu_stereo_multi

Scanning dependencies of target example_gpu_video_writer

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_video_writer.dir/video_writer.cpp.o

[ 89%] Built target example_gpu_opticalflow_nvidia_api

Scanning dependencies of target example_gpu_morphology

[ 89%] Linking CXX executable ../../bin/example_gpu_video_writer

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_morphology.dir/morphology.cpp.o

[ 89%] Linking CXX executable ../../bin/example_gpu_super_resolution

[ 89%] Built target example_gpu_generalized_hough

Scanning dependencies of target example_gpu_bgfg_segm

[ 89%] Built target example_gpu_stereo_multi

[ 89%] Built target example_gpu_video_writer

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_bgfg_segm.dir/bgfg_segm.cpp.o

Scanning dependencies of target example_gpu_pyrlk_optical_flow

[ 89%] Linking CXX executable ../../bin/example_gpu_multi

[ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_pyrlk_optical_flow.dir/pyrlk_optical_flow.cpp.o

/usr/bin/ld: CMakeFiles/example_gpu_multi.dir/multi.cpp.o: undefined reference to symbol '_ZN3tbb18task_group_contextD1Ev'

//usr/lib/x86_64-linux-gnu/libtbb.so.2: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

samples/gpu/CMakeFiles/example_gpu_multi.dir/build.make:122: recipe for target 'bin/example_gpu_multi' failed

make[2]: *** [bin/example_gpu_multi] Error 1

CMakeFiles/Makefile2:48496: recipe for target 'samples/gpu/CMakeFiles/example_gpu_multi.dir/all' failed

make[1]: *** [samples/gpu/CMakeFiles/example_gpu_multi.dir/all] Error 2

make[1]: *** Waiting for unfinished jobs....

[ 89%] Linking CXX executable ../../bin/example_gpu_cascadeclassifier

[ 89%] Built target example_gpu_super_resolution

[ 89%] Linking CXX executable ../../bin/example_gpu_morphology

[ 89%] Built target example_gpu_cascadeclassifier

[ 89%] Linking CXX executable ../../bin/example_gpu_bgfg_segm

[ 89%] Built target example_gpu_morphology

[ 89%] Linking CXX executable ../../bin/example_gpu_pyrlk_optical_flow

[ 89%] Built target example_gpu_bgfg_segm

[ 89%] Built target example_gpu_pyrlk_optical_flow

Scanning dependencies of target opencv_videostab

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/deblurring.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/frame_source.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/fast_marching.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/global_motion.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/wobble_suppression.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/motion_stabilizing.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/outlier_rejection.cpp.o

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/optical_flow.cpp.o

cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch] cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch]

cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch] cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch]

cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch] cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch]

cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch] cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch]

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/stabilizer.cpp.o

cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch] [ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/log.cpp.o cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch]

[ 89%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/inpainting.cpp.o

cc1plus: warning: /home/ee401_2/opencv_install/opencv-3.4.2/build2/modules/videostab/precomp.hpp.gch/opencv_videostab_RELEASE.gch: not used because `OPENCV_TRAITS_ENABLE_DEPRECATED' is defined [-Winvalid-pch]

[ 89%] Linking CXX shared library ../../lib/libopencv_videostab.so

[ 89%] Built target opencv_videostab

Makefile:160: recipe for target 'all' failed

make: *** [all] Error 2

Issue 2:
System information (version)

OpenCV => 3.4

Operating System / Platform => Linux Ubuntu 16.04 64 bit

Compiler => GCC version 5.4.0

Detailed description

While installing OpenCV 3.4 (using GCC 5.4.0, cuda 8, nvidia driver 378.1), the make command fails fails with the following errors:

[ 87%] Linking CXX executable ../../bin/example_gpu_multi

/usr/bin/ld: CMakeFiles/example_gpu_multi.dir/multi.cpp.o: undefined reference to symbol '_ZN3tbb18task_group_contextD1Ev'

//usr/lib/x86_64-linux-gnu/libtbb.so.2: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

samples/gpu/CMakeFiles/example_gpu_multi.dir/build.make:124: recipe for target 'bin/example_gpu_multi' failed

make[2]: *** [bin/example_gpu_multi] Error 1

CMakeFiles/Makefile2:48855: recipe for target 'samples/gpu/CMakeFiles/example_gpu_multi.dir/all' failed

make[1]: *** [samples/gpu/CMakeFiles/example_gpu_multi.dir/all] Error 2

make[1]: *** Waiting for unfinished jobs....

[ 87%] Linking CXX executable ../../bin/opencv_perf_superres

I am using cuda8 because that is what is required for the application I am installing

Steps to reproduce

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

cd ~/<my_working_directory>
sudo apt-get update
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

cd ~/opencv
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=$HOME/opencv_contrib/modules -D BUILD_EXAMPLES=ON -D BUILD_opencv_python2=OFF -D WITH_FFMPEG=1 -D WITH_CUDA=1 -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_IPP=ON -D PYTHON3_EXECUTABLE=/home/taylor/anaconda3/bin/python -D PYTHON3_INCLUDE_PATH=/home/taylor/anaconda3/include/python3.6m -D PYTHON3_LIBRARY=/home/taylor/anaconda3/lib/python3.6/site-packages -D CMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs ..

make -j8 -l8