[sane-devel] Re: Problem to make with the 2001-09-15 tgz

Marcio Luis Teixeira marciot@holly.colostate.edu
Tue, 18 Sep 2001 21:24:31 -0600


Francois,

I've attempted to answer your questions as best as I could, but I am also
carbon-copying it to the general sane-devel mailing list in case others
have feedback.

As it stands, the umax1220u backend is in its infancy and there are still
a lot of issues to be resolved. If anyone on the list has suggestions on how
to fix these problems, I would appreciate hearing it.

Marcio Luis Teixeira

François Desloges wrote:

> Hi Marcio!
>
> I followed exactly the Install rules included in your package, and everything
> went well:
>
> 1) Build and install the sane 1.0.5 distribution
>
>    tar xvf sane-backends-1.0.5.tar
>    cd sane-backends-1.0.5
>    ./configure
>    make
>    make install
>
> 2) Build and install the UMAX Astra 1220U backend
>
>    cd sane-backends-1.0.5
>    tar xvf umax1220u-sane.tar
>    cd backend
>    touch umax1220u-sane.c
>    make -f Makefile.umax1220u
>
> at that point I got the message:
>
> Desloges@celeron backend]$ make -f Makefile.umax1220u
> rm -f .libs/umax1220u.lo
> gcc -c -g -O2 -W -Wall -DHAVE_CONFIG_H -I. -I. -I../include -I../include
> -D_GNU_SOURCE -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
> -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0
> -DBACKEND_NAME=umax1220u -DLIBDIR=/usr/local/lib/sane umax1220u.c  -fPIC
> -DPIC -o .libs/umax1220u.lo
> In file included from umax1220u.c:64:
> umax1220u-common.c: In function `send_scan_parameters':
> umax1220u-common.c:1129: warning: unused parameter `h'
> gcc -c -g -O2 -W -Wall -DHAVE_CONFIG_H -I. -I. -I../include -I../include
> -D_GNU_SOURCE -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
> -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0
> -DBACKEND_NAME=umax1220u -DLIBDIR=/usr/local/lib/sane umax1220u.c -o
> umax1220u.o >/dev/null 2>&1
> mv -f .libs/umax1220u.lo umax1220u.lo
> rm -f umax1220u-s.c
> ln -s ./stubs.c umax1220u-s.c
> rm -f .libs/umax1220u-s.lo
> gcc -c -g -O2 -W -Wall -DHAVE_CONFIG_H -I. -I. -I../include -I../include
> -D_GNU_SOURCE -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
> -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0 -DSTUBS
> -DBACKEND_NAME=umax1220u umax1220u-s.c  -fPIC -DPIC -o .libs/umax1220u-s.lo
> gcc -c -g -O2 -W -Wall -DHAVE_CONFIG_H -I. -I. -I../include -I../include
> -D_GNU_SOURCE -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
> -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0 -DSTUBS
> -DBACKEND_NAME=umax1220u umax1220u-s.c -o umax1220u-s.o
> >/dev/null 2>&1
> mv -f .libs/umax1220u-s.lo umax1220u-s.lo
> rm -fr .libs/libsane-umax1220u.la .libs/libsane-umax1220u.*
> .libs/libsane-umax1220u.*
> gcc -shared  umax1220u.lo umax1220u-s.lo sane_strstatus.lo
> ../sanei/sanei_init_debug.lo ../sanei/sanei_config.lo ../lib/alloca.lo
> ../lib/getenv.lo ../lib/getopt.lo ../lib/getopt1.lo ../lib/isfdtype.lo
> ../lib/sigprocmask.lo ../lib/snprintf.lo ../lib/strdup.lo ../lib/strndup.lo
> ../lib/strsep.lo ../lib/usleep.lo ../lib/vsyslog.lo
> ../sanei/sanei_constrain_value.lo  -lnsl -lm -ljpeg -ldl -lc  -Wl,-soname
> -Wl,libsane.so.1 -o .libs/libsane-umax1220u.so.1.0.5
> /usr/bin/ld: cannot find -ljpeg
> collect2: ld returned 1 exit status
> make: *** [libsane-umax1220u.la] Error 1
>
> It doesn't look like there is a library simply called jpeg either in
> installed or installable package on my system. I use the Freq release of
> Mandrake that followed Mandrake 8.0.

That's funny. I'm not even using libjpeg so that lib is redundant. As a
workaround, try editing "Makefile.umax1220u" and replace this line:

    BACKENDLIBS = -lnsl -lm  -ljpeg -ldl

With this:

    BACKENDLIBS = -lnsl -lm -ldl

The truth is, the Makefile probably has a lot of problems. The gotcha
is that I derived my Makefile from the SANE distribution's Makefile,
by deleting the names of all the other backends, and keeping only the
stuff related to the umax1220u backend.

This is sloppy, because the Makefile for SANE is created by the
"./configure" script and is tailored to each system it runs on. By basing
*my* Makefile on that one, I ended up with a Makefile that only works
on my system (or very similar ones).

In short, it's a pretty lousy Makefile, but I don't have anything better
right now.

What I think would be really handy would be if the SANE distribution
included a cannonical Makefile that could be used when developing
other backends. Maybe it could even include a sort of backend SDK
that developers could use as a starting point for their projects. Something
like a single self-contained subdirectory with a sample backend (such
as the pnm backend) and a Makefile that built and installed only that
backend.

> While I'm at it I have a couple other dumb questions: I am not familiar at
> all with that region of the kernel (although I somewhat play with the
> networking stack once in a while) but, why do you need to uncomment that:
> #define SCN_IOCTL
>
> In the 2.4.5 kernel that come with Mandrake 8.0 Freq, the comment above that
> line says:
> /* Enable to activate the ioctl interface.  This is mainly meant for */
> /* development purposes until an ioctl number is officially registered */
>
> Why don't you ask for an officially registered ioctl number ?  It is not such
> a scarce ressource, and it would save all your user the lenghty process of
> rebuilding their kernel (and breaking their distro :-(

I would love to be able to fix this more formally, but the short answer is, I
don't
know who to ask. In the future, there may even be ways around this altogether.
I know there was some discussion on the list about standardizing the USB
interface in SANE. If this happens, that SCN_IOCTL may not even be
necessary.

> Last stupid question, somewhere else in your install page you say:
> 3) Create a device file for /dev/usbscanner
>
>    (must be done from root!)
>
>    mknod /dev/usbscanner c 180 48
>    chmod a+rw /dev/usbscanner
>
> My distro come with a  c 180 48 device file called /dev/usb/scanner0. (and
> all other up to scanner 15 using minor 63. Do I really need to use the
> /dev/usbscanner name ?  What about a ln -s to /dev/usb/scanner ?  And what if
> I was using devfs ?

As far as I know, creating another device file with the same numbers should not
harm anything. It would effectively be an alias for the device.

Ideally, I suppose my backend should be made configurable, so you could tell
it what device file to use, but it's not at that point yet (right now, I'm glad
I have
something that works! :)

Marcio Luis Teixeira