[comp.unix.aux] rcs/diff, and gcc vs cc

sorensen@athena.mit.edu (Alma G. Sorensen) (04/19/91)

I'm trying to get rcs working under 2.0.

It tells me rcs needs a diff that does -n or something, which
from the man page A/UX's diff doesn't do. Fine. Gnu's does.

However, when I try to compile gnu's diff-1.15, I get errors:

        gcc -O -DUSG -DSYSV -c diff.c
diff.c: In function compare_files:
diff.c:504: `S_IFDIR' undeclared (first use this function)
diff.c:504: (Each undeclared identifier is reported only once
diff.c:504: for each function it appears in.)
diff.c:504: `S_IFMT' undeclared (first use this function)
Make: *** Error: Update of diff.o terminated with exit code 1
 

Strangely, if I use cc instead of gcc, things compile fine!

I must have gcc installed wrong...What could I be missing?

Thanks,
Greg Sorensen
sorensen@athena.mit.edu

tony@kahu.marcam.dsir.govt.nz (Tony Cooper) (04/20/91)

In article <1991Apr19.151316.26992@athena.mit.edu>,
sorensen@athena.mit.edu (Alma G. Sorensen) writes:
|> I'm trying to get rcs working under 2.0.
|> 
|> However, when I try to compile gnu's diff-1.15, I get errors:
|> 
|>         gcc -O -DUSG -DSYSV -c diff.c
|> diff.c: In function compare_files:
|> diff.c:504: `S_IFDIR' undeclared (first use this function)
|> diff.c:504: (Each undeclared identifier is reported only once
|> 
|> Strangely, if I use cc instead of gcc, things compile fine!
|> 
I'm not going to tell you how to fix this problem, but tell how to fix this
type of problem.

A/UX can compile programs for several different environments - BSD and SYSV.
The defines -DUSG and -DSYSV do not work in A/UX for defining the SYSV
environment. cc defines the right ones by default, gcc does not. When the
right flags are defined then S_IFDIR gets defined, else it doesn't. Read
the man page for cc(1) for more information.

In general, when a system identifier is not defined, do this: go into the
/usr/include directory and do "fgrep -l S_IFDIR *". If that doesn't find
it try /usr/include/sys or other directories under /usr/include or do a
more sophisticated search of the hierarchy. If you find a .h file that
defines S_IFDIR then examine your program and the .h file to see why it
is not being defined in the program. Usually it is because the .h file
is not included in the program. Sometimes it is because the definition
(as in your case probably) has been 'ifdef'ed out eg
#ifdef SOME_OTHER_SYMBOL
#define S_IFDIR XXXXX
#endif
Then you should make sure that SOME_OTHER_SYMBOL is defined. Get the idea?
You gotta know how the C preprocessor works so you have to have some C
programming knowledge.

Tony Cooper

liam@cs.qmw.ac.uk (William Roberts;) (04/24/91)

In <1991Apr19.151316.26992@athena.mit.edu> sorensen@athena.mit.edu (Alma G. 
Sorensen) writes:

>I'm trying to get rcs working under 2.0.

Have you perchance tried running /usr/ucb/rcs, as distributed with A/UX 2.0?
The /FILES list of contents file on my A/UX 2.0 CD-ROM says the following:

% grep rcs /nfs/CDROM/FILES
/mac/lib/cmdo/r/rcs     Commando dialog source script for the rcs command
/mac/lib/cmdo/r/rcsdiff Commando dialog source script for the rcsdiff command
/mac/lib/cmdo/r/rcsmerge        Commando dialog source script for the rcsmerge 
command
/mac/lib/cmdo/s/sccstorcs       Commando dialog source script for the 
sccstorcs command
/usr/catman/a_man/man1/sccstorcs.1m.z   formatted manual entry for 
sccstorcs(1M)
/usr/catman/u_man/man1/rcs.1.z  formatted manual entry for rcs(1)
/usr/catman/u_man/man1/rcsdiff.1.z      formatted manual entry for rcsdiff(1)
/usr/catman/u_man/man1/rcsintro.1.z     formatted manual entry for rcsintro(1)
/usr/catman/u_man/man1/rcsmerge.1.z     formatted manual entry for rcsmerge(1)
/usr/catman/u_man/man3/strcspn.3c.z     formatted manual entry for strcspn(3c)
/usr/catman/u_man/man4/rcsfile.4.z      formatted manual entry for rcsfile(4)
/usr/ucb/rcs    binary executable for rcs(1) - change RCS file attributes
/usr/ucb/rcsdiff        binary executable for rcsdiff(1) - compare RCS 
revisions
/usr/ucb/rcsmerge       binary executable for rcsmerge(1) - merge RCS revisions
/usr/ucb/sccstorcs      binary executable for sccstorcs(1) - build RCS file 
from SCCS file

My only gripe with the supplied rcs is that the tools all believe in 14 
character filename limits.
--

William Roberts                 Internet:  liam@dcs.qmw.ac.uk
Queen Mary & Westfield College  UUCP:      liam@qmw-dcs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  +44 71-975 5234 (Fax: +44 81-980 6533)