Re: Sane on NeXT/OpenStep - a plea for help

Neville Wilford (jnw@phaedrus.demon.co.uk)
Sun, 15 Jun 97 15:36:33 +0100

Hello again,

Thanks to Gordon Matzigkeit for a very helpful and patient message.
He wrote:

> Actually, this appears to be unrelated to your SCSI support.
> `sanei_save_values.c' is a simple, portable file. I am suprised
> that you have problems compiling it under OpenStep, but hey,
> nothing is *really* suprising when it comes to porting software.
>
>
> I believe the C compiler gave correct error messages. Somehow, your
> `read' and `write' functions have not been declared. Normally,
> these functions are declared by the `unistd.h' header file.

phaedrus:30# find / -name unistd.h -print
/NextDeveloper/Headers/bsd/unistd.h

I'm hoping this might count as a significant clue.

>
> OpenStep uses a variant of GCC, the GNU C compiler, so you should
> be able to find the list of include paths.
>
> cd into the sanei subdirectory of the SANE distribution, then run
> the `cc' command above, except add the `-v' option.
>
> Record the output. At some point, there should be the following:
>
> #include "..." search starts here:
> #include <...> search starts here:
> .

Here goes,

phaedrus:6# cd sanei
phaedrus:7# cc -v -c -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=0 -DV_MINOR=5 -g -O2 \
-D_GNU_SOURCE sanei_save_values.c
Reading specs from /lib/i386/specs
NeXT Computer, Inc. version cc-475, gcc version 2.5.8
/lib/i386/cpp-precomp -smart -lang-c -v -I. -I. -I../include
-I../include -arch i386 -undef -D__GNUC__=2 -D__GNU__ -Di386 -DNeXT
-Dunix -D__i386__ -D__NeXT__ -D__unix__ -D__MACH__
-D__LITTLE_ENDIAN__ -D__ARCHITECTURE__=\"i386\" -D__i386 -D__NeXT
-D__unix -D__OPTIMIZE__ -g -dynamic -D__STDC__ -D_NEXT_SOURCE
-DNX_COMPILER_RELEASE_3_0=300 -DNX_COMPILER_RELEASE_3_1=310
-DNX_COMPILER_RELEASE_3_2=320 -DNX_COMPILER_RELEASE_3_3=330
-DNX_CURRENT_COMPILER_RELEASE=400 -DNS_TARGET_MINOR=0
-DNS_TARGET_MAJOR=4 -DNS_TARGET=40 -D__GNUC_MINOR__=5 -D__NEXT_CPP__
-D__DYNAMIC__ -DHAVE_CONFIG_H
-DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
-DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=0 -DV_MINOR=5
-D_GNU_SOURCE sanei_save_values.c /usr/tmp/cc002351.i
NeXT DevKit-based CPP 4.0
/lib/i386/cc1obj /usr/tmp/cc002351.i -arch i386 -quiet -dumpbase
sanei_save_values.c -dynamic -g -O2 -version -fPIC -o
/usr/tmp/cc002351.s
GNU Objective-C version 2.5.8 (80386, BSD syntax) compiled by GNU C
version 2.5.8.
sanei_save_values.c: In function `sanei_save_values':
sanei_save_values.c:64: `read' undeclared (first use this function)
sanei_save_values.c:64: (Each undeclared identifier is reported only once
sanei_save_values.c:64: for each function it appears in.)
sanei_save_values.c:65: `write' undeclared (first use this function)

Is "-I../include -I../include -arch i386 -undef " something to do
with the problem? There doesn't seem to be an include search list in
the format we were expecting.
Neither is there any mention of /NextDeveloper/Headers/bsd
>
> What you are interested in is finding the declarations of the
> `read' and `write' system functions in your system header files.
> That work is up to you, but here is a suggestion of how to go about
> it:
>
phaedrus:31# grep read /usr/include/*.h
No match.

phaedrus:32# find /usr/include -type f | xargs grep read
phaedrus:33#

phaedrus:33# find /usr/include -follow -type f | xargs grep read
find: bad option < -follow >

> Use the directories from your own search list, rather than
> `/usr/include'. Record the output, and send it to the mailing list.
> That will give both you and us some hint of how to proceed.
>
phaedrus:34# grep read /NextDeveloper/Headers/bsd/*.h
/NextDeveloper/Headers/bsd/ci.h:extern char cinext[]; /*
use this instead of reading file */
/NextDeveloper/Headers/bsd/exportent.h:#define RO_OPT "ro"
/* export read-only */
/NextDeveloper/Headers/bsd/exportent.h:#define RW_OPT "rw"
/* export read-mostly */
/NextDeveloper/Headers/bsd/fstab.h:#define FSTAB_RW "rw"
/* read/write device */
/NextDeveloper/Headers/bsd/fstab.h:#define FSTAB_RQ "rq"
/* read/write with quotas */
/NextDeveloper/Headers/bsd/fstab.h:#define FSTAB_RO "ro"
/* read-only device */
/NextDeveloper/Headers/bsd/libc.h:extern int read(int, void *,
int), write(int, const void *, int);
/NextDeveloper/Headers/bsd/libc.h:extern int readv(int, struct
iovec *, int), writev(int, struct iovec *, int);
/NextDeveloper/Headers/bsd/libc.h:extern int readlink(const char
*, char *, int);
/NextDeveloper/Headers/bsd/mntent.h:#define MNTOPT_RO "ro"
/* read only */
/NextDeveloper/Headers/bsd/mntent.h:#define MNTOPT_RW "rw"
/* read/write */
/NextDeveloper/Headers/bsd/mtab.h: char m_type[4];
/* read-only, quotas */
/NextDeveloper/Headers/bsd/ndbm.h: long dbm_blkno;
/* current page to read/write */
/NextDeveloper/Headers/bsd/ndbm.h:#define _DBM_RDONLY 0x1 /*
data base open read-only */
/NextDeveloper/Headers/bsd/pcc.h: * needed to use the
intermediate code files generated and read by
/NextDeveloper/Headers/bsd/syscall.h:#define SYS_read 3
/NextDeveloper/Headers/bsd/syscall.h:#define SYS_readlink 58
/NextDeveloper/Headers/bsd/syscall.h: /*
67 is old: vread */
/NextDeveloper/Headers/bsd/syscall.h:#define SYS_readv 120
/NextDeveloper/Headers/bsd/sysexits.h:** already return. The
meaning of the codes is approximately
/NextDeveloper/Headers/bsd/sysexits.h:** exist or was
not readable. This could also include
/NextDeveloper/Headers/bsd/tar.h: #define TUREAD
00400 /* read by owner */
/NextDeveloper/Headers/bsd/tar.h: #define TGREAD
00040 /* read by group */
/NextDeveloper/Headers/bsd/tar.h: #define TOREAD
00004 /* read by other */
/NextDeveloper/Headers/bsd/unistd.h: extern ssize_t
read(int fildes, void *buf, size_t nbyte);
/NextDeveloper/Headers/bsd/unistd.h: extern ssize_t read();

Thanks again, but I don't think I'm doing very well here. Sorry to
be such a complete dimwit.
Is it possible that putting /NextDeveloper/Headers/bsd somewhere in
the include path might be helpful?

Once again many thanks,
Neville

--
   Internet: jnw@phaedrus.demon.co.uk    CompuServe: 100042,3501
             j.n.wilford@ncl.ac.uk       PGP 2.x public key available

--
Source code, list archive, and docs: http://www.azstarnet.com/~axplinux/sane/
To unsubscribe: mail -s unsubscribe sane-devel-request@listserv.azstarnet.com