[racket-dev] Build failure on specific PPC systems

From: Lennart Sorensen (lsorense at csclub.uwaterloo.ca)
Date: Wed Aug 24 23:31:05 EDT 2011

On Wed, Aug 24, 2011 at 10:58:04PM -0400, Lennart Sorensen wrote:
> On Wed, Aug 24, 2011 at 07:30:07PM -0400, James Vega wrote:
> > Since at least 4.2.4, Racket has been failing to build[0][1] for Debian
> > on G5-based PowerPC systems[2][3].  At the time, the only other PowerPC
> > system that was available within Debian to debug on was a G4-based
> > system[4].  On that system, Racket has been building fine using either
> > the 3m or cgc GC.
> > 
> > Since I've generally had more luck using the cgc GC on less mainstream
> > systems, I set the build to use that for PowerPC and let it be in case
> > things changed and it started working.
> > 
> > Since we recently got access to a G5-based system[5], I've had a chance
> > to do some poking around and have found the following:
> > 
> > - Building with cgc fails:
> > 
> >   make[5]: Entering directory `/home/jamessan/racket-5.1.3+dfsg1/build/plot'
> >   env CC="gcc" CFLAGS="-g  -Wall     " LDFLAGS="" ../racket/racketcgc -c /home/jamessan/racket-5.1.3+dfsg1/src/plot/build.rkt "libplplot" /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/dc_drv.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plcont.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plfill.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plmap.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plshade.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plwind.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/pdfutils.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plcore.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plgridd.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plmeta.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plstripc.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plargs.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plctrl.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plhist.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/pl
> ot
> > 3d.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plsym.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plbox.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plcvt.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plimage.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plpage.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/pltick.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plbuf.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/pldtik.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plline.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plsdef.c /home/jamessan/racket-5.1.3+dfsg1/src/plot/plplot/plvpor.c
> >   make[5]: *** [libplplot.so] Segmentation fault (core dumped)
> > 
> > - Building with cgc and -DMZ_DONT_USE_JIT works
> > 
> > - Building with 3m fails:
> > 
> >   make[5]: Entering directory `/home/jamessan/racket-5.1.3+dfsg1/build/racket/gc2'
> >   env XFORM_PRECOMP=yes ../racketcgc -cqu /home/jamessan/racket-5.1.3+dfsg1/src/racket/gc2/xform.rkt --setup . --cpp "gcc -E -I./.. -I/home/jamessan/racket-5.1.3+dfsg1/src/racket/gc2/../include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 "  --keep-lines -o xsrc/precomp.h /home/jamessan/racket-5.1.3+dfsg1/src/racket/gc2/precomp.c
> >   make[5]: *** [xsrc/precomp.h] Segmentation fault (core dumped)
> > 
> > - Building with 3m and -DMZ_DONT_USE_JIT gets further than 3m on its
> >   own, but still fails:
> > 
> >   make[6]: Entering directory `/home/jamessan/racket-5.1.3+dfsg1/build/gracket/gc2'
> >   ../../racket/racket3m -cqu /home/jamessan/racket-5.1.3+dfsg1/src/gracket/gc2/../../racket/gc2/xform.rkt --setup ../../racket/gc2 --cpp "gcc -E -I/home/jamessan/racket-5.1.3+dfsg1/src/gracket/gc2/../../racket/gc2 -I./../../racket/ -I/home/jamessan/racket-5.1.3+dfsg1/src/gracket/gc2/../../racket/include/     -Dwx_xt -MMD"  --keep-lines -o xsrc/grmain.c +D INITIAL_COLLECTS_DIRECTORY='"'"`cd /home/jamessan/racket-5.1.3+dfsg1/src/gracket/gc2/../../../collects; pwd`"'"' /home/jamessan/racket-5.1.3+dfsg1/src/gracket/gc2/../grmain.c
> >   SIGSEGV MAPERR si_code 1 fault on addr 0x4
> >   make[6]: *** [xsrc/grmain.c] Aborted (core dumped)
> > 
> > I can provide stack traces of the relevant failures, if needed.
> > 
> > Interestingly, a binary built with 3m on a G4 runs
> > collects/test/racket/all.rktl just fine on the G5 system.
> > 
> > What differences are there between the G5 and G4 that could cause this
> > discrepancy?  What information can I provide or debugging can I perform
> > to help determine the problem?
> 
> I believe that the IBM 970 used in the G5 has one unusual behaviour
> compared to most other powerpc chips.  Unlike most other powerpcs the
> 970 can not switch endianess.  See the note about virtual PC here:
> http://en.wikipedia.org/wiki/PowerPC#Design_features
> 
> So that could very well be breaking other code too if it tries to take
> advantage of that feature.  Virtual PC tried to use little endian mode
> to make emulating x86 code a lot more efficient since the data didn't
> have to be manipulated very much.  Since the 970 couldn't be switched
> to little endian mode, virtual PC couldn't use that trick anymore.
> I could see a JIT compiler that wants to be fast on powerpc trying to
> use that too, ad hence breaking on the 970.

Oh and in case it helps anything, here is a failed build on a power6+ machine of 5.1.1:

....
make[4]: Entering directory `/tmp/racket-5.1.1+dfsg1/build/plot'
/usr/bin/make plot-lib
make[5]: Entering directory `/tmp/racket-5.1.1+dfsg1/build/plot'
env CC="gcc" CFLAGS="-g  -Wall " LDFLAGS="" ../racket/racketcgc -c /tmp/racket-5.1.1+dfsg1/src/plot/build.rkt "libplplot" /tmp/racket-5.1.1+dfsg1/src/plot/plplot/dc_drv.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcont.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plfill.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plmap.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plshade.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plwind.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pdfutils.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcore.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plgridd.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plmeta.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plstripc.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plargs.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plctrl.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plhist.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plot3d.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plsym.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plbox.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcvt.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plimage.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plpage.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pltick.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plbuf.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pldtik.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plline.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plsdef.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plvpor.c
Segmentation fault
make[5]: *** [libplplot.so] Error 139
make[5]: Leaving directory `/tmp/racket-5.1.1+dfsg1/build/plot'
make[4]: *** [cgc] Error 2
make[4]: Leaving directory `/tmp/racket-5.1.1+dfsg1/build/plot'
make[3]: *** [plot-cgc] Error 2
make[3]: Leaving directory `/tmp/racket-5.1.1+dfsg1/build'
make[2]: *** [cgc] Error 2
make[2]: Leaving directory `/tmp/racket-5.1.1+dfsg1/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/racket-5.1.1+dfsg1/build'
make: *** [debian/stamp-makefile-build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2

Of course it also occured to me that the G5 (IBM 970) and the power6+
I am using are 64bit powerpc machines, while the G4 is 32bit I believe.
Might matter.

Using gdb shows:
rceng03:/tmp/racket-5.1.1+dfsg1/build/plot# env CC="gcc" CFLAGS="-g  -Wall " LDFLAGS="" gdb --args ../racket/racketcgc  -c /tmp/racket-5.1.1+dfsg1/src/plot/build.rkt "libplplot" /tmp/racket-5.1.1+dfsg1/src/plot/plplot/dc_drv.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcont.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plfill.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plmap.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plshade.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plwind.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pdfutils.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcore.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plgridd.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plmeta.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plstripc.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plargs.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plctrl.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plhist.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plot3d.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plsym.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plbox.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcvt.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plimage.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plpage.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pltick.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plbuf.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pldtik.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plline.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plsdef.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plvpor.c
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/racket-5.1.1+dfsg1/build/racket/racketcgc...done.
(gdb) run
Starting program: /tmp/racket-5.1.1+dfsg1/build/racket/racketcgc -c /tmp/racket-5.1.1+dfsg1/src/plot/build.rkt libplplot /tmp/racket-5.1.1+dfsg1/src/plot/plplot/dc_drv.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcont.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plfill.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plmap.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plshade.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plwind.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pdfutils.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcore.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plgridd.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plmeta.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plstripc.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plargs.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plctrl.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plhist.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plot3d.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plsym.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plbox.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plcvt.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plimage.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plpage.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pltick.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plbuf.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/pldtik.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plline.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plsdef.c /tmp/racket-5.1.1+dfsg1/src/plot/plplot/plvpor.c

Program received signal SIGSEGV, Segmentation fault.
0xf7edb9b8 in ?? ()
	(gdb) where
#0  0xf7edb9b8 in ?? ()
#1  0x100e0f00 in scheme_native_arity_check (closure=0xf7c4d420, argc=0) at /tmp/racket-5.1.1+dfsg1/src/racket/src/jit.c:3673
#2  0x1006c744 in scheme_do_eval (obj=0xf7c4d420, num_rands=0, rands=0x0, get_value=-1) at /tmp/racket-5.1.1+dfsg1/src/racket/src/eval.c:9464
#3  0x10069dc0 in _scheme_apply_multi_from_native (rator=0xf7c4d420, argc=0, argv=0x0) at /tmp/racket-5.1.1+dfsg1/src/racket/src/schnapp.inc:84
#4  0x103a4a74 in ?? ()
#5  0x1006c8b0 in scheme_do_eval (obj=0x0, num_rands=0, rands=0x0, get_value=0) at /tmp/racket-5.1.1+dfsg1/src/racket/src/eval.c:9488
	Backtrace stopped: previous frame inner to this frame (corrupt stack?)

-- 
Len Sorensen



Posted on the dev mailing list.