gst-plugins-vision
gst-plugins-vision copied to clipboard
compilation error on ubuntu 18.04
On a fresh installation of ubuntu 18.04, I downloaded pylon6 into /opt/pylon6, then tried to compiled this plugin:
sudo apt update
sudo apt install git cmake libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
git clone https://github.com/joshdoe/gst-plugins-vision.git
cd gst-plugins-vision
mkdir build
cd build
cmake -DPYLON_DIR=/opt/pylon6 ..
make
make failed with below errors:
[ 95%] Building C object sys/pylon/CMakeFiles/gstpylon.dir/gstpylonsrc.c.o
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/gstreamer-1.0/gst/gst.h:27,
from /usr/include/gstreamer-1.0/gst/base/gstpushsrc.h:27,
from /root/gst-plugins-vision/sys/pylon/gstpylonsrc.h:24,
from /root/gst-plugins-vision/sys/pylon/gstpylonsrc.c:38:
/usr/include/glib-2.0/glib/gmacros.h:241:53: error: size of array '_GStaticAssertCompileTimeAssertion_1' is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:238:47: note: in definition of macro 'G_PASTE_ARGS'
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:241:44: note: in expansion of macro 'G_PASTE'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~
/root/gst-plugins-vision/sys/pylon/gstpylonsrc.c:192:1: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT ((int) PROP_NUM_PROPERTIES == GST_PYLONSRC_NUM_PROPS);
^~~~~~~~~~~~~~~
In file included from /root/gst-plugins-vision/sys/pylon/gstpylonsrc.c:43:0:
/root/gst-plugins-vision/./common/genicampixelformat.h:264:1: warning: 'gst_genicam_pixel_format_caps_from_pixel_format' defined but not used [-Wunused-functio]
gst_genicam_pixel_format_caps_from_pixel_format (const char *pixel_format,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/gst-plugins-vision/./common/genicampixelformat.h:256:1: warning: 'gst_genicam_pixel_format_get_stride' defined but not used [-Wunused-function]
gst_genicam_pixel_format_get_stride (const char *pixel_format,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/gst-plugins-vision/./common/genicampixelformat.h:226:1: warning: 'gst_genicam_pixel_format_from_caps' defined but not used [-Wunused-function]
gst_genicam_pixel_format_from_caps (const GstCaps * caps, int *endianness)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sys/pylon/CMakeFiles/gstpylon.dir/build.make:62: recipe for target 'sys/pylon/CMakeFiles/gstpylon.dir/gstpylonsrc.c.o' failed
make[2]: *** [sys/pylon/CMakeFiles/gstpylon.dir/gstpylonsrc.c.o] Error 1
CMakeFiles/Makefile2:502: recipe for target 'sys/pylon/CMakeFiles/gstpylon.dir/all' failed
make[1]: *** [sys/pylon/CMakeFiles/gstpylon.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
If I remove this line, make will succeed.
Had same issue, fixed by changing gstpylonsrc.h:
diff --git a/sys/pylon/gstpylonsrc.h b/sys/pylon/gstpylonsrc.h
index aed6aa5..b5fad64 100644
--- a/sys/pylon/gstpylonsrc.h
+++ b/sys/pylon/gstpylonsrc.h
@@ -39,7 +39,7 @@ enum
GST_PYLONSRC_NUM_CAPTURE_BUFFERS = 10,
GST_PYLONSRC_NUM_AUTO_FEATURES = 3,
GST_PYLONSRC_NUM_LIMITED_FEATURES = 2,
- GST_PYLONSRC_NUM_PROPS = 75
+ GST_PYLONSRC_NUM_PROPS = 76
};
A second issue came up following this: the preset for the color correction is not right, at least for pylon 5.1 which I am using. I corrected as follows:
diff --git a/sys/pylon/gstpylonsrc.c b/sys/pylon/gstpylonsrc.c
index 11ea266..3c9f0e6 100644
--- a/sys/pylon/gstpylonsrc.c
+++ b/sys/pylon/gstpylonsrc.c
@@ -2351,7 +2351,8 @@ gst_pylonsrc_set_lightsource (GstPylonSrc * src)
"Setting light preset to Daylight 5000k (Daylight).");
res =
PylonDeviceFeatureFromString (src->deviceHandle,
- preset, "Daylight5000K");
+ //preset, "Daylight5000K");
+ preset, "Daylight");
PYLONC_CHECK_ERROR (src, res);
} else if (strcmp (src->lightsource, "6500k") == 0) {
GST_DEBUG_OBJECT (src,
Error is introduced in https://github.com/joshdoe/gst-plugins-vision/commit/ee440aa927b9833f1df2a9443de73eb8f24f8f22. Seems like auto tests would be of great help @matthewperkins, preset name “Daylight" or "Daylight5000" depends on a camera model, as far as I remember. I've put some effort into unifying mismatching option names. Probably there is some more work to do. See https://github.com/joshdoe/gst-plugins-vision/issues/48