[sane-devel] Found: why Sane make barfed under RH6.1

Douglas Gilbert dgilbert@interlog.com
Tue, 12 Mar 2002 20:32:17 -0500

john meshkoff wrote:
> The error:
> sanei_scsi.c: In function `sanei_scsi_req_wait':
> sanei_scsi.c:2079: structure has no member named `host_status'
> sanei_scsi.c:2080: structure has no member named `host_status'
> sanei_scsi.c:2081: structure has no member named `host_status'
> sanei_scsi.c:2082: structure has no member named `driver_status'
> sanei_scsi.c:2083: structure has no member named `target_status'
> The versions of /scsi/sg.h available at the time:
> ivan:~$ locate /include/scsi/sg.h
> /usr/include/scsi/sg.h
> /usr/include/scsi/sg.h.bak	/* the originally installed version */
> /usr/local/src/include/scsi/sg.h
> /usr/src/linux-2.2.12/include/scsi/sg.h	/* originally installed kernel
> sources */
> /usr/src/redhat/SOURCES/linux-2.2.19/include/scsi/sg.h
> /usr/src/redhat/SOURCES/linux-2.2.16/include/scsi/sg.h
> /usr/src/redhat/SOURCES/dosemu-1.0.1/src/include/scsi/sg.h
> /usr/i386-glibc20-linux/include/scsi/sg.h 
> Interesting result of detective work on my RH6.1 install; the only
> version of sg.h that was incompatible with the Sane make was the one I
> show
> re-named as sg.h.bak, which was installed by RH6.1, along with the
> 2.2.12-20
> kernel, yet the version included under the 2.2.12-20 kernel sources is
> compatible, so
> are all the others in all the above listed include directories.  So it
> looks
> like the make barfing on "structure has no member named" is due to the
> wrong
> version of the sg.h file having been installed by RH6.1 in /usr/include,
> despite
> the correct version having been included by that install under the
> 2.2.12 kernel sources tree.
> 	The question was raised to me as to whether my kernel was compiled
> against  the updated sg.h file so as to prevent possible weird behavior
> by Sane; so I'm wondering, would a kernel compiled from sources, be
> compiled against the includes under it's own source tree, or those under
> /usr/include?  If the former, then all the kernels above were compiled
> against compatible versions, but any program makeing against
> /user/include/scsi would have encountered an incompatible version, prior
> to my updating of it.

The kernel compiles the sg driver (either built-in or a module)
against the /<kernel_source_root>/include/scsi/sg.h header.
It would be difficult (but not impossible) to get that file
"out of sync" with the /<kernel_source_root>/drivers/scsi/sg.c
file. I am the maintainer of those 2 files.

SANE builds against /usr/include/scsi/sg.h which is maintained
by the glibc people. Linux kernel source and glibc are distributed
(almost) independently. Files such as sg.h are why "almost" is
needed in the previous sentence :-) There is not much I can do
about this contention other than point it out to people.

Doug Gilbert