#38 Build fails with linux 2.6.1 headers

closed-fixed
nobody
None
5
2004-01-20
2004-01-18
Anonymous
No

Seems that, for political reasons, lots of system apps
are now broken because of new requirements that no
user space code should include kernel headers. I realy
do not understand what's the goal of __KERNEL__
directive anymore, neither how low level user space libs
& apps can be built now.

Anyway, libdv do not build against Linux 2.6.1 kernel
headers, since it includes <linux/videodev.h>, which is
forbidden now.

Certainly you'll have to copy in userspace header b4l
declarations.

CC

Discussion

  • Logged In: NO

    Sorry, a part of the message was removed by the bug
    system. I said it includes linux/videodev.h in enc_input.c
    (builds failure with :

    In file included from /usr/include/linux/device.h:17,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/linux/list.h:594:2: warning: #warning "don't
    include kernel headers in userspace"
    In file included from /usr/include/linux/device.h:18,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/linux/spinlock.h: In function `bit_spin_lock':
    /usr/include/linux/spinlock.h:413: invalid type argument of
    `->'
    /usr/include/linux/spinlock.h: In function `bit_spin_trylock':
    /usr/include/linux/spinlock.h:436: invalid type argument of
    `->'
    /usr/include/linux/spinlock.h: In function `bit_spin_unlock':
    /usr/include/linux/spinlock.h:451: invalid type argument of
    `->'
    /usr/include/linux/spinlock.h:451: `TIF_NEED_RESCHED'
    undeclared (first use in this function)
    /usr/include/linux/spinlock.h:451: (Each undeclared identifier
    is reported only once
    /usr/include/linux/spinlock.h:451: for each function it appears
    in.)
    /usr/include/linux/spinlock.h: In function `bit_spin_is_locked':
    /usr/include/linux/spinlock.h:462: invalid type argument of
    `->'
    In file included from /usr/include/linux/timex.h:186,
    from /usr/include/linux/sched.h:11,
    from /usr/include/linux/module.h:10,
    from /usr/include/linux/device.h:21,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/linux/time.h: At top level:
    /usr/include/linux/time.h:9: redefinition of `struct timespec'
    /usr/include/linux/time.h:15: redefinition of `struct timeval'
    /usr/include/linux/time.h:354: redefinition of `struct
    itimerspec'
    In file included from /usr/include/linux/jiffies.h:7,
    from /usr/include/linux/sched.h:12,
    from /usr/include/linux/module.h:10,
    from /usr/include/linux/device.h:21,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/linux/seqlock.h: In function `write_seqlock':
    /usr/include/linux/seqlock.h:52: invalid type argument of `->'
    /usr/include/linux/seqlock.h: In function `write_sequnlock':
    /usr/include/linux/seqlock.h:61: invalid type argument of `->'
    /usr/include/linux/seqlock.h:61: `TIF_NEED_RESCHED'
    undeclared (first use in this function)
    /usr/include/linux/seqlock.h: In function `write_tryseqlock':
    /usr/include/linux/seqlock.h:66: invalid type argument of `->'
    /usr/include/linux/seqlock.h:66: invalid type argument of `->'
    /usr/include/linux/seqlock.h:66: `TIF_NEED_RESCHED'
    undeclared (first use in this function)
    In file included from /usr/include/linux/sched.h:12,
    from /usr/include/linux/module.h:10,
    from /usr/include/linux/device.h:21,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/linux/jiffies.h: At top level:
    /usr/include/linux/jiffies.h:16: syntax error before "jiffies_64"
    /usr/include/linux/jiffies.h:20: syntax error before
    "get_jiffies_64"
    In file included from /usr/include/asm-generic/cpumask.h:8,
    from /usr/include/asm/cpumask.h:4,
    from /usr/include/linux/cpumask.h:5,
    from /usr/include/linux/sched.h:15,
    from /usr/include/linux/module.h:10,
    from /usr/include/linux/device.h:21,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/linux/bitmap.h: In function `bitmap_empty':
    /usr/include/linux/bitmap.h:15: `BITS_PER_LONG' undeclared
    (first use in this function)
    /usr/include/linux/bitmap.h: In function `bitmap_full':
    /usr/include/linux/bitmap.h:29: `BITS_PER_LONG' undeclared
    (first use in this function)
    /usr/include/linux/bitmap.h: In function `bitmap_equal':
    /usr/include/linux/bitmap.h:44: `BITS_PER_LONG' undeclared
    (first use in this function)
    /usr/include/linux/bitmap.h: In function `bitmap_shift_right':
    /usr/include/linux/bitmap.h:85: `__shr_tmp' undeclared (first
    use in this function)
    /usr/include/linux/bitmap.h: In function `bitmap_shift_left':
    /usr/include/linux/bitmap.h:98: `__shl_tmp' undeclared (first
    use in this function)
    /usr/include/linux/bitmap.h: In function `bitmap_weight':
    /usr/include/linux/bitmap.h:144: `BITS_PER_LONG' undeclared
    (first use in this function)
    In file included from /usr/include/linux/sched.h:21,
    from /usr/include/linux/module.h:10,
    from /usr/include/linux/device.h:21,
    from /usr/include/linux/videodev.h:6,
    from enc_input.c:51:
    /usr/include/asm/mmu.h: At top level:
    /usr/include/asm/mmu.h:13: field `sem' has incomplete type
    /usr/include/asm/mmu.h:15: confused by earlier errors,
    bailing out
    make[3]: *** [enc_input.lo] Erreur 1
    make[3]: Leaving directory `/usr/src/sys/libdv-0.101/libdv'
    make[2]: *** [all] Erreur 2
    make[2]: Leaving directory `/usr/src/sys/libdv-0.101/libdv'
    make[1]: *** [all-recursive] Erreur 1
    make[1]: Leaving directory `/usr/src/sys/libdv-0.101'
    make: *** [all] Erreur 2

    )

     
  • Dan Dennedy
    Dan Dennedy
    2004-01-19

    Logged In: YES
    user_id=78682

    We have noticed problems with certain distro's
    linux/videodev.h. For example, Debian had this problem and
    recently fixed it. I have never seen the problem on Mandrake
    9.2 here. However, do you have more information about this
    issue political issue? Perhaps a kernel-dev ML thread? I
    would be interested to validate before making this move.

     
  • Logged In: NO

    In fact, it seems that kernel headers shouldn't be included
    **at all** in any user space program. As far as I can
    remember, user space programs are supposed to use only libc
    and <sys> headers. However, these headers are not
    sufficient, and kernel header mess is reported to app dev.

    This is a pb some of my friends and I encountered with dsl
    usb modem drivers too.

    As far as I can remember, recent distros that uses recent
    kernel headers do not enable build, because these headers
    are broken (supposedly by design). Nobody dared to ask on a
    kernel ML however, so I cannot answer.

    For me, the kernel headers suffers at least three problems :
    1. First, kernel internal structures are not well isolated with
    __KERNEL__ ifdef, the right answer would have been to fix
    this, the bad one was to say user space progs should not
    include them as it is not portable (true, but nobody can code
    low level programs with standard only headers).
    2. Second, kernel internal strucutres are exposed through
    headers even if they are __KERNEL__ protected. Bad
    anyway.
    3. Last, they are not C++ complient.

    For our driver, we had to duplicate headers structures (and
    ioctl codes) in the control software. Not really pleasant, but
    at least the kernel can evolve as far as binart compatibility is
    preserved (in syscalls, ioctl numbers and structures). That is
    supposed to be the case. I guess glibc will expose such
    service, or it should if They are coherent.

    For videodev.h, I looked at kwintv3 code. Simple enough, it
    defines _DEVICE_H_ and _LINUX_TIME_H (note the missing
    underscore at the end) before including linux/videodev.h (you
    can do this just before inclusion in enc_input.c). That wipes
    out the broken kernel header. For me, it is really a kernel
    bug, but they do not want to fix it anyway (for how many
    time / how much dev anger ?).

    I can recomend you the kwintv3 solution, since it is not too
    complex or intrusive, until they accept this is a complete
    mess. I tested with 2.6.1 kernel headers, and the modified
    libdv compiled OK (however, autoconf cannot detect
    videodev correctly and ask for a bug report too, but it didnt
    prevent libdv to compile).

    Anyway, I'm interested in the real history, I gave only my
    ideas on that subject...

    CC

     
  • Dan Dennedy
    Dan Dennedy
    2004-01-20

    Logged In: YES
    user_id=78682

    I am going to just add the defines since other popular v4l
    applications like ffmpeg and xine do include
    linux/videodev.h as well--both define _LINUX_TIME_H as well.

     
  • Dan Dennedy
    Dan Dennedy
    2004-01-20

    • status: open --> closed-fixed
     
  • Dan Dennedy
    Dan Dennedy
    2004-01-20

    Logged In: YES
    user_id=78682

    applied #defines workaround in CVS