[comp.windows.interviews] Need help compiling InterViews 3.0-beta

loeffler@bluebell.aca.mcc.com (David D. Loeffler) (06/21/91)

I am using
 Sun's CC (C++ compiler version 2.0)
 Sun3/110 with attached hard disk for swap
 OS 4.0.3
I have applied all 10 fix files.

I get a strange Bus error when compiling xwindow.c.  Has anyone else
seen this?  Or am I doing something wrong.  I have include the error
messsage and some extra info.

Thanks,
  Dave


From the directory .../iv/src/lib/IV-X11
...
-r--r--r--  1 loeffler    16856 Apr  9 17:40 xworld.c.orig
-rw-r--r--  1 loeffler      693 Apr 12 01:50 Imakefile
-r--r--r--  1 loeffler    36243 Apr 16 14:42 xcanvas.c
-r--r--r--  1 loeffler    28883 Apr 16 14:47 xwindow.c <<<< PATCHED by fix1
...

I get this error when compiling .../iv/src/lib/IV-X11/xworld.c

compiling ../xwindow.c
rm -f xwindow.o xwindow..c
/usr/CC/sun3/CC    -O  -pic   -Dcplusplus_2_0     -I..    -I../../../.././src/include  -I/usr/
local/X/include     -c ../xwindow.c
CC  ../xwindow.c:
cc   -c -I/usr/CC/incl -I.. -I../../../.././src/include -I/usr/local/X/include  -O -pic xwindo
w.c
cc: Fatal error in cpp: Bus error
*** Error code 1
make: Fatal error: Command failed for target `xwindow.o'

Any idea of what the problem might be????

A diff shows:

daystar.DDL [140]: diff ../xworld.c ../xworld.c.orig
148a149,152
>     case StaticGray:
>       rgbtable_ = nil;
>       white_ = (1 << visual_->bits_per_rgb) - 1;
>       break;
151d154
<       break;
394a398,406
>       break;
>     case StaticGray:
>       unsigned long gray = rescale(
>           (30 * red + 59 * green + 11 * blue) / 100, 0xffff, white_
>       );
>       xc.pixel = gray;
>       xc.red = (unsigned short)rescale(gray, white_, 0xffff);
>       xc.green = (unsigned short)rescale(gray, white_, 0xffff);
>       xc.blue = (unsigned short)rescale(gray, white_, 0xffff);
daystar.DDL [141]:

loeffler@bluebell.aca.mcc.com (David D. Loeffler) (06/24/91)

Well I would like to thank two people, Charles Garrett and Brian Kennedy
for their replies.  They read my rather mangled message (written after
fighting too may sysadmin fires here) and sent solutions which I am
posting below.  I used Brian's second option just to finish compiling
the IV-X11 library.  That is, I added the +i option for compiling and
ran "make all" all in that directory only.  This finished the compile
of the library.  Now I am running make all from the iv directory and
all seems to be going well.  If I do run into a problem I will setenv
APP_CCDEFINES to +i in the offending directory and continue.  The
reason many of the compiles failed later was because the IV-X11 lib
did not exist.


-----------------------------------------------------------------------------
    Full-Name: Charles Garrett
    To: loeffler@MCC.COM
    Subject: Re: Need help compiling InterViews 3.0-beta
    Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158


    Hi,

	    Your problem reminds me of one that I had when compiling some
    large C++ files. The problem is that the cfront program creates an
    intermediate C file with lots of #line declarations for cpp to handle.
    In fact some programs will have so many #line declarations that cpp
    will crash. I worked around this problem by writing a shell script that
    removes #line declarations from files before passing them to the C
    compiler. Then I defined the environment variable ccC to call this
    script. When ccC is defined, the C++ compiler will use it rather than
    the regular cc command. I can't be sure that your problem is the
    same one, but it might be something similar, so I will enclose the
    files I wrote for this workaround.

    --------- file mycc ---------

    for A do
	    case $A in
	    *.c)
		    if test -f $A
		    then
			    awk -f awkfile < $A > temp
			    mv temp $A
		    fi;;
	    esac
    done

    cc $*

    --------- file awkfile --------

    $1 != "#line" {print}
    $1 == "#line" && $3 !~ /sweeper|usr|InterViews/ {print}

    -------------------------------

    Then do:
	    setenv ccC mycc


    Good luck,
	    Charlie Garrett

-----------------------------------------------------------------------------

    To: loeffler@bluebell.aca.mcc.com (David D. Loeffler)
    Cc: bmk@csc.ti.com
    Subject: Re: Need help compiling InterViews 3.0-beta
    Date: Fri, 21 Jun 91 15:57:27 -0500
    From: Brian M Kennedy <bmk@ninja.csc.ti.com>

    David,

    This is almost becoming a faq for Sun users.  The cpp shipped with
    SunOS 4.0.3 can only handle a certain number of #line directives.
    Your alternatives are:

	    1) Ask Sun for a copy of the SunOS 4.1 version of cpp.
	       This version has a much higher limit, which I have hit
	       but I'm sure InterViews would not.

	    2) Compile with option +i.  This option is designed to
	       produce the intermediate C file; however, it has the
	       fortunate side-effect of eliminating all #line directives.

	    3) Get Sun CC 2.1 -- I highly recommend this if you do much
	       C++ work at all.  This version is much more stable, has
	       much higher arbitrary limits, and works very well with its
	       dbx and dbxtool (which runs under X now).  Note that it is
	       a much better release than 2.0 was.

	    4) Use GNU cc as your backend C compiler (by setting the ccC
	       environment variable to the full pathname of gcc).
	       GNU cc has no bogus, arbitrary limits.

    Hope this helps,

    == Brian M. Kennedy <bmk@csc.ti.com> ==
    == Computer Systems Laboratory ========
    == Computer Science Center ============
    == Texas Instruments ==================