After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 597867 - Plugins good do not build on Ubuntu Hardy (kernel 2.6.24)
Plugins good do not build on Ubuntu Hardy (kernel 2.6.24)
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.16
Other Linux
: Normal major
: 0.10.17
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-10-09 00:58 UTC by Pau Garcia i Quiles
Modified: 2009-10-09 09:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix (568 bytes, patch)
2009-10-09 00:58 UTC, Pau Garcia i Quiles
committed Details | Review

Description Pau Garcia i Quiles 2009-10-09 00:58:07 UTC
Created attachment 145091 [details] [review]
fix

If you try to build plugins good 0.10.16 on Hardy, it will fail with a cryptic
error like this:

make[4]: Entering directory `/tmp/buildd/gst-plugins-good0.10-0.10.16/sys/v4l2' 
  CC    gstv4l2.o                                                               
  CC    gstv4l2colorbalance.o                                                   
  CC    gstv4l2object.o                                                         
gstv4l2object.c: In function 'gst_v4l2_object_fill_format_list':                
gstv4l2object.c:842: warning: implicit declaration of function '_IOWR'          
gstv4l2object.c:842: error: expected expression before 'struct'
gstv4l2object.c: In function 'gst_v4l2_object_probe_caps_for_format_and_size':
gstv4l2object.c:1304: error: expected expression before 'struct'
gstv4l2object.c:1331: error: expected expression before 'struct'
gstv4l2object.c: In function 'gst_v4l2_object_probe_caps_for_format':
gstv4l2object.c:1519: error: expected expression before 'struct'
gstv4l2object.c:1540: error: expected expression before 'struct'
gstv4l2object.c: In function 'gst_v4l2_object_get_nearest_size':
gstv4l2object.c:1737: error: expected expression before 'struct'
gstv4l2object.c:1744: error: expected expression before 'struct'
gstv4l2object.c:1764: error: expected expression before 'struct'
gstv4l2object.c:1771: error: expected expression before 'struct'
gstv4l2object.c: In function 'gst_v4l2_object_set_format':
gstv4l2object.c:1804: error: expected expression before 'struct'
gstv4l2object.c:1816: error: expected expression before 'struct'
gstv4l2object.c:1827: error: expected expression before 'struct'
gstv4l2object.c: In function 'gst_v4l2_object_start_streaming':
gstv4l2object.c:1882: warning: implicit declaration of function '_IOW'
gstv4l2object.c:1882: error: expected expression before 'int'
gstv4l2object.c: In function 'gst_v4l2_object_stop_streaming':
gstv4l2object.c:1895: error: expected expression before 'int'
make[4]: *** [libgstvideo4linux2_la-gstv4l2object.lo] Error 1

It's because _IOWRT is defined in ioctl.h. Doing #include <sys/ioctl.h> fixes
the issue. This does not happen with newer kernels (2.6.28 and newer do not
suffer from this, I don't know what exact version of the kernel fixed this).

The attached patch (include_ioctl.patch) fixes the issue for me, although is
not probably the optimal solution (I'm #including for all operating systems, in
all cases).
Comment 1 Sebastian Dröge (slomo) 2009-10-09 05:23:36 UTC
Yes, there needs to be a configure check too... I'll do that later, thanks.
Comment 2 Sebastian Dröge (slomo) 2009-10-09 05:33:38 UTC
Actually this looks more like a problem with your headers... _IOWR and _IOW are not used anywhere in the v4l2 plugin sources.

The first line that fails because _IOWR is not found is:
>    if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) {

Apart from that, sys/ioctl.h is already included via v4l2_calls.h and only not included if libv4l is used. So you are using libv4l and their headers don't include everything they need.
Comment 3 Pau Garcia i Quiles 2009-10-09 09:24:18 UTC
> Actually this looks more like a problem with your headers... _IOWR and _IOW are
> not used anywhere in the v4l2 plugin sources.
> The first line that fails because _IOWR is not found is:
>>    if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) {

There is no problem with my headers. _IOWR and _IOW are used in the v4l2 plugin because the v4l2 plugin includes videodev2.h. VIDIOC_ENUM_FMT is defined in videodev2.h as:

/usr/include/linux/videodev2.h:#define VIDIOC_ENUM_FMT         _IOWR ('V',  2, struct v4l2_fmtdesc)

And no, sys/ioctl.h is not already included via v4l2_calls.h, and my patch should be a proof of that: unless I explictly #include <sys/ioctl.h>, compilation fails. This is probably due to wrong detection of libv4l2:

#ifdef HAVE_LIBV4L2
#  include <libv4l2.h>
#else
#  include <sys/ioctl.h>
#  include <linux/videodev.h>
#  include <linux/videodev2.h>
#  define v4l2_fd_open(fd, flags) (fd)
#  define v4l2_close    close
#  define v4l2_dup      dup
#  define v4l2_ioctl    ioctl
#  define v4l2_read     read
#  define v4l2_mmap     mmap
#  define v4l2_munmap   munmap
#endif

You can easily check this by installing Ubuntu Hardy, then updating the GStreamer stuff from my PPA ( http://launchpad.net/~pgquiles/+archive/ppa ). The plugins good package there already includes the patch. That patch is not needed in Ubuntu Jaunty, so there is some kind of trouble with old kernels.
Comment 4 Sebastian Dröge (slomo) 2009-10-09 09:35:39 UTC
commit f10435580f571177b0c8825320983fc9b9423202
Author: Pau Garcia i Quiles <pgquiles@elpauer.org>
Date:   Fri Oct 9 11:34:16 2009 +0200

    v4l2: Include sys/ioctl.h for the V4L ioctl requests
    
    Old videodevice2.h kernel headers used ioctl stuff without
    including ioctl.h, making compilation fail on older systems.
    
    Note: Including ioctl.h here is only a workaround for old kernel
    headers, should be removed once everybody has new enough headers.
    
    Fixes bug #597867.