kbingham / libcamera

libcamera - Making complex cameras easy. This is a personal fork, please use the upstream repository at https://git.libcamera.org/libcamera/libcamera.git/
https://libcamera.org
Other
167 stars 69 forks source link

Make error compiling mjpg-streamer-libcamera #53

Closed bryn51 closed 1 year ago

bryn51 commented 1 year ago

When building mjpg-streamer-libcamera required to install an Arducam 16 MP IMX519 AF Camera for benefit of Octoprint, I get the following make errors: The build platform in my case: Octopi nightly build <on Raspbian 11 64 bit Pi 4B/8GB

make[3]: Entering directory '/home/pi/mjpg-streamer-libcamera/mjpg-streamer-experimental/_build'
[ 55%] Building CXX object plugins/input_libcamera/CMakeFiles/input_libcamera.dir/input_libcamera.cpp.o
In file included from /home/pi/mjpg-streamer-libcamera/mjpg-streamer-experimental/plugins/input_libcamera/LibCamera.h:20,
                 from /home/pi/mjpg-streamer-libcamera/mjpg-streamer-experimental/plugins/input_libcamera/input_libcamera.cpp:31:
/usr/include/libcamera/libcamera/controls.h: In instantiation of ‘void libcamera::ControlList::set(const libcamera::Control<T>&, const std::initializer_list<_Up>&) [with T = libcamera::Span<const long long int, 2>; V = long long int]’:
/home/pi/mjpg-streamer-libcamera/mjpg-streamer-experimental/plugins/input_libcamera/input_libcamera.cpp:259:77:   required from here
/usr/include/libcamera/libcamera/controls.h:403:14: error: no matching function for call to ‘libcamera::ControlValue::set<libcamera::Span<const long long int, 2> >(libcamera::Span<const long long int, 4294967295>)’
  403 |   val->set<T>(Span<const typename std::remove_cv_t<V>>{ value.begin(), value.size() });
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/libcamera/libcamera/controls.h:178:7: note: candidate: ‘template<class T, typename std::enable_if<((! libcamera::details::is_span<U>::value) && (! std::is_same<std::__cxx11::basic_string<char>, typename std::remove_cv< <template-parameter-1-1> >::type>::value)), std::nullptr_t>::type <anonymous> > void libcamera::ControlValue::set(const T&)’
  178 |  void set(const T &value)
      |       ^~~
/usr/include/libcamera/libcamera/controls.h:178:7: note:   template argument deduction/substitution failed:
/usr/include/libcamera/libcamera/controls.h:177:30: error: no type named ‘type’ in ‘struct std::enable_if<false, std::nullptr_t>’
  177 |            std::nullptr_t> = nullptr>
      |                              ^~~~~~~
/usr/include/libcamera/libcamera/controls.h:190:7: note: candidate: ‘template<class T, typename std::enable_if<(libcamera::details::is_span<U>::value || std::is_same<std::__cxx11::basic_string<char>, typename std::remove_cv< <template-parameter-1-1> >::type>::value), std::nullptr_t>::type <anonymous> > void libcamera::ControlValue::set(const T&)’
  190 |  void set(const T &value)
      |       ^~~
/usr/include/libcamera/libcamera/controls.h:190:7: note:   template argument deduction/substitution failed:
/usr/include/libcamera/libcamera/controls.h:403:14: note:   cannot convert ‘libcamera::Span<const long long int, 4294967295>((& value)->std::initializer_list<long long int>::begin(), (& value)->std::initializer_list<long long int>::size())’ (type ‘libcamera::Span<const long long int, 4294967295>’) to type ‘const libcamera::Span<const long long int, 2>&’
  403 |   val->set<T>(Span<const typename std::remove_cv_t<V>>{ value.begin(), value.size() });
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [plugins/input_libcamera/CMakeFiles/input_libcamera.dir/build.make:82: plugins/input_libcamera/CMakeFiles/input_libcamera.dir/input_libcamera.cpp.o] Error 1

============== Looks to me like there is an issue with libcamera/controls.h (but don't hit me if this is incorrect, I'm just guessing) If you need further info to chase this down, please provide me instructions to get it and I'll help as much as I can.

bryn51 commented 1 year ago

Looks to me like this issue has been addressed, by @Laurent Pinchart yesterday .

The fix is not yet committed, but I was able to copy the modifed code in controls.h into my local copy and recompile input_libcaera.so (part of the build for mjpeg-streamer), and it got past the error cited in the report, and completed the build successfully.

My ArduCam 16MB AF now works !

And all I can say is thanks.

However for benefit of others having the same issue, the fix would need to be released, of course.