[comp.lang.c] sysV 2.0 vs 3.1 compatibility?

walquist@s.cs.uiuc.edu (12/02/88)

I am having trouble with a program (namely, CAL) that I'm attempting
to compile on Unix sysV version 3.1 software.  It works when compiled on
version 2.0.4, but a call to fopen() in a 3.1 executable causes the program
to die (or be killed; the error message simply reads "Killed").

Background:
  the compiler used is "dmdcc", a compiler for software developed for the 
  AT&T 5620 (the blit).  The same DMD Application Development Uilities
  exist on each machine (2.0 and 3.1).

  When I compile this program with dmdcc and run it (using an existing file
  "temp"), it exits with "Killed." and no other output.

  #include <blitio.h>
  main() {

     FILE *fp;
     int c;

     fp = fopen("temp","r");
     while ((c=getc(fp)) != EOF) putc(stdout);
     fclose(fp);
  }

  When I compile the same program with cc (replacing <blitio.h> with <stdio.h>),
  everything is fine.

Also:
  these errors come up for 3.1 compiles, but not 2.0.4 compiles:

  /usr/DMD/include/jerqproc.h: 103: extra tokens (ignored) after directive
  /usr/DMD/include/mpx.h: 135: extra tokens (ignored) after directive
  /usr/DMD/include/font.h: 43: extra tokens (ignored) after directive

  What is a token? a directive?

-Christopher

gwyn@smoke.BRL.MIL (Doug Gwyn ) (12/15/88)

In article <207600011@s.cs.uiuc.edu> walquist@s.cs.uiuc.edu writes:
-I am having trouble with a program (namely, CAL) that I'm attempting
-to compile on Unix sysV version 3.1 software.  It works when compiled on
-version 2.0.4, but a call to fopen() in a 3.1 executable causes the program
-to die (or be killed; the error message simply reads "Killed").
-Background:
-  the compiler used is "dmdcc", a compiler for software developed for the 
-  AT&T 5620 (the blit).  The same DMD Application Development Uilities
-  exist on each machine (2.0 and 3.1).
-  When I compile this program with dmdcc and run it (using an existing file
-  "temp"), it exits with "Killed." and no other output.

Why in the world are you trying to use dmdcc to build anything
other than a downloadable DMD (5620) binary?  It is definitely
not intended for any other purpose.  If it worked before, it was
just an accident (I have to wonder about the way it was installed;
for example, where did getc() and stdout get defined?  They're
not DMD concepts).

guy@auspex.UUCP (Guy Harris) (12/16/88)

> When I compile the same program with cc (replacing <blitio.h> with <stdio.h>),
> everything is fine.

The "Killed" sounds like the UNIX error message generated when a UNIX
process dies with signal SIGKILL; the S5R3.1 kernel will generate that
signal if it discovers that the file the process is trying to "exec"
can't be executed after it has already reamed the address space of the
process out preparatory to executing the new program.  It sounds like
your executable file may be busted. 

If, in fact, you're trying to run this program on your host machine
(3B2?), not on the 5620, that's your problem; "dmdcc" presumably
generates an executable image for the 5620, and that may well not be set
up to be executable under UNIX.

>  /usr/DMD/include/jerqproc.h: 103: extra tokens (ignored) after directive
>  /usr/DMD/include/mpx.h: 135: extra tokens (ignored) after directive
>  /usr/DMD/include/font.h: 43: extra tokens (ignored) after directive
>
>  What is a token? a directive?

A "token" is something like the FOOBAR in the line

	#endif FOOBAR

and a "directive" is like the "#endif" in that same line.  The dpANS
disallows extra tokens such as that in "#else" and "#endif" lines; the
S5R3.1 C compiler's preprocessor pass was changed to generate warnings
when it sees them.  The DMD include files may not have been fixed to say
something like

	#endif /* FOOBAR */

instead.

rwhite@nusdhub.UUCP (Robert C. White Jr.) (12/17/88)

in article <718@auspex.UUCP>, guy@auspex.UUCP (Guy Harris) says:
> If, in fact, you're trying to run this program on your host machine
> (3B2?), not on the 5620, that's your problem; "dmdcc" presumably
> generates an executable image for the 5620, and that may well not be set
> up to be executable under UNIX.

I missed the first part of this but ....

If you have an executable for a dmd terminal (I use a 630, not a 
5620) you have to "jx <program> <arg1> <arg2> ..." the program to
make the computer download it into the terminal and start it running
there.

I am not shure about the half-and-half programs that end up running
executables on both machines.

I know you get the "Killed" message if you make a 630 image executable
and try to run it on a 3B2.  The processors and data spaces are totally
different.

Rob.