commaai / openpilot

openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system on 275+ supported cars.
https://comma.ai/openpilot
MIT License
50.08k stars 9.15k forks source link

webcam build with error #2100

Closed galenzhao closed 4 years ago

galenzhao commented 4 years ago

Describe the bug

galenzhao@ubuntu:~/openpilot$ scons use_webcam=1
scons: Reading SConscript files ...

scons: warning: Could not detect qt, using moc executable as a hint (QTDIR=/usr)
File "/home/galenzhao/openpilot/SConstruct", line 216, in <module>
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o selfdrive/camerad/main.o -c -std=c++14 -DWEBCAM -g -fPIC -O2 -Wunused -Werror -Wno-deprecated-register -Wno-inconsistent-missing-override -Iexternal/tensorflow/include -I. -Iselfdrive -Iphonelibs/bzip2 -Iphonelibs/libyuv/include -Iphonelibs/openmax/include -Iphonelibs/json11 -Iphonelibs/curl/include -Iphonelibs/libgralloc/include -Iphonelibs/android_frameworks_native/include -Iphonelibs/android_hardware_libhardware/include -Iphonelibs/android_system_core/include -Iphonelibs/linux/include -Iphonelibs/snpe/include -Iphonelibs/nanovg -Iselfdrive/common -Iselfdrive/camerad -Iselfdrive/camerad/include -Iselfdrive/loggerd/include -Iselfdrive/modeld -Iselfdrive/sensord -Iselfdrive/ui -Icereal/messaging -Icereal -Iopendbc/can -Iphonelibs/json11 -I/usr/local/include/opencv4 selfdrive/camerad/main.cc
clang++ -o selfdrive/camerad/imgproc/utils.o -c -std=c++14 -DWEBCAM -g -fPIC -O2 -Wunused -Werror -Wno-deprecated-register -Wno-inconsistent-missing-override -Iexternal/tensorflow/include -I. -Iselfdrive -Iphonelibs/bzip2 -Iphonelibs/libyuv/include -Iphonelibs/openmax/include -Iphonelibs/json11 -Iphonelibs/curl/include -Iphonelibs/libgralloc/include -Iphonelibs/android_frameworks_native/include -Iphonelibs/android_hardware_libhardware/include -Iphonelibs/android_system_core/include -Iphonelibs/linux/include -Iphonelibs/snpe/include -Iphonelibs/nanovg -Iselfdrive/common -Iselfdrive/camerad -Iselfdrive/camerad/include -Iselfdrive/loggerd/include -Iselfdrive/modeld -Iselfdrive/sensord -Iselfdrive/ui -Icereal/messaging -Icereal -Iopendbc/can -Iphonelibs/json11 -I/usr/local/include/opencv4 selfdrive/camerad/imgproc/utils.cc
clang++ -o selfdrive/camerad/cameras/camera_webcam.o -c -std=c++14 -DWEBCAM -g -fPIC -O2 -Wunused -Werror -Wno-deprecated-register -Wno-inconsistent-missing-override -Iexternal/tensorflow/include -I. -Iselfdrive -Iphonelibs/bzip2 -Iphonelibs/libyuv/include -Iphonelibs/openmax/include -Iphonelibs/json11 -Iphonelibs/curl/include -Iphonelibs/libgralloc/include -Iphonelibs/android_frameworks_native/include -Iphonelibs/android_hardware_libhardware/include -Iphonelibs/android_system_core/include -Iphonelibs/linux/include -Iphonelibs/snpe/include -Iphonelibs/nanovg -Iselfdrive/common -Iselfdrive/camerad -Iselfdrive/camerad/include -Iselfdrive/loggerd/include -Iselfdrive/modeld -Iselfdrive/sensord -Iselfdrive/ui -Icereal/messaging -Icereal -Iopendbc/can -Iphonelibs/json11 -I/usr/local/include/opencv4 selfdrive/camerad/cameras/camera_webcam.cc
In file included from selfdrive/camerad/cameras/camera_webcam.cc:13:
In file included from /usr/local/include/opencv4/opencv2/opencv.hpp:52:
In file included from /usr/local/include/opencv4/opencv2/core.hpp:54:
In file included from /usr/local/include/opencv4/opencv2/core/base.hpp:58:
In file included from /usr/local/include/opencv4/opencv2/core/cvstd.hpp:81:
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::PaniniPortraitWarper>, void, cv::detail::PaniniPortraitWarper
      *>::check<cv::DefaultDeleter<cv::detail::PaniniPortraitWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function 'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::FisheyeWarper>,
      void, cv::detail::FisheyeWarper *>::check<cv::DefaultDeleter<cv::detail::FisheyeWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::CompressedRectilinearWarper>, void, cv::detail::CompressedRectilinearWarper
      *>::check<cv::DefaultDeleter<cv::detail::CompressedRectilinearWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function 'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::MercatorWarper>,
      void, cv::detail::MercatorWarper *>::check<cv::DefaultDeleter<cv::detail::MercatorWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::SphericalWarper>, void, cv::detail::SphericalWarper
      *>::check<cv::DefaultDeleter<cv::detail::SphericalWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::CompressedRectilinearPortraitWarper>, void, cv::detail::CompressedRectilinearPortraitWarper
      *>::check<cv::DefaultDeleter<cv::detail::CompressedRectilinearPortraitWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::TransverseMercatorWarper>, void, cv::detail::TransverseMercatorWarper
      *>::check<cv::DefaultDeleter<cv::detail::TransverseMercatorWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::StereographicWarper>, void, cv::detail::StereographicWarper
      *>::check<cv::DefaultDeleter<cv::detail::StereographicWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function
      'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::CylindricalWarper>, void, cv::detail::CylindricalWarper
      *>::check<cv::DefaultDeleter<cv::detail::CylindricalWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function 'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::PaniniWarper>,
      void, cv::detail::PaniniWarper *>::check<cv::DefaultDeleter<cv::detail::PaniniWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function 'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::PlaneWarper>,
      void, cv::detail::PlaneWarper *>::check<cv::DefaultDeleter<cv::detail::PlaneWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:47:60: error: inline function 'cv::sfinae::has_parenthesis_operator<cv::DefaultDeleter<cv::detail::AffineWarper>,
      void, cv::detail::AffineWarper *>::check<cv::DefaultDeleter<cv::detail::AffineWarper> >' is not defined [-Werror,-Wundefined-inline]
    template<typename> static CV_CONSTEXPR std::false_type check(...);
                                                           ^
