Re: Compiling Sane Now Infuriating

From: Douglas Gilbert (
Date: Fri Jan 12 2001 - 10:21:56 PST

  • Next message: Douglas Gilbert: "Re: Compiling Sane Now Infuriating"

    "Jeffrey W. Baker" wrote:
    > Hi,
    > Is it actually possible to compile sane? I downloaded both parts of the
    > 1.0.4 package. I tried to build the backends, but sanei_scsi.c has some
    > preprocessor horkage by which it includes /usr/include/scsi/sg.h and
    > /usr/include/linux/../scsi/sg.h,

    Hmmm. Including both of those files is asking for
    trouble. Even though I included a C++ type guard
    inside sg.h , the GNU library maintainers changed
    it in their version! Even then, the "guard" solution
    is less than desirable because it just picks
    the first header seen.

    > which are clearly the same file and gcc
    > gets pissed off by redefinition. After I fixed this problem (not the
    > right way, I'm sure, but by hard-coding #include <scsi/sg.h>), the package
    > compiled and installed.

    It may have compiled and worked, but it defeated
    what sanei_scsi was trying to do.

    sg.h is collateral damage in a minor GNU-linux turf
    war. The file /usr/src/linux/include/scsi/sg.h is the
    header that matches the the sg driver in the kernel
    (unless the kernel source and the running kernel are
    out of sync). The file /usr/include/scsi/sg.h "belongs"
    to the GNU library and may or may not match the running
    sg driver. Surprisingly the glibc 2.2 library (update to
    RH 7.0) does have the latest sg.h (correct for lk 2.4.0),
    albeit reformatted and with a different guard. Perhaps
    I should change the kernel guard to be the same as the
    GNU guard ...

    It seems bizarre to me that if the sg.h lived in the
    "linux" directory rather than the "scsi" directory,
    this problem wouldn't happen (since the former directory
    is a symlink to /usr/src/linux/include/linux). There
    seems little I can do about this other than try and
    explain what is happening. The GNU library maintainers
    have another spin on this, quoting Linus Torvalds
    amongst others that apps should never directly access
    kernel headers.

    Thanks for letting me share your infuriation ;-)

    BTW SANE 1.0.4 built "out of the box" for me.

    Doug Gilbert

    Source code, list archive, and docs:
    To unsubscribe: echo unsubscribe sane-devel | mail

    This archive was generated by hypermail 2b29 : Fri Jan 12 2001 - 10:51:12 PST