Well, I could build opencv 3.1 by myself without any modification. So, I think the reason of no port of opencv is that we could build it ourselves.
% make
[ 8%] Built target opencv_core
[ 18%] Built target opencv_imgproc
[ 21%] Built target opencv_imgcodecs
Scanning dependencies of target opencv_videoio
[ 21%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_libv4l.cpp.o
/usr/local/home/staff/rizzo/tmp/opencv-3.1.0/modules/videoio/src/cap_libv4l.cpp:257:10: fatal error:
'asm/types.h' file not found
#include <asm/types.h> /* for videodev2.h */
^
1 error generated.
Don't use /usr/src/sys/compat/linuxkpi/common/include/asm/types.h. This is for some kernel modules only.
The correct headers needed to compile software that uses V4L are in multimedia/v4l_compat. The asm/types.h include line would likely need to be removed as well. This is just a guess but it's what the current graphics/opencv port does too.
# uname -a
FreeBSD venus 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r293243: Thu Jan 7 00:51:45 BRST 2016 root@venus:/usr/obj/usr/src/sys/VENUS amd64
root@venus: # pkg info -a | grep -i v4
gstreamer1-plugins-v4l2-1.6.2 GStreamer Video 4 Linux 2 source plugin
libv4l-1.6.3_1 Video4Linux library
p5-IO-Socket-IP-0.37 Drop-in replacement for IO::Socket::INET supporting IPv4 and IPv6
v4l-utils-1.6.3 Video4Linux utilities
v4l_compat-1.6.3 Video4Linux IOCTL header files
root@venus: # find /usr/ -name types.h
/usr/include/rpc/types.h
/usr/include/sys/types.h
/usr/local/home/staff/rizzo/tmp/opencv-3.1.0/3rdparty/libwebp/webp/types.h
/usr/local/include/zzip/types.h
/usr/local/include/kpathsea/types.h
/usr/local/include/sp/types.h
/usr/local/include/webp/types.h
/usr/local/include/mutter/meta/types.h
/usr/local/include/cdio/types.h
/usr/local/include/libwmf/types.h
/usr/local/include/graphviz/types.h
/usr/local/include/libgltf-0.0/types.h
/usr/local/include/libcmis-c-0.5/libcmis-c/types.h
/usr/local/include/libopenraw-1.0/libopenraw/types.h
/usr/local/include/git2/types.h
/usr/local/include/cairomm-1.0/cairomm/types.h
/usr/local/include/pangomm-1.4/pangomm/types.h
/usr/local/include/gdkmm-3.0/gdkmm/types.h
/usr/local/include/libvcd/types.h
/usr/local/include/freerdp/types.h
/usr/local/include/wx-3.0/wx/types.h
/usr/local/include/wine/msvcrt/sys/types.h
/usr/local/include/gdkmm-2.4/gdkmm/types.h
/usr/local/include/ntfs-3g/types.h
/usr/local/include/jack/types.h
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h
/usr/local/lib/gcc48/include/c++/parallel/types.h
/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd11.0/4.7.4/include-fixed/sys/types.h
/usr/local/lib/gcc47/include/c++/parallel/types.h
/usr/local/sage-6.7/local/include/c++/4.9.2/parallel/types.h
/usr/local/sage-6.7/local/lib/gcc/x86_64-unknown-freebsd11.0/4.9.2/include-fixed/sys/types.h
/usr/src/sys/dev/isci/types.h
/usr/src/sys/compat/linuxkpi/common/include/linux/types.h
/usr/src/sys/compat/linuxkpi/common/include/asm/types.h
/usr/src/sys/sys/types.h
/usr/src/sys/cddl/compat/opensolaris/sys/types.h
/usr/src/sys/rpc/types.h
/usr/src/contrib/ofed/include/infiniband/types.h
/usr/src/contrib/sendmail/include/sm/types.h
/usr/src/contrib/ntp/lib/isc/include/isc/types.h
/usr/src/contrib/telnet/telnet/types.h
/usr/src/crypto/heimdal/appl/telnet/telnet/types.h
root@venus: #
--- modules/videoio/src/cap_libv4l.cpp.orig 2016-07-08 20:08:26.339767464 +0200
+++ modules/videoio/src/cap_libv4l.cpp 2016-07-08 20:08:36.630757601 +0200
@@ -251,7 +251,6 @@
#include <sys/mman.h>
#include <string.h>
#include <stdlib.h>
-#include <asm/types.h> /* for videodev2.h */
#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
--- modules/imgcodecs/src/rgbe.cpp.orig 2016-07-08 20:24:21.567695506 +0200
+++ modules/imgcodecs/src/rgbe.cpp 2016-07-08 20:24:41.556701536 +0200
@@ -44,7 +44,7 @@
#include "rgbe.hpp"
#include <math.h>
#if !defined(__APPLE__)
-#include <malloc.h>
+#include <stdlib.h>
#endif
#include <string.h>
#include <ctype.h>
cmake -DCMAKE_REQUIRED_INCLUDES:STRING="/usr/local/include"
make -j6
That header does not exist on FreeBSD (I grepped the port tree for it, no port installs it).Anyone know which port this header belongs in?
That's what the -DCMAKE_REQUIRED_INCLUDES:STRING="/usr/local/include" flag does for me. If I don't add it cmake doesn't find any V4L related headers.I think my issue is OpenCV's configure process is not finding the files include /usr/local/include/linux, just its parent directory. Is there a flag I can pass to include additional directories of head files?