[sane-devel] Portbility problems with sane 1.0.25

Luiz Angelo Daros de Luca luizluca at gmail.com
Sun Oct 11 04:20:44 UTC 2015


Thanks for the new release! It merged most of the patches I kept in order
to compile for OpenWRT. However, I still faced some new and old problems:

a) backend/pieusb_buffer.c (most of the problems)

a.1) it uses mkostemp without checking its presence. uclibc might not
provide it. If mkstemp is enough, it might be better as it is POSIX and not
a glibc extension. I simply replaced it with mkstemp, which might not be

a.2) le16toh is always redefined, which gives me a "redefined warning". The
problem is that the replacement implementation uses __bswap_16, which is
not present in musl. As le16toh might be already fine, check for it before
reimplementing it:

a.3) if mmap is not found, it generates a compile error ("#error mmap(2)
not available, aborting"). The problem is that mmap is checked with
AC_FUNC_MMAP and it depends on a runtime check (ac_fn_c_try_run). As I'm
crosscompiling, no runtime check will ever work because all generated
binaries cannot run in my host system. If "AC_CHECK_FUNCS(mmap)" is not
good enough as a replacement, configure would need to check for other hints
(SO, arch) and heuristically define if mmap is avaiable. Anyway, if ever
mmap check fails, the expected result would be to disable pieusb backend
and never generate a compiler error.
I have no patch for this as I cheated the test defining

b) missing includes for sys/types.h (uchar and ulong)

This is an old problem still not fixed. The list of files that need to
include sys/types.h added the new backend epsonds

- include/sane/sanei_udp.h
- backend/kvs20xx_cmd.h
- backend/kvs40xx.h
- backend/hp5400.c
- backend/hp5590.c
- backend/epsonds-io.c (new)

Even these files including sane/config.h, sane/config.h only includes
sys/types.h when replacing some missing functions (inet_ntop, strndup).
Each problematic file might need something like:

#if defined(HAVE_SYS_TYPES_H)
# include <sys/types.h>

which is already used in some files (backend/umax_pp_low.c
backend/umax_pp.c backend/genesys_low.h backend/mustek_pp.c
backend/mustek_pp.h backend/pixma_bjnp.c)
or it could be added to sane/config.h (bruteforce solution).

I do have a patch but before upstreaming it, we need to define where to put
the include.



Luiz Angelo Daros de Luca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20151011/f8c6a74c/attachment.html>

More information about the sane-devel mailing list