[comp.windows.x] Problems building X11R4 under SunOS 4.1.1 with gcc-1.39

jdb@arp.anu.edu.au (John Barlow) (02/06/91)

Hi.  I was looking through the old news, and found your posting.
I still havent read the latest news, but here is my current status:

> Sun 4/390 running SunOS4.1.1 with colour monitor (gx board ?) (8 bit ??)
> (didn't install sunview etc, knowing I was going to use X)

> gcc 1.39

> X11R4 patch level 18

tried compiling, found errors (as I had not set:

	#define UseSunWindowsInServer   NO

which I then fixed - I didn't want sunwindow support).

Then I got errors because X11 was looking for sundev/cg6reg.h
and couldn't find it, so I copied it from another machine
(sunOS 4.1.1 omission I believe)

Then it compiled except that the "rgb" stuff didn't work
(X11R4/mit/rgb directory).  the compiled "rgb" executable
dumped core (creating zero length rgb.pag and rgb.dir files).
Note that I have:

	#define HasNdbm            YES

set.  When I compiled rgb.c with cc instead of gcc, it worked.
I never fully tested the system as it would require complete
recompilation with cc (the server has ndbm code in it, which also
fails).

Am i doing something basic that it wrong ?? (who knows :-)

more information follows, read only if capable of (and want to) sorting the mess
out:

Problem:  executable "rgb" dumps core after creating "rgb.pag" and "rgb.dir"
from "rgb.txt" data file in X11R4/mit/rgb directory.  No data is found in
"rgb.pag" and "rgb.dir".

System: Sun 4/390 w. cg6 graphics (I think) SunOS 4.1.1, gcc1.39, X11R4 patch18

Make output for "World"
...
>making all in ./rgb...
>gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -O   -I../. -I../. -I.././
>server/include    -DNDBM   -target sun4 -c  rgb.c
>rm -f rgb
>gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -o rgb rgb.o -O     -ldbm
>gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -O   -I../. -I../. -I.././
>server/include    -DNDBM   -target sun4 -c  showrgb.c
>rm -f showrgb
>gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -o showrgb showrgb.o -O
>  -ldbm
>rm -f rgb.pag rgb.dir
>./rgb rgb < rgb.txt
>sh: 15139 Memory fault - core dumped
>*** Error code 139
>make: Warning: Target `all' not remade because of errors
>Current working directory /usr/local/src/X11/mit/rgb
... (goes on with rest of make)

and dbx output from the core file:

>Reading symbolic information...
>Read 36 symbols
>warning: core file read error: address not in data space
>program terminated by signal SEGV (no mapping at the fault address)
>(dbx) where
>warning: core file read error: address not in data space
>dcalchash() at 0xf770a82c
>dbm_store() at 0xf7709688
>main() at 0x2754

and some of the preprocessed C code:

> key.dsize = n;
> rgb.red = (red * 65535) / 255;
> rgb.green = (green * 65535) / 255;
> rgb.blue = (blue * 65535) / 255;
> if (dbm_store (rgb_dbm, key, content, 1 )) {
>     fprintf ((&_iob[2]) , "%s:  store of entry \"%s\" failed\n",
>              ProgramName, name);
>     fflush ((&_iob[2]) );
> }

and some of the SPARC code

L16:
        ld [%fp-1124],%l2
        st %l2,[%fp-572]
        ld [%fp-540],%o0
        ! start open coded multiply
        mov %o0,%g1
        sub %g0,%g1,%o0
        sll %g1,16,%g1
        add %o0,%g1,%o0
        ! end open coded multiply
        mov %o0,%o0
        mov 255,%o1
        call .div,0
        nop
        mov %o0,%o0
        sth %o0,[%fp-568]
        ld [%fp-548],%o0
        ! start open coded multiply
        mov %o0,%g1
        sub %g0,%g1,%o0
        sll %g1,16,%g1
        add %o0,%g1,%o0
        ! end open coded multiply
        mov %o0,%o0
        mov 255,%o1
        call .div,0
        nop
        mov %o0,%o0
        sth %o0,[%fp-566]
        ld [%fp-556],%o0
        ! start open coded multiply
        mov %o0,%g1
        sub %g0,%g1,%o0
        sll %g1,16,%g1
        add %o0,%g1,%o0
        ! end open coded multiply
        mov %o0,%o0
        mov 255,%o1
        call .div,0
        nop
        mov %o0,%o0
        sth %o0,[%fp-564]
        ld [%fp-1140],%o0
        ld [%fp-576],%o1
        ld [%fp-572],%o2
        ld [%fp-584],%o3
        ld [%fp-580],%o4
        mov 1,%o5
        call _dbm_store,0
        nop
        mov %o0,%o0
        tst %o0
        be L19
        nop

PS: what is the "mov %o0,%o0" statement doing ??? (pardon my ignorance
at SPARC code).

Thanks,  John Barlow
-- 
jdb = John Barlow, Parallel Computing Research Facility,
Australian National University, I-Block, PO Box 4, Canberra, 2601, Australia.
email = jdb@arp.anu.edu.au
[International = +61 6, Australia = 06] [Phone = 2492930, Fax = 2490747]