/usr/local/include/opencv4/opencv2/core/cvstd_wrapper.hpp:49:22: note: used here
    typedef decltype(check<C>(0)) type;
                     ^
12 errors generated.
scons: *** [selfdrive/camerad/cameras/camera_webcam.o] Error 1
scons: building terminated because of errors.

How to reproduce or log data

follow the guide: https://github.com/commaai/openpilot/tree/master/tools/webcam

Expected behavior

build success

Additional context

Operating system: [Ubuntu 16.04]

OpenCV Config:

--
-- General configuration for OpenCV 4.3.0 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /home/galenzhao/opencv_contrib-4.3.0/modules
--     Version control (extra):     unknown
--
--   Platform:
--     Timestamp:                   2020-08-29T08:05:57Z
--     Host:                        Linux 4.15.0-29-generic x86_64
--     CMake:                       3.5.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       SSE4_1 (16 files):         + SSSE3 SSE4_1
--       SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (30 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX512_SKX (6 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ standard:                11
--     C++ Compiler:                /usr/bin/c++  (ver 5.4.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed
--     Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv hdf java js matlab ovis python2 sfm viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         YES
--
--   GUI:
--     GTK+:                        YES (ver 3.18.9)
--       GThread :                  YES (ver 2.48.2)
--       GtkGlExt:                  NO
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x0202)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.6)
--     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2_2)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
--
--   Video I/O:
--     DC1394:                      YES (2.2.4)
--     FFMPEG:                      YES
--       avcodec:                   YES (56.60.100)
--       avformat:                  YES (56.40.101)
--       avutil:                    YES (54.31.100)
--       swscale:                   YES (3.1.101)
--       avresample:                YES (2.1.0)
--     GStreamer:                   NO
--     v4l/v4l2:                    YES (linux/videodev2.h)
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     Intel IPP:                   2020.0.0 Gold [2020.0.0]
--            at:                   /home/galenzhao/opencv-4.3.0/build/3rdparty/ippicv/ippicv_lnx/icv
--     Intel IPP IW:                sources (2020.0.0)
--               at:                /home/galenzhao/opencv-4.3.0/build/3rdparty/ippicv/ippicv_lnx/iw
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.2.92)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
--
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/galenzhao/opencv-4.3.0/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python 3:
--     Interpreter:                 /home/galenzhao/.pyenv/shims/python3 (ver 3.8.2)
--     Libraries:                   /home/galenzhao/.pyenv/versions/3.8.2/lib (ver 3.8.2)
--     numpy:                       /home/galenzhao/.pyenv/versions/3.8.2/lib/python3.8/site-packages/numpy/core/include (ver 1.19.1)
--     install path:                lib/python3.8/site-packages/cv2/python-3.8
--
--   Python (for build):            /home/galenzhao/.pyenv/shims/python3
--
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
--
galenzhao commented 4 years ago

the content of opencv header file:

namespace sfinae {
template<typename C, typename Ret, typename... Args>
struct has_parenthesis_operator
{
private:
    template<typename T>
    static CV_CONSTEXPR std::true_type check(typename std::is_same<typename std::decay<decltype(std::declval<T>().operator()(std::declval<Args>()...))>::type, Ret>::type*);

    template<typename> static CV_CONSTEXPR std::false_type check(...);

    typedef decltype(check<C>(0)) type;

public:
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
    static CV_CONSTEXPR bool value = type::value;
#else
    // support MSVS 2013
    static const int value = type::value;
#endif
};
} // namespace sfinae
adeebshihadeh commented 4 years ago

The webcam build should be fixed and tested in CI as of f4e18e0b7408bc73ffa9320c8ce2689b74993430.