[racket-dev] Build failure on specific PPC systems

From: Lennart Sorensen (lsorense at csclub.uwaterloo.ca)
Date: Wed Aug 24 22:58:04 EDT 2011

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/plot
> 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:

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.

> [0]: https://buildd.debian.org/status/logs.php?pkg=racket&arch=powerpc
> [1]: https://buildd.debian.org/status/logs.php?pkg=plt-scheme&arch=powerpc
> [2]: http://db.debian.org/machines.cgi?host=praetorious
> [3]: http://db.debian.org/machines.cgi?host=poulenc
> [4]: http://db.debian.org/machines.cgi?host=pescetti
> [5]: http://db.debian.org/machines.cgi?host=shooreinet

Len Sorensen

Posted on the dev mailing list.