[sane-devel] Compile problem in 1.0.11

Henning Meier-Geinitz henning@meier-geinitz.de
Thu, 10 Apr 2003 10:51:34 +0200


Hi,

On Thu, Apr 10, 2003 at 12:46:27AM -0300, John Coppens wrote:
> Get this error on compiling sane-backends 1.0.11:

Please provide more details. This is which Linux version? Which
version of glibc? Which distribution? Which gcc?

I haven't seen any bug reports about this ever. The include hasn't
changed since ... well ... since the beginning of the time :-)

> gcc -c -g -O2 -W -Wall -DHAVE_CONFIG_H -I. -I. -I../include -I../include
> -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
> -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0
> -DBACKEND_NAME=v4l -DLIBDIR=/usr/local/lib/sane v4l.c  -fPIC -DPIC -o
> v4l.lo
> In file included from /usr/include/linux/videodev2.h:16,
>                  from /usr/include/linux/videodev.h:14,
>                  from v4l.c:76:
> /usr/include/linux/time.h:9: redefinition of `struct timespec'
> /usr/include/linux/time.h:88: redefinition of `struct timeval'
> /usr/include/linux/time.h:93: redefinition of `struct timezone'
> /usr/include/linux/time.h:124: redefinition of `struct itimerval'
> 
> In v4l.c, line 67, I changed:
> 
> #include <sys/time.h>
> to
> #include <linux/time.h>

That doesn't look right. We shouldn't include the low-level headers if
th at's not absolutely necessary. However, I think we don't need
sys/time.h anyway. At least for me it compiles without that include.

> which eliminated two errors and left:
> 
> In file included from v4l.c:67:
> /usr/include/linux/time.h:9: redefinition of `struct timespec'
> /usr/include/linux/time.h:88: redefinition of `struct timeval'
> 
> 
> Any idea which other include references timespec again? Or just what to do
> to get this working?

Maybe one of the standard system headers includes sys/time.h?

Are you sure that you have the headers that came with glibc in
/usr/include/linux? Sometimes /usr/include/linux is a link to
/usr/src/linux/include/linux, that causes all sorts of problems when
the kernel headers change and is strongly discouraged.

Bye,
  Henning